Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text Alignment made easy and convenient. #1804

Merged
merged 4 commits into from
Feb 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion examples/lib/defaultHtmlStepUi.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,14 @@ function DefaultHtmlStepUi(_sequencer, options) {
paramVal + '">' + '<span class="input-group-addon"><i></i></span>' +
'</div>';
}
else { // Non color-picker input types
else if(inputDesc.type === 'button'){
html = '<div><button name="' + paramName + '" type="' + inputDesc.type + '" >\
<i class="fa fa-crosshairs"></i></button>\
<span>click to select coordinates</span>\
</div>';
}
else { // Non color-picker input types and other than a button

html =
'<input class="form-control target" type="' +
inputDesc.type +
Expand Down Expand Up @@ -402,6 +409,19 @@ function DefaultHtmlStepUi(_sequencer, options) {

var img = $(step.imgElement);

let customXCoord = '20'; //default x coordinate
let customYCoord = '20'; //default y coordinate

const customButton = $('button[name="Custom-Coordinates"]');
img.click(function(e) {
customXCoord = e.offsetX;
customYCoord = e.offsetY;
customButton.click(function() {
$('input[name="x"]').val(customXCoord);
$('input[name="y"]').val(customYCoord);
})
});

img.mousemove(function(e) {
var canvas = document.createElement('canvas');
canvas.width = img.width();
Expand Down
3 changes: 3 additions & 0 deletions examples/lib/mapHtmltypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ function mapHtmlTypes(inputInfo){
htmlType = inputInfo.min != undefined ? 'range' : 'text';
if (htmlType === 'range') inputInfo.step = inputInfo.step || 0.1; // default range step size for float
break;
case 'coordinate-input':
htmlType = 'button';
break;
default:
htmlType = 'text';
break;
Expand Down
4 changes: 4 additions & 0 deletions src/modules/TextOverlay/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"desc": "Enter the text to overlay.",
"default": "Lorem ipsum"
},
"Custom-Coordinates": {
"type": "coordinate-input",
"desc": "Click to fill Coordinates"
},
"x": {
"type": "integer",
"desc": "Starting text horizontal position.",
Expand Down