@abidibo/react-cam-roi 0.10.0 → 0.11.0
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/README.md +1 -1
- package/dist/index.cjs.js +13 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +13 -6
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -811,12 +811,13 @@ var handleDoubleClickPolygon = function (editorId, canvas, activeColor, setIsDra
|
|
811
811
|
}
|
812
812
|
};
|
813
813
|
var renderFullImagePolygon = function (editorId, canvas, activeColor, imageSize) {
|
814
|
+
var OFFSET = 5;
|
814
815
|
var id = v4();
|
815
816
|
var points = [
|
816
|
-
{ x:
|
817
|
-
{ x: imageSize.width -
|
818
|
-
{ x: imageSize.width -
|
819
|
-
{ x:
|
817
|
+
{ x: OFFSET, y: OFFSET },
|
818
|
+
{ x: imageSize.width - OFFSET, y: OFFSET },
|
819
|
+
{ x: imageSize.width - OFFSET, y: imageSize.height - OFFSET },
|
820
|
+
{ x: OFFSET, y: imageSize.height - OFFSET },
|
820
821
|
];
|
821
822
|
var polygon = new oo(points, {
|
822
823
|
fill: 'transparent',
|
@@ -1547,11 +1548,17 @@ var ParametersModalForm = function (_a) {
|
|
1547
1548
|
var _a;
|
1548
1549
|
return (__assign(__assign({}, acc), (_a = {}, _a[p.codename] = p.value, _a)));
|
1549
1550
|
}, {});
|
1551
|
+
// if not in modal we save at every field change
|
1552
|
+
useEffect(function () {
|
1553
|
+
if (noModal) {
|
1554
|
+
handleSubmit();
|
1555
|
+
}
|
1556
|
+
}, [fields]);
|
1550
1557
|
var handleSubmit = function () {
|
1551
1558
|
if (shapeType && name === '') {
|
1552
1559
|
setErrors({ name: strings.requiredField });
|
1553
1560
|
}
|
1554
|
-
else if (validateParametersForm(parameters, fields, setErrors, strings)) {
|
1561
|
+
else if (!noModal || validateParametersForm(parameters, fields, setErrors, strings)) {
|
1555
1562
|
var data_1 = __spreadArray([], parameters.map(function (p) { return ({ codename: p.codename, value: fields[p.codename] }); }), true);
|
1556
1563
|
if (shapeType) {
|
1557
1564
|
onSubmit(data_1, { name: name, role: role });
|
@@ -1722,7 +1729,7 @@ var TopBar = function () {
|
|
1722
1729
|
setMetadata(__assign(__assign({}, metadata), { parameters: data }));
|
1723
1730
|
setForm({ isOpen: false });
|
1724
1731
|
};
|
1725
|
-
return (jsxs(Fragment, { children: [jsxs("div", { className: css('top-bar', styles, themeMode), children: [enableMainMetadata(configuration) && !((_a = configuration.options) === null || _a === void 0 ? void 0 : _a.viewMainParameters) && (jsxs(Button, { onClick: function () { return setForm({ isOpen: true }); }, children: [jsx(AnnotateIcon, { color: iconColor }), " ", strings.mainParametersMetadata] })), jsxs(Button, { primary: true, onClick: onSubmit, children: [jsx(SaveIcon, { color: primaryFgColor }), " ", strings.save] }), form.isOpen && (jsx(ParametersModalForm, { parameters: configuration.parameters, data: metadata.parameters, title: strings.mainParametersMetadata, onClose: function () { return setForm({ isOpen: false }); }, onSubmit: handleSubmitMetadata }))] }), enableMainMetadata(configuration) && ((_b = configuration.options) === null || _b === void 0 ? void 0 : _b.viewMainParameters) && (
|
1732
|
+
return (jsxs(Fragment, { children: [jsxs("div", { className: css('top-bar', styles, themeMode), children: [enableMainMetadata(configuration) && !((_a = configuration.options) === null || _a === void 0 ? void 0 : _a.viewMainParameters) && (jsxs(Button, { onClick: function () { return setForm({ isOpen: true }); }, children: [jsx(AnnotateIcon, { color: iconColor }), " ", strings.mainParametersMetadata] })), jsxs(Button, { primary: true, onClick: onSubmit, children: [jsx(SaveIcon, { color: primaryFgColor }), " ", strings.save] }), form.isOpen && (jsx(ParametersModalForm, { parameters: configuration.parameters, data: metadata.parameters, title: strings.mainParametersMetadata, onClose: function () { return setForm({ isOpen: false }); }, onSubmit: handleSubmitMetadata }))] }), enableMainMetadata(configuration) && ((_b = configuration.options) === null || _b === void 0 ? void 0 : _b.viewMainParameters) && (jsx("div", { className: css('main-parameters-view', styles, themeMode), children: jsx(ParametersModalForm, { parameters: configuration.parameters, data: metadata.parameters, title: strings.mainParametersMetadata, onClose: function () { return setForm({ isOpen: false }); }, onSubmit: handleSubmitMetadata, noModal: true }) }))] }));
|
1726
1733
|
};
|
1727
1734
|
|
1728
1735
|
// https://github.com/n-mazaheri/image-editor
|