mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-05 16:00:01 +01:00
Display width and height of image at each step (#1309)
This commit is contained in:
committed by
Jeffrey Warren
parent
89626838e3
commit
f1c94fd788
@@ -258,7 +258,8 @@ a.name-header{
|
|||||||
}
|
}
|
||||||
|
|
||||||
.trash-container button.btn-xs {
|
.trash-container button.btn-xs {
|
||||||
margin-top: -5px !important;
|
position: relative;
|
||||||
|
bottom: 7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toggleIcon {
|
.toggleIcon {
|
||||||
@@ -284,3 +285,22 @@ a.name-header{
|
|||||||
.toggle {
|
.toggle {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dimension-tooltip:hover{
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dimension-tooltip:focus{
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dimension-tooltip:focus-within{
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dimension-tooltip{
|
||||||
|
position: relative;
|
||||||
|
bottom: 7px;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #444;
|
||||||
|
}
|
||||||
@@ -31,7 +31,7 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
|||||||
<div class="container-fluid step-container">\
|
<div class="container-fluid step-container">\
|
||||||
<div class="panel panel-default">\
|
<div class="panel panel-default">\
|
||||||
<div class="panel-heading">\
|
<div class="panel-heading">\
|
||||||
<div class="trash-container pull-right"></div>\
|
<div class="trash-container pull-right"><button type="button" class="btn btn-link ' + step.name + ' dimension-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title=""><i class="fa fa-info-circle"></i></button></div>\
|
||||||
<h3 class="panel-title">' +
|
<h3 class="panel-title">' +
|
||||||
'<span class="toggle mouse">' + step.name + ' <span class="caret toggleIcon rotated"></span>\
|
'<span class="toggle mouse">' + step.name + ' <span class="caret toggleIcon rotated"></span>\
|
||||||
<span class="load-spin pull-right" style="display:none;padding:1px 8px;"><i class="fa fa-circle-o-notch fa-spin"></i></span>\
|
<span class="load-spin pull-right" style="display:none;padding:1px 8px;"><i class="fa fa-circle-o-notch fa-spin"></i></span>\
|
||||||
@@ -59,7 +59,7 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
|||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
var tools =
|
var tools =
|
||||||
'<div class="trash">\
|
'<div class="trash" style="display: inline-block">\
|
||||||
<button confirm="Are you sure?" class="remove btn btn-default btn-xs">\
|
<button confirm="Are you sure?" class="remove btn btn-default btn-xs">\
|
||||||
<i class="fa fa-trash"></i>\
|
<i class="fa fa-trash"></i>\
|
||||||
</button>\
|
</button>\
|
||||||
@@ -319,6 +319,13 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
|||||||
.val(step[i]);
|
.val(step[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
_sequencer.getImageDimensions(step.imgElement.src, function (dim) {
|
||||||
|
step.ui.querySelector('.' + step.name).attributes['data-original-title'].value = `<div style="text-align: center"><p>Image Width: ${dim.width}<br>Image Height: ${dim.height}</br></div>`;
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function imageHover(step){
|
function imageHover(step){
|
||||||
|
|||||||
@@ -329,6 +329,7 @@ ImageSequencer = function ImageSequencer(options) {
|
|||||||
log: log,
|
log: log,
|
||||||
objTypeOf: objTypeOf,
|
objTypeOf: objTypeOf,
|
||||||
copy: copy,
|
copy: copy,
|
||||||
|
getImageDimensions: require('./util/getImageDimensions'),
|
||||||
|
|
||||||
setInputStep: require('./ui/SetInputStep')(sequencer)
|
setInputStep: require('./ui/SetInputStep')(sequencer)
|
||||||
};
|
};
|
||||||
|
|||||||
10
src/util/getImageDimensions.js
Normal file
10
src/util/getImageDimensions.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
module.exports = function getImageDimensions(img, cb) {
|
||||||
|
var getPixels = require('get-pixels');
|
||||||
|
var dimensions = { width: '', height: '' };
|
||||||
|
getPixels(img, function(err, pixels) {
|
||||||
|
dimensions.width = pixels.shape[0];
|
||||||
|
dimensions.height = pixels.shape[1];
|
||||||
|
cb(dimensions);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
Reference in New Issue
Block a user