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