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/cjs/index.js
CHANGED
|
@@ -1961,11 +1961,11 @@ var Store = mobxStateTree.types.model('Store', {
|
|
|
1961
1961
|
_toCanvas: function _toCanvas() {
|
|
1962
1962
|
var _arguments = arguments;
|
|
1963
1963
|
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
1964
|
-
var _ref4, _ref4$pixelRatio, pixelRatio, pageId, stage, page, layer, prevX, prevY, prevScaleX, prevScaleY,
|
|
1964
|
+
var _ref4, _ref4$pixelRatio, pixelRatio, pageId, _ref4$mimeType, mimeType, stage, page, layer, prevX, prevY, prevScaleX, prevScaleY, displayOnlyNodes, rawCanvas, finalCanvas, ctx;
|
|
1965
1965
|
return _regenerator().w(function (_context) {
|
|
1966
1966
|
while (1) switch (_context.n) {
|
|
1967
1967
|
case 0:
|
|
1968
|
-
_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;
|
|
1968
|
+
_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;
|
|
1969
1969
|
stage = self._stageRef;
|
|
1970
1970
|
if (stage) {
|
|
1971
1971
|
_context.n = 1;
|
|
@@ -2000,20 +2000,47 @@ var Store = mobxStateTree.types.model('Store', {
|
|
|
2000
2000
|
layer.y(0);
|
|
2001
2001
|
layer.scaleX(1);
|
|
2002
2002
|
layer.scaleY(1);
|
|
2003
|
+
|
|
2004
|
+
// Hide display-only nodes (shadow, checkerboard, overlay) — not wanted in export
|
|
2005
|
+
displayOnlyNodes = layer.find('.display-only');
|
|
2006
|
+
displayOnlyNodes.forEach(function (n) {
|
|
2007
|
+
return n.hide();
|
|
2008
|
+
});
|
|
2003
2009
|
layer.draw();
|
|
2004
|
-
|
|
2010
|
+
rawCanvas = layer.toCanvas({
|
|
2005
2011
|
pixelRatio: pixelRatio,
|
|
2006
2012
|
x: 0,
|
|
2007
2013
|
y: 0,
|
|
2008
2014
|
width: self.width,
|
|
2009
2015
|
height: self.height
|
|
2010
|
-
}); // Restore
|
|
2016
|
+
}); // Restore display-only nodes
|
|
2017
|
+
displayOnlyNodes.forEach(function (n) {
|
|
2018
|
+
return n.show();
|
|
2019
|
+
});
|
|
2020
|
+
|
|
2021
|
+
// Restore layer transform
|
|
2011
2022
|
layer.x(prevX);
|
|
2012
2023
|
layer.y(prevY);
|
|
2013
2024
|
layer.scaleX(prevScaleX);
|
|
2014
2025
|
layer.scaleY(prevScaleY);
|
|
2015
2026
|
layer.draw();
|
|
2016
|
-
|
|
2027
|
+
|
|
2028
|
+
// For JPEG, composite onto a white canvas to eliminate any remaining transparency
|
|
2029
|
+
// (avoids black areas and reduces file size vs checkerboard patterns)
|
|
2030
|
+
if (!(mimeType === 'image/jpeg')) {
|
|
2031
|
+
_context.n = 4;
|
|
2032
|
+
break;
|
|
2033
|
+
}
|
|
2034
|
+
finalCanvas = document.createElement('canvas');
|
|
2035
|
+
finalCanvas.width = rawCanvas.width;
|
|
2036
|
+
finalCanvas.height = rawCanvas.height;
|
|
2037
|
+
ctx = finalCanvas.getContext('2d');
|
|
2038
|
+
ctx.fillStyle = '#ffffff';
|
|
2039
|
+
ctx.fillRect(0, 0, finalCanvas.width, finalCanvas.height);
|
|
2040
|
+
ctx.drawImage(rawCanvas, 0, 0);
|
|
2041
|
+
return _context.a(2, finalCanvas);
|
|
2042
|
+
case 4:
|
|
2043
|
+
return _context.a(2, rawCanvas);
|
|
2017
2044
|
}
|
|
2018
2045
|
}, _callee);
|
|
2019
2046
|
}))();
|
|
@@ -2044,7 +2071,7 @@ var Store = mobxStateTree.types.model('Store', {
|
|
|
2044
2071
|
return _regenerator().w(function (_context3) {
|
|
2045
2072
|
while (1) switch (_context3.n) {
|
|
2046
2073
|
case 0:
|
|
2047
|
-
_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 ?
|
|
2074
|
+
_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);
|
|
2048
2075
|
_context3.n = 1;
|
|
2049
2076
|
return self._toCanvas(_objectSpread2({
|
|
2050
2077
|
mimeType: mimeType
|
|
@@ -10881,7 +10908,7 @@ var CheckerboardBackground = function CheckerboardBackground(_ref) {
|
|
|
10881
10908
|
height: h,
|
|
10882
10909
|
fill: "#ffffff",
|
|
10883
10910
|
listening: false,
|
|
10884
|
-
name: "
|
|
10911
|
+
name: "display-only"
|
|
10885
10912
|
});
|
|
10886
10913
|
return /*#__PURE__*/jsxRuntime.jsx(reactKonva.Rect, {
|
|
10887
10914
|
x: 0,
|
|
@@ -10891,7 +10918,7 @@ var CheckerboardBackground = function CheckerboardBackground(_ref) {
|
|
|
10891
10918
|
fillPatternImage: imgRef.current,
|
|
10892
10919
|
fillPatternRepeat: "repeat",
|
|
10893
10920
|
listening: false,
|
|
10894
|
-
name: "
|
|
10921
|
+
name: "display-only"
|
|
10895
10922
|
});
|
|
10896
10923
|
};
|
|
10897
10924
|
var ImageBackground = function ImageBackground(_ref2) {
|
|
@@ -10975,9 +11002,19 @@ var PageBackground = mobxReactLite.observer(function (_ref3) {
|
|
|
10975
11002
|
});
|
|
10976
11003
|
}
|
|
10977
11004
|
if (bg === 'transparent') {
|
|
10978
|
-
return /*#__PURE__*/jsxRuntime.
|
|
10979
|
-
|
|
10980
|
-
|
|
11005
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
11006
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(reactKonva.Rect, {
|
|
11007
|
+
x: 0,
|
|
11008
|
+
y: 0,
|
|
11009
|
+
width: w,
|
|
11010
|
+
height: h,
|
|
11011
|
+
fill: "#ffffff",
|
|
11012
|
+
listening: false,
|
|
11013
|
+
name: "page-background"
|
|
11014
|
+
}), /*#__PURE__*/jsxRuntime.jsx(CheckerboardBackground, {
|
|
11015
|
+
w: w,
|
|
11016
|
+
h: h
|
|
11017
|
+
})]
|
|
10981
11018
|
});
|
|
10982
11019
|
}
|
|
10983
11020
|
|
|
@@ -11074,7 +11111,8 @@ var PageOverlayFrame = mobxReactLite.observer(function (_ref4) {
|
|
|
11074
11111
|
ctx.fillStrokeShape(shape);
|
|
11075
11112
|
},
|
|
11076
11113
|
fill: "rgba(240,240,240,0.5)",
|
|
11077
|
-
listening: false
|
|
11114
|
+
listening: false,
|
|
11115
|
+
name: "display-only"
|
|
11078
11116
|
});
|
|
11079
11117
|
});
|
|
11080
11118
|
var ALL_ANCHORS = ['top-left', 'top-center', 'top-right', 'middle-left', 'middle-right', 'bottom-left', 'bottom-center', 'bottom-right'];
|
|
@@ -11409,7 +11447,8 @@ var Workspace = mobxReactLite.observer(function (_ref6) {
|
|
|
11409
11447
|
height: store.height,
|
|
11410
11448
|
fill: "rgba(0,0,0,0.1)",
|
|
11411
11449
|
cornerRadius: 0,
|
|
11412
|
-
listening: false
|
|
11450
|
+
listening: false,
|
|
11451
|
+
name: "display-only"
|
|
11413
11452
|
}), /*#__PURE__*/jsxRuntime.jsx(PageBackground, {
|
|
11414
11453
|
store: store
|
|
11415
11454
|
}), page && page.children.map(function (element) {
|