labellife-design-tool 2.2.4 → 2.2.6
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 +61 -13
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model/store.js +42 -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 +61 -13
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model/store.js +42 -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, transformerNodes, 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,56 @@ 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
|
+
});
|
|
2009
|
+
|
|
2010
|
+
// Hide selection transformer handles so they don't appear in exports
|
|
2011
|
+
transformerNodes = layer.find('Transformer');
|
|
2012
|
+
transformerNodes.forEach(function (n) {
|
|
2013
|
+
return n.hide();
|
|
2014
|
+
});
|
|
2003
2015
|
layer.draw();
|
|
2004
|
-
|
|
2016
|
+
rawCanvas = layer.toCanvas({
|
|
2005
2017
|
pixelRatio: pixelRatio,
|
|
2006
2018
|
x: 0,
|
|
2007
2019
|
y: 0,
|
|
2008
2020
|
width: self.width,
|
|
2009
2021
|
height: self.height
|
|
2010
|
-
}); // Restore
|
|
2022
|
+
}); // Restore display-only nodes and transformer handles
|
|
2023
|
+
displayOnlyNodes.forEach(function (n) {
|
|
2024
|
+
return n.show();
|
|
2025
|
+
});
|
|
2026
|
+
transformerNodes.forEach(function (n) {
|
|
2027
|
+
return n.show();
|
|
2028
|
+
});
|
|
2029
|
+
|
|
2030
|
+
// Restore layer transform
|
|
2011
2031
|
layer.x(prevX);
|
|
2012
2032
|
layer.y(prevY);
|
|
2013
2033
|
layer.scaleX(prevScaleX);
|
|
2014
2034
|
layer.scaleY(prevScaleY);
|
|
2015
2035
|
layer.draw();
|
|
2016
|
-
|
|
2036
|
+
|
|
2037
|
+
// For JPEG, composite onto a white canvas to eliminate any remaining transparency
|
|
2038
|
+
// (avoids black areas and reduces file size vs checkerboard patterns)
|
|
2039
|
+
if (!(mimeType === 'image/jpeg')) {
|
|
2040
|
+
_context.n = 4;
|
|
2041
|
+
break;
|
|
2042
|
+
}
|
|
2043
|
+
finalCanvas = document.createElement('canvas');
|
|
2044
|
+
finalCanvas.width = rawCanvas.width;
|
|
2045
|
+
finalCanvas.height = rawCanvas.height;
|
|
2046
|
+
ctx = finalCanvas.getContext('2d');
|
|
2047
|
+
ctx.fillStyle = '#ffffff';
|
|
2048
|
+
ctx.fillRect(0, 0, finalCanvas.width, finalCanvas.height);
|
|
2049
|
+
ctx.drawImage(rawCanvas, 0, 0);
|
|
2050
|
+
return _context.a(2, finalCanvas);
|
|
2051
|
+
case 4:
|
|
2052
|
+
return _context.a(2, rawCanvas);
|
|
2017
2053
|
}
|
|
2018
2054
|
}, _callee);
|
|
2019
2055
|
}))();
|
|
@@ -2044,7 +2080,7 @@ var Store = mobxStateTree.types.model('Store', {
|
|
|
2044
2080
|
return _regenerator().w(function (_context3) {
|
|
2045
2081
|
while (1) switch (_context3.n) {
|
|
2046
2082
|
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 ?
|
|
2083
|
+
_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
2084
|
_context3.n = 1;
|
|
2049
2085
|
return self._toCanvas(_objectSpread2({
|
|
2050
2086
|
mimeType: mimeType
|
|
@@ -10881,7 +10917,7 @@ var CheckerboardBackground = function CheckerboardBackground(_ref) {
|
|
|
10881
10917
|
height: h,
|
|
10882
10918
|
fill: "#ffffff",
|
|
10883
10919
|
listening: false,
|
|
10884
|
-
name: "
|
|
10920
|
+
name: "display-only"
|
|
10885
10921
|
});
|
|
10886
10922
|
return /*#__PURE__*/jsxRuntime.jsx(reactKonva.Rect, {
|
|
10887
10923
|
x: 0,
|
|
@@ -10891,7 +10927,7 @@ var CheckerboardBackground = function CheckerboardBackground(_ref) {
|
|
|
10891
10927
|
fillPatternImage: imgRef.current,
|
|
10892
10928
|
fillPatternRepeat: "repeat",
|
|
10893
10929
|
listening: false,
|
|
10894
|
-
name: "
|
|
10930
|
+
name: "display-only"
|
|
10895
10931
|
});
|
|
10896
10932
|
};
|
|
10897
10933
|
var ImageBackground = function ImageBackground(_ref2) {
|
|
@@ -10975,9 +11011,19 @@ var PageBackground = mobxReactLite.observer(function (_ref3) {
|
|
|
10975
11011
|
});
|
|
10976
11012
|
}
|
|
10977
11013
|
if (bg === 'transparent') {
|
|
10978
|
-
return /*#__PURE__*/jsxRuntime.
|
|
10979
|
-
|
|
10980
|
-
|
|
11014
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
11015
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(reactKonva.Rect, {
|
|
11016
|
+
x: 0,
|
|
11017
|
+
y: 0,
|
|
11018
|
+
width: w,
|
|
11019
|
+
height: h,
|
|
11020
|
+
fill: "#ffffff",
|
|
11021
|
+
listening: false,
|
|
11022
|
+
name: "page-background"
|
|
11023
|
+
}), /*#__PURE__*/jsxRuntime.jsx(CheckerboardBackground, {
|
|
11024
|
+
w: w,
|
|
11025
|
+
h: h
|
|
11026
|
+
})]
|
|
10981
11027
|
});
|
|
10982
11028
|
}
|
|
10983
11029
|
|
|
@@ -11074,7 +11120,8 @@ var PageOverlayFrame = mobxReactLite.observer(function (_ref4) {
|
|
|
11074
11120
|
ctx.fillStrokeShape(shape);
|
|
11075
11121
|
},
|
|
11076
11122
|
fill: "rgba(240,240,240,0.5)",
|
|
11077
|
-
listening: false
|
|
11123
|
+
listening: false,
|
|
11124
|
+
name: "display-only"
|
|
11078
11125
|
});
|
|
11079
11126
|
});
|
|
11080
11127
|
var ALL_ANCHORS = ['top-left', 'top-center', 'top-right', 'middle-left', 'middle-right', 'bottom-left', 'bottom-center', 'bottom-right'];
|
|
@@ -11409,7 +11456,8 @@ var Workspace = mobxReactLite.observer(function (_ref6) {
|
|
|
11409
11456
|
height: store.height,
|
|
11410
11457
|
fill: "rgba(0,0,0,0.1)",
|
|
11411
11458
|
cornerRadius: 0,
|
|
11412
|
-
listening: false
|
|
11459
|
+
listening: false,
|
|
11460
|
+
name: "display-only"
|
|
11413
11461
|
}), /*#__PURE__*/jsxRuntime.jsx(PageBackground, {
|
|
11414
11462
|
store: store
|
|
11415
11463
|
}), page && page.children.map(function (element) {
|