kritzel-stencil 0.0.110 → 0.0.112
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/kritzel-brush-style_18.cjs.entry.js +96 -115
- package/dist/cjs/kritzel-brush-style_18.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stencil.cjs.js +1 -1
- package/dist/collection/classes/handlers/context-menu.handler.js +4 -0
- package/dist/collection/classes/handlers/context-menu.handler.js.map +1 -1
- package/dist/collection/classes/handlers/key.handler.js +1 -3
- package/dist/collection/classes/handlers/key.handler.js.map +1 -1
- package/dist/collection/classes/tools/brush-tool.class.js +9 -0
- package/dist/collection/classes/tools/brush-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/selection-tool.class.js +9 -32
- package/dist/collection/classes/tools/selection-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/text-tool.class.js +6 -0
- package/dist/collection/classes/tools/text-tool.class.js.map +1 -1
- package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js +58 -57
- package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js.map +1 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +14 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js.map +1 -1
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +12 -24
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +44 -23
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js.map +1 -1
- package/dist/components/kritzel-controls.js +1 -1
- package/dist/components/kritzel-cursor-trail.js +1 -1
- package/dist/components/kritzel-editor.js +13 -6
- package/dist/components/kritzel-editor.js.map +1 -1
- package/dist/components/kritzel-engine.js +1 -1
- package/dist/components/{p-mD9nNnTx.js → p--2WHhuBI.js} +31 -61
- package/dist/components/p--2WHhuBI.js.map +1 -0
- package/dist/components/{p-Ch6TgHX3.js → p-BnsTGnvc.js} +28 -27
- package/dist/components/p-BnsTGnvc.js.map +1 -0
- package/dist/components/{p-Ds3FhuuO.js → p-BvPTbq7F.js} +29 -37
- package/dist/components/p-BvPTbq7F.js.map +1 -0
- package/dist/components/p-D8W6LE-c.js +11 -0
- package/dist/components/p-D8W6LE-c.js.map +1 -0
- package/dist/components/{p-7Ns73-wN.js → p-DqZOaMbq.js} +19 -9
- package/dist/components/p-DqZOaMbq.js.map +1 -0
- package/dist/esm/kritzel-brush-style_18.entry.js +96 -115
- package/dist/esm/kritzel-brush-style_18.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/stencil.js +1 -1
- package/dist/stencil/p-65e86254.entry.js +2 -0
- package/dist/stencil/p-65e86254.entry.js.map +1 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/classes/tools/selection-tool.class.d.ts +0 -2
- package/dist/types/components/core/kritzel-cursor-trail/kritzel-cursor-trail.d.ts +5 -6
- package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +1 -0
- package/dist/types/components/ui/kritzel-controls/kritzel-controls.d.ts +6 -6
- package/dist/types/components.d.ts +5 -0
- package/package.json +1 -1
- package/dist/components/p-7Ns73-wN.js.map +0 -1
- package/dist/components/p-Ch6TgHX3.js.map +0 -1
- package/dist/components/p-Ds3FhuuO.js.map +0 -1
- package/dist/components/p-mD9nNnTx.js.map +0 -1
- package/dist/stencil/p-d23bb1ad.entry.js +0 -2
- package/dist/stencil/p-d23bb1ad.entry.js.map +0 -1
|
@@ -717,6 +717,9 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
717
717
|
};
|
|
718
718
|
}
|
|
719
719
|
handlePointerDown(event) {
|
|
720
|
+
if (event.cancelable) {
|
|
721
|
+
event.preventDefault();
|
|
722
|
+
}
|
|
720
723
|
if (event.pointerType === 'mouse') {
|
|
721
724
|
if (KritzelEventHelper.isLeftClick(event)) {
|
|
722
725
|
this._store.state.isDrawing = true;
|
|
@@ -751,6 +754,9 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
751
754
|
}
|
|
752
755
|
}
|
|
753
756
|
handlePointerMove(event) {
|
|
757
|
+
if (event.cancelable) {
|
|
758
|
+
event.preventDefault();
|
|
759
|
+
}
|
|
754
760
|
if (event.pointerType === 'mouse') {
|
|
755
761
|
if (this._store.state.isDrawing) {
|
|
756
762
|
const x = event.clientX - this._store.offsetX;
|
|
@@ -784,6 +790,9 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
784
790
|
}
|
|
785
791
|
}
|
|
786
792
|
handlePointerUp(event) {
|
|
793
|
+
if (event.cancelable) {
|
|
794
|
+
event.preventDefault();
|
|
795
|
+
}
|
|
787
796
|
if (event.pointerType === 'mouse') {
|
|
788
797
|
if (this._store.state.isDrawing) {
|
|
789
798
|
this._store.state.isDrawing = false;
|
|
@@ -1019,6 +1028,9 @@ class KritzelTextTool extends KritzelBaseTool {
|
|
|
1019
1028
|
];
|
|
1020
1029
|
}
|
|
1021
1030
|
handlePointerDown(event) {
|
|
1031
|
+
if (event.cancelable) {
|
|
1032
|
+
event.preventDefault();
|
|
1033
|
+
}
|
|
1022
1034
|
if (event.pointerType === 'mouse') {
|
|
1023
1035
|
const path = event.composedPath().slice(1);
|
|
1024
1036
|
const objectElement = path.find(element => element.classList && element.classList.contains('object'));
|
|
@@ -1086,6 +1098,9 @@ class KritzelTextTool extends KritzelBaseTool {
|
|
|
1086
1098
|
}
|
|
1087
1099
|
handlePointerUp(event) {
|
|
1088
1100
|
var _a, _b, _c, _d;
|
|
1101
|
+
if (event.cancelable) {
|
|
1102
|
+
event.preventDefault();
|
|
1103
|
+
}
|
|
1089
1104
|
if (event.pointerType === 'mouse') {
|
|
1090
1105
|
(_a = this._store.state.activeText) === null || _a === void 0 ? void 0 : _a.adjustTextareaSize();
|
|
1091
1106
|
(_b = this._store.state.activeText) === null || _b === void 0 ? void 0 : _b.focus();
|
|
@@ -1117,6 +1132,25 @@ const KritzelControls = class {
|
|
|
1117
1132
|
this.isTouchDevice = KritzelDevicesHelper.isTouchDevice();
|
|
1118
1133
|
this.kritzelEngine = null;
|
|
1119
1134
|
}
|
|
1135
|
+
async handleActiveToolChange(event) {
|
|
1136
|
+
var _a;
|
|
1137
|
+
this.activeControl = this.controls.find(control => control.tool === event.detail) || null;
|
|
1138
|
+
await ((_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.setFocus());
|
|
1139
|
+
}
|
|
1140
|
+
handleClick(event) {
|
|
1141
|
+
const element = event.target;
|
|
1142
|
+
if (!this.kritzelEngine || element.closest('.kritzel-tooltip')) {
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
this.tooltipVisible = false;
|
|
1146
|
+
this.kritzelEngine.enable();
|
|
1147
|
+
}
|
|
1148
|
+
async closeTooltip() {
|
|
1149
|
+
var _a, _b;
|
|
1150
|
+
this.tooltipVisible = false;
|
|
1151
|
+
(_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.enable();
|
|
1152
|
+
(_b = this.kritzelEngine) === null || _b === void 0 ? void 0 : _b.setFocus();
|
|
1153
|
+
}
|
|
1120
1154
|
get activeToolAsTextTool() {
|
|
1121
1155
|
var _a;
|
|
1122
1156
|
return (_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.tool;
|
|
@@ -1158,25 +1192,6 @@ const KritzelControls = class {
|
|
|
1158
1192
|
}
|
|
1159
1193
|
}
|
|
1160
1194
|
}
|
|
1161
|
-
async handleActiveToolChange(event) {
|
|
1162
|
-
var _a;
|
|
1163
|
-
this.activeControl = this.controls.find(control => control.tool === event.detail) || null;
|
|
1164
|
-
await ((_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.setFocus());
|
|
1165
|
-
}
|
|
1166
|
-
handleClick(event) {
|
|
1167
|
-
const element = event.target;
|
|
1168
|
-
if (!this.kritzelEngine || element.closest('.kritzel-tooltip')) {
|
|
1169
|
-
return;
|
|
1170
|
-
}
|
|
1171
|
-
this.tooltipVisible = false;
|
|
1172
|
-
this.kritzelEngine.enable();
|
|
1173
|
-
}
|
|
1174
|
-
preventDefault(event) {
|
|
1175
|
-
if (event.cancelable) {
|
|
1176
|
-
event.preventDefault();
|
|
1177
|
-
event.stopPropagation();
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
1195
|
async handleControlClick(control) {
|
|
1181
1196
|
this.activeControl = control;
|
|
1182
1197
|
if (this.activeControl.type === 'tool') {
|
|
@@ -1195,18 +1210,18 @@ const KritzelControls = class {
|
|
|
1195
1210
|
render() {
|
|
1196
1211
|
var _a, _b;
|
|
1197
1212
|
const hasNoConfig = ((_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.config) === undefined || ((_b = this.activeControl) === null || _b === void 0 ? void 0 : _b.config) === null;
|
|
1198
|
-
return (index.h(index.Host, { key: '
|
|
1213
|
+
return (index.h(index.Host, { key: 'b0ed601253a0f6187e601afd2fb56bdbc7d5a9cd', class: {
|
|
1199
1214
|
mobile: this.isTouchDevice,
|
|
1200
|
-
} }, index.h("kritzel-utility-panel", { key: '
|
|
1215
|
+
} }, index.h("kritzel-utility-panel", { key: 'a8621ccdc3186a3f6ac6d9b5aa9ee6d92401e5d9', style: {
|
|
1201
1216
|
position: 'absolute',
|
|
1202
1217
|
bottom: '56px',
|
|
1203
1218
|
left: '12px',
|
|
1204
|
-
}, onUndo: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.undo(); }, onRedo: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.redo(); }, onDelete: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.delete(); } }), index.h("div", { key: '
|
|
1219
|
+
}, onUndo: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.undo(); }, onRedo: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.redo(); }, onDelete: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.delete(); } }), index.h("div", { key: 'ade9f5ee7b854eac1d4497c4f3e5e3cd6a2f1f7f', class: "kritzel-controls" }, this.controls.map(control => {
|
|
1205
1220
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1206
1221
|
if (control.type === 'tool') {
|
|
1207
1222
|
return (index.h("button", { class: {
|
|
1208
1223
|
'kritzel-control': true,
|
|
1209
|
-
selected: ((_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.name) === (control === null || control === void 0 ? void 0 : control.name),
|
|
1224
|
+
'selected': ((_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.name) === (control === null || control === void 0 ? void 0 : control.name),
|
|
1210
1225
|
}, key: control.name, onClick: _event => { var _a; return (_a = this.handleControlClick) === null || _a === void 0 ? void 0 : _a.call(this, control); } }, index.h("kritzel-icon", { name: control.icon })));
|
|
1211
1226
|
}
|
|
1212
1227
|
if (control.type === 'divider') {
|
|
@@ -1253,12 +1268,20 @@ const KritzelCursorTrail = class {
|
|
|
1253
1268
|
}
|
|
1254
1269
|
}
|
|
1255
1270
|
handleMouseDown(ev) {
|
|
1256
|
-
if (ev.
|
|
1257
|
-
|
|
1258
|
-
|
|
1271
|
+
if (ev.pointerType === 'mouse') {
|
|
1272
|
+
if (ev.button === KritzelMouseButton.Left) {
|
|
1273
|
+
this.isLeftButtonDown = true;
|
|
1274
|
+
this.cursorTrailPoints = [];
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
if (ev.pointerType === 'touch') {
|
|
1278
|
+
if (this.store.state.pointers.size === 1) {
|
|
1279
|
+
this.isLeftButtonDown = true;
|
|
1280
|
+
this.cursorTrailPoints = [];
|
|
1281
|
+
}
|
|
1259
1282
|
}
|
|
1260
1283
|
}
|
|
1261
|
-
|
|
1284
|
+
handlePointerMove(ev) {
|
|
1262
1285
|
if (!this.isLeftButtonDown) {
|
|
1263
1286
|
return;
|
|
1264
1287
|
}
|
|
@@ -1271,40 +1294,22 @@ const KritzelCursorTrail = class {
|
|
|
1271
1294
|
this.cursorTrailPoints = updatedTrail;
|
|
1272
1295
|
}
|
|
1273
1296
|
}
|
|
1274
|
-
|
|
1275
|
-
if (ev.
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
handleTouchStart(ev) {
|
|
1281
|
-
if (ev.touches.length === 1) {
|
|
1282
|
-
this.isLeftButtonDown = true;
|
|
1283
|
-
this.cursorTrailPoints = [];
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
handleTouchMove(ev) {
|
|
1287
|
-
if (!this.isLeftButtonDown) {
|
|
1288
|
-
return;
|
|
1289
|
-
}
|
|
1290
|
-
const touch = ev.touches[0];
|
|
1291
|
-
const newPoint = { x: touch.clientX, y: touch.clientY, timestamp: Date.now() };
|
|
1292
|
-
const updatedTrail = [newPoint, ...this.cursorTrailPoints];
|
|
1293
|
-
if (updatedTrail.length > this.MAX_TRAIL_POINTS) {
|
|
1294
|
-
this.cursorTrailPoints = updatedTrail.slice(0, this.MAX_TRAIL_POINTS);
|
|
1295
|
-
}
|
|
1296
|
-
else {
|
|
1297
|
-
this.cursorTrailPoints = updatedTrail;
|
|
1297
|
+
handlePointerUp(ev) {
|
|
1298
|
+
if (ev.pointerType === 'mouse') {
|
|
1299
|
+
if (ev.button === KritzelMouseButton.Left) {
|
|
1300
|
+
this.isLeftButtonDown = false;
|
|
1301
|
+
this.cursorTrailPoints = [];
|
|
1302
|
+
}
|
|
1298
1303
|
}
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
+
if (ev.pointerType === 'touch') {
|
|
1305
|
+
if (this.store.state.pointers.size === 0) {
|
|
1306
|
+
this.isLeftButtonDown = false;
|
|
1307
|
+
this.cursorTrailPoints = [];
|
|
1308
|
+
}
|
|
1304
1309
|
}
|
|
1305
1310
|
}
|
|
1306
1311
|
render() {
|
|
1307
|
-
return (index.h(index.Host, { key: '
|
|
1312
|
+
return (index.h(index.Host, { key: '2e6ee739a4c25cee00470ee95ca22e55712c8d7b' }, this.cursorTrailPoints.length > 1 && (index.h("svg", { key: '483aa687ccd290980ca9c588a84547df2bfdb659', class: "cursor-trail-svg", xmlns: "http://www.w3.org/2000/svg", style: {
|
|
1308
1313
|
position: 'absolute',
|
|
1309
1314
|
left: '0',
|
|
1310
1315
|
top: '0',
|
|
@@ -2314,6 +2319,9 @@ class KritzelSelectionTool extends KritzelBaseTool {
|
|
|
2314
2319
|
this.rotationHandler = new KritzelRotationHandler(this._store);
|
|
2315
2320
|
}
|
|
2316
2321
|
handlePointerDown(event) {
|
|
2322
|
+
if (event.cancelable) {
|
|
2323
|
+
event.preventDefault();
|
|
2324
|
+
}
|
|
2317
2325
|
if (event.pointerType === 'mouse') {
|
|
2318
2326
|
if (KritzelEventHelper.isLeftClick(event)) {
|
|
2319
2327
|
this._store.state.isResizeHandleSelected = this.isHandleSelected(event);
|
|
@@ -2375,6 +2383,9 @@ class KritzelSelectionTool extends KritzelBaseTool {
|
|
|
2375
2383
|
}
|
|
2376
2384
|
}
|
|
2377
2385
|
handlePointerMove(event) {
|
|
2386
|
+
if (event.cancelable) {
|
|
2387
|
+
event.preventDefault();
|
|
2388
|
+
}
|
|
2378
2389
|
if (event.pointerType === 'mouse') {
|
|
2379
2390
|
this.moveHandler.handlePointerMove(event);
|
|
2380
2391
|
this.selectionHandler.handlePointerMove(event);
|
|
@@ -2394,6 +2405,9 @@ class KritzelSelectionTool extends KritzelBaseTool {
|
|
|
2394
2405
|
}
|
|
2395
2406
|
}
|
|
2396
2407
|
handlePointerUp(event) {
|
|
2408
|
+
if (event.cancelable) {
|
|
2409
|
+
event.preventDefault();
|
|
2410
|
+
}
|
|
2397
2411
|
if (event.pointerType === 'mouse') {
|
|
2398
2412
|
this.moveHandler.handlePointerUp(event);
|
|
2399
2413
|
this.selectionHandler.handlePointerUp(event);
|
|
@@ -2411,36 +2425,6 @@ class KritzelSelectionTool extends KritzelBaseTool {
|
|
|
2411
2425
|
this.selectionHandler.handlePointerUp(event);
|
|
2412
2426
|
}
|
|
2413
2427
|
}
|
|
2414
|
-
handleDoubleClick(event) {
|
|
2415
|
-
var _a;
|
|
2416
|
-
if (KritzelEventHelper.isLeftClick(event)) {
|
|
2417
|
-
if (this._store.state.selectionGroup && ((_a = this._store.state.selectionGroup) === null || _a === void 0 ? void 0 : _a.objects.length) === 1) {
|
|
2418
|
-
const selectedObject = this._store.state.selectionGroup.objects[0];
|
|
2419
|
-
if (selectedObject instanceof KritzelText) {
|
|
2420
|
-
this._store.history.executeCommand(new RemoveSelectionGroupCommand(this._store, this._store.state.selectionGroup));
|
|
2421
|
-
this._store.setState('activeTool', KritzelToolRegistry.getTool('text'));
|
|
2422
|
-
this._store.state.activeText = selectedObject;
|
|
2423
|
-
setTimeout(() => {
|
|
2424
|
-
selectedObject.focus();
|
|
2425
|
-
}, 300);
|
|
2426
|
-
}
|
|
2427
|
-
}
|
|
2428
|
-
}
|
|
2429
|
-
}
|
|
2430
|
-
handleDoubleTap(event) {
|
|
2431
|
-
const selectionGroup = this.getSelectedObject(event);
|
|
2432
|
-
if (!selectionGroup || selectionGroup.objects.length !== 1) {
|
|
2433
|
-
return;
|
|
2434
|
-
}
|
|
2435
|
-
const selectedObject = selectionGroup.objects[0];
|
|
2436
|
-
if (selectedObject instanceof KritzelText) {
|
|
2437
|
-
this._store.setState('activeTool', KritzelToolRegistry.getTool('text'));
|
|
2438
|
-
this._store.state.activeText = selectedObject;
|
|
2439
|
-
setTimeout(() => {
|
|
2440
|
-
selectedObject.focus();
|
|
2441
|
-
}, 300);
|
|
2442
|
-
}
|
|
2443
|
-
}
|
|
2444
2428
|
getSelectedObject(event) {
|
|
2445
2429
|
const path = event.composedPath().slice(1);
|
|
2446
2430
|
const objectElement = path.find(element => element.classList && element.classList.contains('object'));
|
|
@@ -2948,6 +2932,13 @@ const KritzelEditor = class {
|
|
|
2948
2932
|
event.preventDefault();
|
|
2949
2933
|
}
|
|
2950
2934
|
}
|
|
2935
|
+
handleKeyDown(ev) {
|
|
2936
|
+
var _a;
|
|
2937
|
+
ev.preventDefault();
|
|
2938
|
+
if (ev.key === 'Escape') {
|
|
2939
|
+
(_a = this.controlsRef) === null || _a === void 0 ? void 0 : _a.closeTooltip();
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2951
2942
|
componentWillLoad() {
|
|
2952
2943
|
this.registerCustomSvgIcons();
|
|
2953
2944
|
}
|
|
@@ -2957,7 +2948,7 @@ const KritzelEditor = class {
|
|
|
2957
2948
|
}
|
|
2958
2949
|
}
|
|
2959
2950
|
render() {
|
|
2960
|
-
return (index.h(index.Host, { key: '
|
|
2951
|
+
return (index.h(index.Host, { key: 'b861ac259f78cf3a4a7070ce2e54a731414a8c08' }, index.h("kritzel-engine", { key: '026f2caba18bce0b0453b904616d9baa455592d9', ref: el => (this.engineRef = el) }), index.h("kritzel-controls", { key: 'afc78be61bfddeafd3650f7a383ad4a1847fa3b5', ref: el => (this.controlsRef = el), controls: this.controls, style: this.hideControls ? { display: 'none' } : { display: 'flex' } })));
|
|
2961
2952
|
}
|
|
2962
2953
|
get host() { return index.getElement(this); }
|
|
2963
2954
|
};
|
|
@@ -3677,10 +3668,8 @@ class KritzelKeyHandler extends KritzelBaseHandler {
|
|
|
3677
3668
|
if (this._store.state.isFocused === false) {
|
|
3678
3669
|
return;
|
|
3679
3670
|
}
|
|
3671
|
+
event.preventDefault();
|
|
3680
3672
|
this._store.state.isCtrlKeyPressed = event.ctrlKey;
|
|
3681
|
-
if (this._store.state.isCtrlKeyPressed) {
|
|
3682
|
-
event.preventDefault();
|
|
3683
|
-
}
|
|
3684
3673
|
if (event.key === 'Escape' && this._store.state.selectionGroup) {
|
|
3685
3674
|
this._store.clearSelection();
|
|
3686
3675
|
}
|
|
@@ -3756,6 +3745,10 @@ class KritzelContextMenuHandler extends KritzelBaseHandler {
|
|
|
3756
3745
|
this.objectContextMenuItems = objectContextMenuItems;
|
|
3757
3746
|
}
|
|
3758
3747
|
handleContextMenu(event) {
|
|
3748
|
+
if (this._store.state.skipContextMenu) {
|
|
3749
|
+
this._store.state.skipContextMenu = false;
|
|
3750
|
+
return;
|
|
3751
|
+
}
|
|
3759
3752
|
const selectedObject = this._store.getObjectFromPointerEvent(event, '.object');
|
|
3760
3753
|
if (selectedObject && !(selectedObject instanceof KritzelSelectionGroup)) {
|
|
3761
3754
|
this._store.state.selectionGroup = KritzelSelectionGroup.create(this._store);
|
|
@@ -3869,9 +3862,6 @@ const KritzelEngine = class {
|
|
|
3869
3862
|
if (this.store.state.isEnabled === false) {
|
|
3870
3863
|
return;
|
|
3871
3864
|
}
|
|
3872
|
-
if (ev.cancelable) {
|
|
3873
|
-
ev.preventDefault();
|
|
3874
|
-
}
|
|
3875
3865
|
KritzelEventHelper.onLongTouchPress(ev, (event) => {
|
|
3876
3866
|
if (!(this.store.state.activeTool instanceof KritzelSelectionTool)) {
|
|
3877
3867
|
return;
|
|
@@ -3888,9 +3878,6 @@ const KritzelEngine = class {
|
|
|
3888
3878
|
if (this.store.state.isEnabled === false) {
|
|
3889
3879
|
return;
|
|
3890
3880
|
}
|
|
3891
|
-
if (ev.cancelable) {
|
|
3892
|
-
ev.preventDefault();
|
|
3893
|
-
}
|
|
3894
3881
|
this.store.state.pointers.set(ev.pointerId, ev);
|
|
3895
3882
|
this.viewport.handlePointerMove(ev);
|
|
3896
3883
|
(_b = (_a = this.store.state) === null || _a === void 0 ? void 0 : _a.activeTool) === null || _b === void 0 ? void 0 : _b.handlePointerMove(ev);
|
|
@@ -3900,9 +3887,6 @@ const KritzelEngine = class {
|
|
|
3900
3887
|
if (this.store.state.isEnabled === false) {
|
|
3901
3888
|
return;
|
|
3902
3889
|
}
|
|
3903
|
-
if (ev.cancelable) {
|
|
3904
|
-
ev.preventDefault();
|
|
3905
|
-
}
|
|
3906
3890
|
this.store.state.pointers.delete(ev.pointerId);
|
|
3907
3891
|
this.host.releasePointerCapture(ev.pointerId);
|
|
3908
3892
|
this.viewport.handlePointerUp(ev);
|
|
@@ -3913,9 +3897,6 @@ const KritzelEngine = class {
|
|
|
3913
3897
|
if (this.store.state.isEnabled === false) {
|
|
3914
3898
|
return;
|
|
3915
3899
|
}
|
|
3916
|
-
if (ev.cancelable) {
|
|
3917
|
-
ev.preventDefault();
|
|
3918
|
-
}
|
|
3919
3900
|
this.host.releasePointerCapture(ev.pointerId);
|
|
3920
3901
|
this.store.state.pointers.delete(ev.pointerId);
|
|
3921
3902
|
this.viewport.handlePointerUp(ev);
|
|
@@ -4059,15 +4040,15 @@ const KritzelEngine = class {
|
|
|
4059
4040
|
const baseHandleSizePx = computedStyle.getPropertyValue('--kritzel-selection-handle-size').trim() || '6px';
|
|
4060
4041
|
const baseHandleSize = parseFloat(baseHandleSizePx);
|
|
4061
4042
|
const baseHandleTouchSize = baseHandleSize * 2 < 14 ? 14 : baseHandleSize;
|
|
4062
|
-
return (index.h(index.Host, { key: '
|
|
4063
|
-
_a.translateX), index.h("div", { key: '
|
|
4064
|
-
_b.translateY), index.h("div", { key: '
|
|
4065
|
-
_c.viewportWidth), index.h("div", { key: '
|
|
4066
|
-
_d.viewportHeight), index.h("div", { key: '
|
|
4067
|
-
_e.scale), index.h("div", { key: '
|
|
4068
|
-
_g.name), index.h("div", { key: '
|
|
4069
|
-
_m.cursorX), index.h("div", { key: '
|
|
4070
|
-
_o.cursorY)), index.h("div", { key: '
|
|
4043
|
+
return (index.h(index.Host, { key: '632d8633bd27520dedda2e6eb84862d280fa6714' }, index.h("div", { key: 'fda3cdc033d97e1f17ae8fcede94933ae73458b3', class: "debug-panel", style: { display: this.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, index.h("div", { key: '823aac3e9b58615e7c499163bd9101675a62ff70' }, "TranslateX: ", (_a = this.store.state) === null || _a === void 0 ? void 0 :
|
|
4044
|
+
_a.translateX), index.h("div", { key: '5d138212f0fefcaea7dc839f6d5f3e9c68c19681' }, "TranslateY: ", (_b = this.store.state) === null || _b === void 0 ? void 0 :
|
|
4045
|
+
_b.translateY), index.h("div", { key: '8342eabd22ba71b58fe8346a182904cf5f4ccbb9' }, "ViewportWidth: ", (_c = this.store.state) === null || _c === void 0 ? void 0 :
|
|
4046
|
+
_c.viewportWidth), index.h("div", { key: '325546fc07c2cfec7808e661d82f21db06d53aea' }, "ViewportHeight: ", (_d = this.store.state) === null || _d === void 0 ? void 0 :
|
|
4047
|
+
_d.viewportHeight), index.h("div", { key: '2b1826604f561c58ad573d5545a0913498345b1f' }, "ObjectsInViewport. ", this.store.objects.length), index.h("div", { key: '749b56a6bfd63c838c89c55595bedd6749ee89ad' }, "Scale: ", (_e = this.store.state) === null || _e === void 0 ? void 0 :
|
|
4048
|
+
_e.scale), index.h("div", { key: '0ee63c810198cb583c4e419f14503f5fb8d71d32' }, "ActiveTool: ", (_g = (_f = this.store.state) === null || _f === void 0 ? void 0 : _f.activeTool) === null || _g === void 0 ? void 0 :
|
|
4049
|
+
_g.name), index.h("div", { key: '5facf47db6f093db24b12fa4b4453d20af1b1f57' }, "HasViewportChanged: ", ((_h = this.store.state) === null || _h === void 0 ? void 0 : _h.hasViewportChanged) ? 'true' : 'false'), index.h("div", { key: '948069683ac1568257dab4dbd5d1b3e9926ac501' }, "IsEnabled: ", ((_j = this.store.state) === null || _j === void 0 ? void 0 : _j.isEnabled) ? 'true' : 'false'), index.h("div", { key: 'a3e5bf4522b9d515bc7d346dbc9803af12eb60f5' }, "IsScaling: ", ((_k = this.store.state) === null || _k === void 0 ? void 0 : _k.isScaling) ? 'true' : 'false'), index.h("div", { key: 'ce8fc21cd938e7a58fef489b086b5111b1612353' }, "IsPanning: ", ((_l = this.store.state) === null || _l === void 0 ? void 0 : _l.isPanning) ? 'true' : 'false'), index.h("div", { key: '5725282e17bbe0766ebe010377070df81c1542d2' }, "IsFocused: ", this.store.state.isFocused ? 'true' : 'false'), index.h("div", { key: '8805bbfac86078d2a0541d60a53a3c6a9585a1db' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), index.h("div", { key: '1801d4d8297e36f4c14022c411ce5a1889042398' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), index.h("div", { key: 'd269982265e35a511eeb892969b3e47eb21b023f' }, "IsResizeHandleSelected: ", this.store.state.isResizeHandleSelected ? 'true' : 'false'), index.h("div", { key: '1362e4c3d93a8452705e5fb1a1ba6a0ffdb3c557' }, "IsRotationHandleSelected: ", this.store.state.isRotationHandleSelected ? 'true' : 'false'), index.h("div", { key: '2181e07738e56e10c57c4d6a06acdd667a14da83' }, "IsDrawing: ", this.store.state.isDrawing ? 'true' : 'false'), index.h("div", { key: '57b96821b4fb1cbc97ec7083fc523c0bdba7539b' }, "IsWriting: ", this.store.state.isWriting ? 'true' : 'false'), index.h("div", { key: 'c7302e6ce4635e04aa92a24878dd3cbce8724228' }, "CursorX: ", (_m = this.store.state) === null || _m === void 0 ? void 0 :
|
|
4050
|
+
_m.cursorX), index.h("div", { key: '93b01e5d147ca445e6645749043bb7fb46852f39' }, "CursorY: ", (_o = this.store.state) === null || _o === void 0 ? void 0 :
|
|
4051
|
+
_o.cursorY)), index.h("div", { key: '7b535830bbd75ca61e09d6984120e17168911d7d', class: "origin", style: {
|
|
4071
4052
|
transform: `matrix(${(_p = this.store.state) === null || _p === void 0 ? void 0 : _p.scale}, 0, 0, ${(_q = this.store.state) === null || _q === void 0 ? void 0 : _q.scale}, ${(_r = this.store.state) === null || _r === void 0 ? void 0 : _r.translateX}, ${(_s = this.store.state) === null || _s === void 0 ? void 0 : _s.translateY})`,
|
|
4072
4053
|
} }, (_t = this.store.objects) === null || _t === void 0 ? void 0 :
|
|
4073
4054
|
_t.map(object => {
|
|
@@ -4164,7 +4145,7 @@ const KritzelEngine = class {
|
|
|
4164
4145
|
fill: 'transparent',
|
|
4165
4146
|
cursor: 'grab',
|
|
4166
4147
|
}, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("g", { style: { display: this.store.state.debugInfo.showObjectInfo ? 'block' : 'none', pointerEvents: 'none' } }, index.h("foreignObject", { x: object.totalWidth.toString(), y: "0", width: "400px", height: "160px", style: { minHeight: '0', minWidth: '0', display: object.debugInfoVisible ? 'block' : 'none' } }, index.h("div", { style: { width: '100%', height: '100%' } }, index.h("div", { style: { whiteSpace: 'nowrap' } }, "zIndex: ", object.zIndex), index.h("div", { style: { whiteSpace: 'nowrap' } }, "translateX: ", object.translateX), index.h("div", { style: { whiteSpace: 'nowrap' } }, "translateY: ", object.translateY), index.h("div", { style: { whiteSpace: 'nowrap' } }, "width: ", object.width), index.h("div", { style: { whiteSpace: 'nowrap' } }, "height: ", object.height), index.h("div", { style: { whiteSpace: 'nowrap' } }, "scale: ", object.scale), index.h("div", { style: { whiteSpace: 'nowrap' } }, "rotation: ", object.rotation)))))));
|
|
4167
|
-
}), index.h("svg", { key: '
|
|
4148
|
+
}), index.h("svg", { key: 'cce82d436a044879bfbb900a836978c392f232ae', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
|
|
4168
4149
|
height: (_u = this.store.state.currentPath) === null || _u === void 0 ? void 0 : _u.height.toString(),
|
|
4169
4150
|
width: (_v = this.store.state.currentPath) === null || _v === void 0 ? void 0 : _v.width.toString(),
|
|
4170
4151
|
left: '0',
|
|
@@ -4174,12 +4155,12 @@ const KritzelEngine = class {
|
|
|
4174
4155
|
transform: (_x = this.store.state.currentPath) === null || _x === void 0 ? void 0 : _x.transformationMatrix,
|
|
4175
4156
|
transformOrigin: 'top left',
|
|
4176
4157
|
overflow: 'visible',
|
|
4177
|
-
}, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, index.h("path", { key: '
|
|
4158
|
+
}, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, index.h("path", { key: '1c0366598a805faffc965824c30c05fe1f1e0f74', d: (_z = this.store.state.currentPath) === null || _z === void 0 ? void 0 : _z.d, fill: (_0 = this.store.state.currentPath) === null || _0 === void 0 ? void 0 : _0.fill, stroke: (_1 = this.store.state.currentPath) === null || _1 === void 0 ? void 0 : _1.stroke }))), this.store.state.isContextMenuVisible && (index.h("kritzel-context-menu", { key: '624855529efbe7a5de784e3e1ce2b82282fac63a', class: "context-menu", ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, style: {
|
|
4178
4159
|
position: 'fixed',
|
|
4179
4160
|
left: `${this.store.state.contextMenuX}px`,
|
|
4180
4161
|
top: `${this.store.state.contextMenuY}px`,
|
|
4181
4162
|
zIndex: '10000',
|
|
4182
|
-
}, onActionSelected: event => this.handleContextMenuAction(event) })), ((_2 = this.store.state) === null || _2 === void 0 ? void 0 : _2.activeTool) instanceof KritzelEraserTool && !this.store.state.isScaling && index.h("kritzel-cursor-trail", { key: '
|
|
4163
|
+
}, onActionSelected: event => this.handleContextMenuAction(event) })), ((_2 = this.store.state) === null || _2 === void 0 ? void 0 : _2.activeTool) instanceof KritzelEraserTool && !this.store.state.isScaling && index.h("kritzel-cursor-trail", { key: 'd09a4701c43b8acec4e9daa09b69f545eebe95b7', store: this.store })));
|
|
4183
4164
|
}
|
|
4184
4165
|
get host() { return index.getElement(this); }
|
|
4185
4166
|
};
|