P5-2008 fix inches on gores
This commit is contained in:
Vendored
+7
-1
@@ -1136,6 +1136,7 @@ function GoreHandler(viewport) {
|
|||||||
* Then round up to get correct number of gores.
|
* Then round up to get correct number of gores.
|
||||||
*/
|
*/
|
||||||
var count = Math.ceil((bounds.width / step).toFixed(5));
|
var count = Math.ceil((bounds.width / step).toFixed(5));
|
||||||
|
|
||||||
for (var i = 1; i < count; i++) {
|
for (var i = 1; i < count; i++) {
|
||||||
_lines.push(getLine(bounds.left + step * i));
|
_lines.push(getLine(bounds.left + step * i));
|
||||||
}
|
}
|
||||||
@@ -2237,6 +2238,7 @@ module.exports = assertKeyValuePair;
|
|||||||
function calcCrop(obj, width, height, units) {
|
function calcCrop(obj, width, height, units) {
|
||||||
var cropRatio = width / height;
|
var cropRatio = width / height;
|
||||||
var objRatio = obj.width / obj.height;
|
var objRatio = obj.width / obj.height;
|
||||||
|
var inchToCm = units === "inch" ? 2.54 : 1;
|
||||||
|
|
||||||
var returnValue = {
|
var returnValue = {
|
||||||
image: obj,
|
image: obj,
|
||||||
@@ -2259,7 +2261,11 @@ function calcCrop(obj, width, height, units) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pixels per millimeter
|
// Pixels per millimeter
|
||||||
returnValue.ppmm = returnValue.width / ((returnValue.dim.width * obj.scaleX) * 10);
|
var ppmm = returnValue.width / ((returnValue.dim.width * inchToCm * obj.scaleX) * 10);
|
||||||
|
|
||||||
|
//Round to four decimal places to avoid precision issues. At least 4 decimals is needed though
|
||||||
|
//for correct calculation of number of gores on wide wallpaperes in editor.
|
||||||
|
returnValue.ppmm = Math.round(ppmm * 1e4) / 1e4;
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ function GoreHandler(viewport) {
|
|||||||
* Then round up to get correct number of gores.
|
* Then round up to get correct number of gores.
|
||||||
*/
|
*/
|
||||||
var count = Math.ceil((bounds.width / step).toFixed(5));
|
var count = Math.ceil((bounds.width / step).toFixed(5));
|
||||||
|
|
||||||
for (var i = 1; i < count; i++) {
|
for (var i = 1; i < count; i++) {
|
||||||
_lines.push(getLine(bounds.left + step * i));
|
_lines.push(getLine(bounds.left + step * i));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
function calcCrop(obj, width, height, units) {
|
function calcCrop(obj, width, height, units) {
|
||||||
var cropRatio = width / height;
|
var cropRatio = width / height;
|
||||||
var objRatio = obj.width / obj.height;
|
var objRatio = obj.width / obj.height;
|
||||||
|
var inchToCm = units === "inch" ? 2.54 : 1;
|
||||||
|
|
||||||
var returnValue = {
|
var returnValue = {
|
||||||
image: obj,
|
image: obj,
|
||||||
@@ -37,7 +38,11 @@ function calcCrop(obj, width, height, units) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pixels per millimeter
|
// Pixels per millimeter
|
||||||
returnValue.ppmm = returnValue.width / ((returnValue.dim.width * obj.scaleX) * 10);
|
var ppmm = returnValue.width / ((returnValue.dim.width * inchToCm * obj.scaleX) * 10);
|
||||||
|
|
||||||
|
//Round to four decimal places to avoid precision issues. At least 4 decimals is needed though
|
||||||
|
//for correct calculation of number of gores on wide wallpaperes in editor.
|
||||||
|
returnValue.ppmm = Math.round(ppmm * 1e4) / 1e4;
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user