mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-14 12:19:58 +01:00
Text Alignment made easy and convenient. (#1804)
* text alignment made easy * added description and removed id Co-authored-by: Jeffrey Warren <jeff@unterbahn.com>
This commit is contained in:
@@ -121,7 +121,14 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
|||||||
paramVal + '">' + '<span class="input-group-addon"><i></i></span>' +
|
paramVal + '">' + '<span class="input-group-addon"><i></i></span>' +
|
||||||
'</div>';
|
'</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 =
|
html =
|
||||||
'<input class="form-control target" type="' +
|
'<input class="form-control target" type="' +
|
||||||
inputDesc.type +
|
inputDesc.type +
|
||||||
@@ -402,6 +409,19 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
|||||||
|
|
||||||
var img = $(step.imgElement);
|
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) {
|
img.mousemove(function(e) {
|
||||||
var canvas = document.createElement('canvas');
|
var canvas = document.createElement('canvas');
|
||||||
canvas.width = img.width();
|
canvas.width = img.width();
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ function mapHtmlTypes(inputInfo){
|
|||||||
htmlType = inputInfo.min != undefined ? 'range' : 'text';
|
htmlType = inputInfo.min != undefined ? 'range' : 'text';
|
||||||
if (htmlType === 'range') inputInfo.step = inputInfo.step || 0.1; // default range step size for float
|
if (htmlType === 'range') inputInfo.step = inputInfo.step || 0.1; // default range step size for float
|
||||||
break;
|
break;
|
||||||
|
case 'coordinate-input':
|
||||||
|
htmlType = 'button';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
htmlType = 'text';
|
htmlType = 'text';
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -8,6 +8,10 @@
|
|||||||
"desc": "Enter the text to overlay.",
|
"desc": "Enter the text to overlay.",
|
||||||
"default": "Lorem ipsum"
|
"default": "Lorem ipsum"
|
||||||
},
|
},
|
||||||
|
"Custom-Coordinates": {
|
||||||
|
"type": "coordinate-input",
|
||||||
|
"desc": "Click to fill Coordinates"
|
||||||
|
},
|
||||||
"x": {
|
"x": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"desc": "Starting text horizontal position.",
|
"desc": "Starting text horizontal position.",
|
||||||
|
|||||||
Reference in New Issue
Block a user