image-sequencer-app-overlay
Advanced tools
Comparing version 1.0.3 to 1.0.4
25
index.js
@@ -18,3 +18,26 @@ function overlay(options, UI, util) { | ||
var parseCornerCoordinateInputs = require('../../util/ParseInputCoordinates'); | ||
var parseCornerCoordinateInputs = function(options, coord, callback) { | ||
var getPixels = require('get-pixels'); | ||
getPixels(coord.src, function(err, pixels) { | ||
var iw = pixels.shape[0], | ||
ih = pixels.shape[1]; | ||
if (!coord.x.valInp) { | ||
return; | ||
} | ||
else { | ||
Object.keys(coord).forEach(convert); | ||
function convert(key) { | ||
var val = coord[key]; | ||
if (val.valInp && val.valInp.slice(-1) === '%') { | ||
val.valInp = parseInt(val.valInp, 10); | ||
if (val.type === 'horizontal') | ||
val.valInp = val.valInp * iw / 100; | ||
else | ||
val.valInp = val.valInp * ih / 100; | ||
} | ||
} | ||
} | ||
callback(options, coord); | ||
}); | ||
}; | ||
@@ -21,0 +44,0 @@ //parse the inputs |
{ | ||
"name": "image-sequencer-app-overlay", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Special purpose overlay module for the mapknitter exporter", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
4942
117
2