labellife-design-tool 2.2.4 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/canvas/workspace.js +19 -7
- package/dist/cjs/canvas/workspace.js.map +1 -1
- package/dist/cjs/index.js +52 -13
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model/store.js +33 -6
- package/dist/cjs/model/store.js.map +1 -1
- package/dist/esm/canvas/workspace.js +20 -8
- package/dist/esm/canvas/workspace.js.map +1 -1
- package/dist/esm/index.js +52 -13
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model/store.js +33 -6
- package/dist/esm/model/store.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1959,11 +1959,11 @@ var Store = types.model('Store', {
|
|
|
1959
1959
|
_toCanvas: function _toCanvas() {
|
|
1960
1960
|
var _arguments = arguments;
|
|
1961
1961
|
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
1962
|
-
var _ref4, _ref4$pixelRatio, pixelRatio, pageId, stage, page, layer, prevX, prevY, prevScaleX, prevScaleY,
|
|
1962
|
+
var _ref4, _ref4$pixelRatio, pixelRatio, pageId, _ref4$mimeType, mimeType, stage, page, layer, prevX, prevY, prevScaleX, prevScaleY, displayOnlyNodes, rawCanvas, finalCanvas, ctx;
|
|
1963
1963
|
return _regenerator().w(function (_context) {
|
|
1964
1964
|
while (1) switch (_context.n) {
|
|
1965
1965
|
case 0:
|
|
1966
|
-
_ref4 = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : {}, _ref4$pixelRatio = _ref4.pixelRatio, pixelRatio = _ref4$pixelRatio === void 0 ? 1 : _ref4$pixelRatio, _ref4.ignoreBackground, pageId = _ref4.pageId, _ref4.mimeType, _ref4.includeBleed, _ref4._skipTimeout, _ref4.quickMode;
|
|
1966
|
+
_ref4 = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : {}, _ref4$pixelRatio = _ref4.pixelRatio, pixelRatio = _ref4$pixelRatio === void 0 ? 1 : _ref4$pixelRatio, _ref4.ignoreBackground, pageId = _ref4.pageId, _ref4$mimeType = _ref4.mimeType, mimeType = _ref4$mimeType === void 0 ? 'image/png' : _ref4$mimeType, _ref4.includeBleed, _ref4._skipTimeout, _ref4.quickMode;
|
|
1967
1967
|
stage = self._stageRef;
|
|
1968
1968
|
if (stage) {
|
|
1969
1969
|
_context.n = 1;
|
|
@@ -1998,20 +1998,47 @@ var Store = types.model('Store', {
|
|
|
1998
1998
|
layer.y(0);
|
|
1999
1999
|
layer.scaleX(1);
|
|
2000
2000
|
layer.scaleY(1);
|
|
2001
|
+
|
|
2002
|
+
// Hide display-only nodes (shadow, checkerboard, overlay) — not wanted in export
|
|
2003
|
+
displayOnlyNodes = layer.find('.display-only');
|
|
2004
|
+
displayOnlyNodes.forEach(function (n) {
|
|
2005
|
+
return n.hide();
|
|
2006
|
+
});
|
|
2001
2007
|
layer.draw();
|
|
2002
|
-
|
|
2008
|
+
rawCanvas = layer.toCanvas({
|
|
2003
2009
|
pixelRatio: pixelRatio,
|
|
2004
2010
|
x: 0,
|
|
2005
2011
|
y: 0,
|
|
2006
2012
|
width: self.width,
|
|
2007
2013
|
height: self.height
|
|
2008
|
-
}); // Restore
|
|
2014
|
+
}); // Restore display-only nodes
|
|
2015
|
+
displayOnlyNodes.forEach(function (n) {
|
|
2016
|
+
return n.show();
|
|
2017
|
+
});
|
|
2018
|
+
|
|
2019
|
+
// Restore layer transform
|
|
2009
2020
|
layer.x(prevX);
|
|
2010
2021
|
layer.y(prevY);
|
|
2011
2022
|
layer.scaleX(prevScaleX);
|
|
2012
2023
|
layer.scaleY(prevScaleY);
|
|
2013
2024
|
layer.draw();
|
|
2014
|
-
|
|
2025
|
+
|
|
2026
|
+
// For JPEG, composite onto a white canvas to eliminate any remaining transparency
|
|
2027
|
+
// (avoids black areas and reduces file size vs checkerboard patterns)
|
|
2028
|
+
if (!(mimeType === 'image/jpeg')) {
|
|
2029
|
+
_context.n = 4;
|
|
2030
|
+
break;
|
|
2031
|
+
}
|
|
2032
|
+
finalCanvas = document.createElement('canvas');
|
|
2033
|
+
finalCanvas.width = rawCanvas.width;
|
|
2034
|
+
finalCanvas.height = rawCanvas.height;
|
|
2035
|
+
ctx = finalCanvas.getContext('2d');
|
|
2036
|
+
ctx.fillStyle = '#ffffff';
|
|
2037
|
+
ctx.fillRect(0, 0, finalCanvas.width, finalCanvas.height);
|
|
2038
|
+
ctx.drawImage(rawCanvas, 0, 0);
|
|
2039
|
+
return _context.a(2, finalCanvas);
|
|
2040
|
+
case 4:
|
|
2041
|
+
return _context.a(2, rawCanvas);
|
|
2015
2042
|
}
|
|
2016
2043
|
}, _callee);
|
|
2017
2044
|
}))();
|
|
@@ -2042,7 +2069,7 @@ var Store = types.model('Store', {
|
|
|
2042
2069
|
return _regenerator().w(function (_context3) {
|
|
2043
2070
|
while (1) switch (_context3.n) {
|
|
2044
2071
|
case 0:
|
|
2045
|
-
_ref6 = _arguments3.length > 0 && _arguments3[0] !== undefined ? _arguments3[0] : {}, _ref6$mimeType = _ref6.mimeType, mimeType = _ref6$mimeType === void 0 ? 'image/png' : _ref6$mimeType, _ref6$quality = _ref6.quality, quality = _ref6$quality === void 0 ?
|
|
2072
|
+
_ref6 = _arguments3.length > 0 && _arguments3[0] !== undefined ? _arguments3[0] : {}, _ref6$mimeType = _ref6.mimeType, mimeType = _ref6$mimeType === void 0 ? 'image/png' : _ref6$mimeType, _ref6$quality = _ref6.quality, quality = _ref6$quality === void 0 ? 0.92 : _ref6$quality, rest = _objectWithoutProperties(_ref6, _excluded2$1);
|
|
2046
2073
|
_context3.n = 1;
|
|
2047
2074
|
return self._toCanvas(_objectSpread2({
|
|
2048
2075
|
mimeType: mimeType
|
|
@@ -10879,7 +10906,7 @@ var CheckerboardBackground = function CheckerboardBackground(_ref) {
|
|
|
10879
10906
|
height: h,
|
|
10880
10907
|
fill: "#ffffff",
|
|
10881
10908
|
listening: false,
|
|
10882
|
-
name: "
|
|
10909
|
+
name: "display-only"
|
|
10883
10910
|
});
|
|
10884
10911
|
return /*#__PURE__*/jsx(Rect, {
|
|
10885
10912
|
x: 0,
|
|
@@ -10889,7 +10916,7 @@ var CheckerboardBackground = function CheckerboardBackground(_ref) {
|
|
|
10889
10916
|
fillPatternImage: imgRef.current,
|
|
10890
10917
|
fillPatternRepeat: "repeat",
|
|
10891
10918
|
listening: false,
|
|
10892
|
-
name: "
|
|
10919
|
+
name: "display-only"
|
|
10893
10920
|
});
|
|
10894
10921
|
};
|
|
10895
10922
|
var ImageBackground = function ImageBackground(_ref2) {
|
|
@@ -10973,9 +11000,19 @@ var PageBackground = observer(function (_ref3) {
|
|
|
10973
11000
|
});
|
|
10974
11001
|
}
|
|
10975
11002
|
if (bg === 'transparent') {
|
|
10976
|
-
return /*#__PURE__*/
|
|
10977
|
-
|
|
10978
|
-
|
|
11003
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
11004
|
+
children: [/*#__PURE__*/jsx(Rect, {
|
|
11005
|
+
x: 0,
|
|
11006
|
+
y: 0,
|
|
11007
|
+
width: w,
|
|
11008
|
+
height: h,
|
|
11009
|
+
fill: "#ffffff",
|
|
11010
|
+
listening: false,
|
|
11011
|
+
name: "page-background"
|
|
11012
|
+
}), /*#__PURE__*/jsx(CheckerboardBackground, {
|
|
11013
|
+
w: w,
|
|
11014
|
+
h: h
|
|
11015
|
+
})]
|
|
10979
11016
|
});
|
|
10980
11017
|
}
|
|
10981
11018
|
|
|
@@ -11072,7 +11109,8 @@ var PageOverlayFrame = observer(function (_ref4) {
|
|
|
11072
11109
|
ctx.fillStrokeShape(shape);
|
|
11073
11110
|
},
|
|
11074
11111
|
fill: "rgba(240,240,240,0.5)",
|
|
11075
|
-
listening: false
|
|
11112
|
+
listening: false,
|
|
11113
|
+
name: "display-only"
|
|
11076
11114
|
});
|
|
11077
11115
|
});
|
|
11078
11116
|
var ALL_ANCHORS = ['top-left', 'top-center', 'top-right', 'middle-left', 'middle-right', 'bottom-left', 'bottom-center', 'bottom-right'];
|
|
@@ -11407,7 +11445,8 @@ var Workspace = observer(function (_ref6) {
|
|
|
11407
11445
|
height: store.height,
|
|
11408
11446
|
fill: "rgba(0,0,0,0.1)",
|
|
11409
11447
|
cornerRadius: 0,
|
|
11410
|
-
listening: false
|
|
11448
|
+
listening: false,
|
|
11449
|
+
name: "display-only"
|
|
11411
11450
|
}), /*#__PURE__*/jsx(PageBackground, {
|
|
11412
11451
|
store: store
|
|
11413
11452
|
}), page && page.children.map(function (element) {
|