labellife-design-tool 2.3.8 → 2.3.9
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 +229 -10
- package/dist/cjs/canvas/workspace.js.map +1 -1
- package/dist/cjs/index.js +556 -14
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model/store.js +215 -3
- package/dist/cjs/model/store.js.map +1 -1
- package/dist/cjs/side-panel/index.js +120 -0
- package/dist/cjs/side-panel/index.js.map +1 -1
- package/dist/cjs/side-panel/side-panel.js +120 -0
- package/dist/cjs/side-panel/side-panel.js.map +1 -1
- package/dist/cjs/toolbar/toolbar.js +18 -1
- package/dist/cjs/toolbar/toolbar.js.map +1 -1
- package/dist/esm/canvas/workspace.js +231 -12
- package/dist/esm/canvas/workspace.js.map +1 -1
- package/dist/esm/index.js +557 -15
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model/store.js +215 -3
- package/dist/esm/model/store.js.map +1 -1
- package/dist/esm/side-panel/index.js +120 -0
- package/dist/esm/side-panel/index.js.map +1 -1
- package/dist/esm/side-panel/side-panel.js +120 -0
- package/dist/esm/side-panel/side-panel.js.map +1 -1
- package/dist/esm/toolbar/toolbar.js +18 -1
- package/dist/esm/toolbar/toolbar.js.map +1 -1
- package/package.json +1 -1
|
@@ -3976,6 +3976,124 @@ var ImageMaskPanel = observer(function (_ref) {
|
|
|
3976
3976
|
});
|
|
3977
3977
|
ImageMaskPanel.displayName = 'ImageMaskPanel';
|
|
3978
3978
|
|
|
3979
|
+
// Cover-fit crop fractions (centered) for a box of given size over an image of natural size.
|
|
3980
|
+
// Mirrors the existing auto-crop calculation in canvas/image-element.js.
|
|
3981
|
+
|
|
3982
|
+
// Minimum scale at which the image (rendered at naturalWidth*scale x naturalHeight*scale)
|
|
3983
|
+
// still fully covers rect.
|
|
3984
|
+
function minScaleForRect(rect, naturalWidth, naturalHeight) {
|
|
3985
|
+
return Math.max(rect.width / naturalWidth, rect.height / naturalHeight);
|
|
3986
|
+
}
|
|
3987
|
+
|
|
3988
|
+
var ImageCropPanel = observer(function (_ref) {
|
|
3989
|
+
var store = _ref.store;
|
|
3990
|
+
var panel = store._toolbarPanel;
|
|
3991
|
+
if (!panel || panel.type !== 'crop') return null;
|
|
3992
|
+
var element = store.getElementById(panel.elementId);
|
|
3993
|
+
if (!element || !element._cropRect) return null;
|
|
3994
|
+
var handleCancel = function handleCancel() {
|
|
3995
|
+
element.cancelCropMode();
|
|
3996
|
+
store.closeToolbarPanel();
|
|
3997
|
+
};
|
|
3998
|
+
var handleDone = function handleDone() {
|
|
3999
|
+
element.commitCropMode();
|
|
4000
|
+
store.closeToolbarPanel();
|
|
4001
|
+
store.history.addUndoState();
|
|
4002
|
+
};
|
|
4003
|
+
var handleReset = function handleReset() {
|
|
4004
|
+
element.resetCropToDefault();
|
|
4005
|
+
};
|
|
4006
|
+
var minScale = minScaleForRect(element._cropRect, element._cropNaturalWidth, element._cropNaturalHeight);
|
|
4007
|
+
var maxScale = minScale * 4;
|
|
4008
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
4009
|
+
sx: {
|
|
4010
|
+
width: 280,
|
|
4011
|
+
height: '100%',
|
|
4012
|
+
overflowY: 'auto',
|
|
4013
|
+
overflowX: 'hidden',
|
|
4014
|
+
backgroundColor: '#fff',
|
|
4015
|
+
borderRight: '1px solid #e0e0e0',
|
|
4016
|
+
flexShrink: 0,
|
|
4017
|
+
p: 2
|
|
4018
|
+
},
|
|
4019
|
+
children: [/*#__PURE__*/jsxs(Box, {
|
|
4020
|
+
sx: {
|
|
4021
|
+
display: 'flex',
|
|
4022
|
+
alignItems: 'center',
|
|
4023
|
+
justifyContent: 'space-between',
|
|
4024
|
+
mb: 2
|
|
4025
|
+
},
|
|
4026
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
4027
|
+
variant: "subtitle1",
|
|
4028
|
+
sx: {
|
|
4029
|
+
fontWeight: 600
|
|
4030
|
+
},
|
|
4031
|
+
children: t('toolbar.crop', 'Crop')
|
|
4032
|
+
}), /*#__PURE__*/jsx(IconButton, {
|
|
4033
|
+
size: "small",
|
|
4034
|
+
onClick: handleCancel,
|
|
4035
|
+
children: /*#__PURE__*/jsx(CloseIcon, {
|
|
4036
|
+
fontSize: "small"
|
|
4037
|
+
})
|
|
4038
|
+
})]
|
|
4039
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
4040
|
+
variant: "body2",
|
|
4041
|
+
sx: {
|
|
4042
|
+
fontWeight: 500,
|
|
4043
|
+
mb: 0.5
|
|
4044
|
+
},
|
|
4045
|
+
children: t('toolbar.cropZoom', 'Zoom')
|
|
4046
|
+
}), /*#__PURE__*/jsx(Slider, {
|
|
4047
|
+
size: "small",
|
|
4048
|
+
value: element._cropImgScale,
|
|
4049
|
+
onChange: function onChange(_, v) {
|
|
4050
|
+
return element.setCropZoom(v);
|
|
4051
|
+
},
|
|
4052
|
+
min: minScale,
|
|
4053
|
+
max: maxScale,
|
|
4054
|
+
step: (maxScale - minScale) / 100 || 0.01,
|
|
4055
|
+
sx: {
|
|
4056
|
+
mb: 3
|
|
4057
|
+
}
|
|
4058
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
4059
|
+
fullWidth: true,
|
|
4060
|
+
variant: "outlined",
|
|
4061
|
+
size: "small",
|
|
4062
|
+
onClick: handleReset,
|
|
4063
|
+
sx: {
|
|
4064
|
+
textTransform: 'none',
|
|
4065
|
+
mb: 3
|
|
4066
|
+
},
|
|
4067
|
+
children: t('toolbar.cropReset', 'Reset')
|
|
4068
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
4069
|
+
sx: {
|
|
4070
|
+
display: 'flex',
|
|
4071
|
+
gap: 1
|
|
4072
|
+
},
|
|
4073
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
4074
|
+
fullWidth: true,
|
|
4075
|
+
variant: "outlined",
|
|
4076
|
+
size: "small",
|
|
4077
|
+
onClick: handleCancel,
|
|
4078
|
+
sx: {
|
|
4079
|
+
textTransform: 'none'
|
|
4080
|
+
},
|
|
4081
|
+
children: t('toolbar.cropCancel', 'Cancel')
|
|
4082
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
4083
|
+
fullWidth: true,
|
|
4084
|
+
variant: "contained",
|
|
4085
|
+
size: "small",
|
|
4086
|
+
onClick: handleDone,
|
|
4087
|
+
sx: {
|
|
4088
|
+
textTransform: 'none'
|
|
4089
|
+
},
|
|
4090
|
+
children: t('toolbar.cropDone', 'Done')
|
|
4091
|
+
})]
|
|
4092
|
+
})]
|
|
4093
|
+
});
|
|
4094
|
+
});
|
|
4095
|
+
ImageCropPanel.displayName = 'ImageCropPanel';
|
|
4096
|
+
|
|
3979
4097
|
var SliderRow = function SliderRow(_ref) {
|
|
3980
4098
|
var label = _ref.label,
|
|
3981
4099
|
value = _ref.value,
|
|
@@ -4501,6 +4619,8 @@ var SidePanel = observer(function (_ref) {
|
|
|
4501
4619
|
});
|
|
4502
4620
|
}() : store._toolbarPanel.type === 'mask' ? /*#__PURE__*/jsx(ImageMaskPanel, {
|
|
4503
4621
|
store: store
|
|
4622
|
+
}) : store._toolbarPanel.type === 'crop' ? /*#__PURE__*/jsx(ImageCropPanel, {
|
|
4623
|
+
store: store
|
|
4504
4624
|
}) : null : (/* Normal panel content */
|
|
4505
4625
|
activeSectionObj && /*#__PURE__*/jsx(Box, {
|
|
4506
4626
|
sx: {
|