kritzel-stencil 0.1.17 → 0.1.18
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/{default-line-tool.config-D-Ru2SSK.js → default-line-tool.config-B0ttzt48.js} +107 -29
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/kritzel-back-to-content_32.cjs.entry.js +11 -12
- package/dist/collection/classes/core/viewport.class.js +3 -3
- package/dist/collection/classes/handlers/hover.handler.js +1 -1
- package/dist/collection/classes/handlers/line-handle.handler.js +1 -1
- package/dist/collection/classes/handlers/move.handler.js +3 -3
- package/dist/collection/classes/handlers/resize.handler.js +3 -3
- package/dist/collection/classes/handlers/rotation.handler.js +3 -3
- package/dist/collection/classes/handlers/selection.handler.js +3 -3
- package/dist/collection/classes/objects/shape.class.js +21 -2
- package/dist/collection/classes/tools/brush-tool.class.js +3 -3
- package/dist/collection/classes/tools/eraser-tool.class.js +3 -3
- package/dist/collection/classes/tools/line-tool.class.js +3 -3
- package/dist/collection/classes/tools/selection-tool.class.js +7 -4
- package/dist/collection/classes/tools/shape-tool.class.js +2 -3
- package/dist/collection/classes/tools/text-tool.class.js +1 -1
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +4 -4
- package/dist/collection/constants/version.js +1 -1
- package/dist/collection/helpers/color.helper.js +57 -0
- package/dist/components/index.js +1 -1
- package/dist/components/kritzel-color-palette.js +1 -1
- package/dist/components/kritzel-color.js +1 -1
- package/dist/components/kritzel-controls.js +1 -1
- package/dist/components/kritzel-editor.js +1 -1
- package/dist/components/kritzel-engine.js +1 -1
- package/dist/components/kritzel-settings.js +1 -1
- package/dist/components/kritzel-stroke-size.js +1 -1
- package/dist/components/kritzel-tool-config.js +1 -1
- package/dist/components/{p-Cy7mncoG.js → p-BfXV11DK.js} +1 -1
- package/dist/components/{p-CmqXj79q.js → p-Bjov3xoU.js} +1 -1
- package/dist/components/{p-BDFu1vsS.js → p-Cjszz2ZB.js} +1 -1
- package/dist/components/{p--Bo4GaCK.js → p-CrBCoQ4k.js} +1 -1
- package/dist/components/{p-DZpC1x_I.js → p-D7LDPD8P.js} +1 -1
- package/dist/components/p-DwNY8gu2.js +9 -0
- package/dist/components/{p-DPR5Yq3I.js → p-pwhhRlnb.js} +1 -1
- package/dist/components/{p-MlG9hN-3.js → p-uGAPHka3.js} +1 -1
- package/dist/components/{p-B8IOGWhN.js → p-zAshHrlP.js} +1 -1
- package/dist/esm/{default-line-tool.config-CYM64Io0.js → default-line-tool.config-NudxH3Bi.js} +107 -29
- package/dist/esm/index.js +2 -2
- package/dist/esm/kritzel-back-to-content_32.entry.js +11 -12
- package/dist/stencil/index.esm.js +1 -1
- package/dist/stencil/p-405b33e0.entry.js +9 -0
- package/dist/stencil/p-NudxH3Bi.js +1 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/classes/objects/shape.class.d.ts +5 -0
- package/dist/types/constants/version.d.ts +1 -1
- package/dist/types/helpers/color.helper.d.ts +14 -0
- package/package.json +1 -1
- package/dist/components/p-DrwG_00J.js +0 -9
- package/dist/stencil/p-CYM64Io0.js +0 -1
- package/dist/stencil/p-e3cf8ef3.entry.js +0 -9
package/dist/cjs/{default-line-tool.config-D-Ru2SSK.js → default-line-tool.config-B0ttzt48.js}
RENAMED
|
@@ -14748,6 +14748,63 @@ class KritzelColorHelper {
|
|
|
14748
14748
|
}
|
|
14749
14749
|
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
14750
14750
|
}
|
|
14751
|
+
/**
|
|
14752
|
+
* Determines the appropriate contrast color (black or white) based on the luminance of the given hex color.
|
|
14753
|
+
* Uses the relative luminance formula: 0.299*R + 0.587*G + 0.114*B
|
|
14754
|
+
* @param hexColor - The hex color string (with or without #)
|
|
14755
|
+
* @returns '#000000' for light backgrounds, '#ffffff' for dark backgrounds
|
|
14756
|
+
*/
|
|
14757
|
+
static getContrastColor(hexColor) {
|
|
14758
|
+
const sanitizedHex = hexColor.startsWith('#') ? hexColor.slice(1) : hexColor;
|
|
14759
|
+
let r, g, b;
|
|
14760
|
+
if (sanitizedHex.length === 3) {
|
|
14761
|
+
r = parseInt(sanitizedHex[0] + sanitizedHex[0], 16);
|
|
14762
|
+
g = parseInt(sanitizedHex[1] + sanitizedHex[1], 16);
|
|
14763
|
+
b = parseInt(sanitizedHex[2] + sanitizedHex[2], 16);
|
|
14764
|
+
}
|
|
14765
|
+
else if (sanitizedHex.length === 6) {
|
|
14766
|
+
r = parseInt(sanitizedHex.substring(0, 2), 16);
|
|
14767
|
+
g = parseInt(sanitizedHex.substring(2, 4), 16);
|
|
14768
|
+
b = parseInt(sanitizedHex.substring(4, 6), 16);
|
|
14769
|
+
}
|
|
14770
|
+
else {
|
|
14771
|
+
// Default to black for invalid colors
|
|
14772
|
+
return '#000000';
|
|
14773
|
+
}
|
|
14774
|
+
if (isNaN(r) || isNaN(g) || isNaN(b)) {
|
|
14775
|
+
return '#000000';
|
|
14776
|
+
}
|
|
14777
|
+
// Calculate relative luminance
|
|
14778
|
+
const luminance = 0.299 * r + 0.587 * g + 0.114 * b;
|
|
14779
|
+
// Use threshold of 150 (midpoint) for balanced contrast
|
|
14780
|
+
return luminance > 150 ? '#000000' : '#ffffff';
|
|
14781
|
+
}
|
|
14782
|
+
/**
|
|
14783
|
+
* Determines the appropriate text color for both light and dark themes based on the fill color.
|
|
14784
|
+
* Returns default theme-appropriate colors if the fill is transparent.
|
|
14785
|
+
* @param fillColor - The theme-aware fill color
|
|
14786
|
+
* @returns A theme-aware color object with appropriate text colors for both themes
|
|
14787
|
+
*/
|
|
14788
|
+
static determineTextColor(fillColor) {
|
|
14789
|
+
// Check if fillColor is transparent for both themes
|
|
14790
|
+
const isTransparentLight = fillColor.light === 'transparent';
|
|
14791
|
+
const isTransparentDark = fillColor.dark === 'transparent';
|
|
14792
|
+
if (isTransparentLight && isTransparentDark) {
|
|
14793
|
+
// Return default theme-appropriate colors for transparent fills
|
|
14794
|
+
return { light: '#000000', dark: '#ffffff' };
|
|
14795
|
+
}
|
|
14796
|
+
// Determine text color for each theme based on fill brightness
|
|
14797
|
+
const lightThemeTextColor = isTransparentLight
|
|
14798
|
+
? '#000000'
|
|
14799
|
+
: this.getContrastColor(fillColor.light);
|
|
14800
|
+
const darkThemeTextColor = isTransparentDark
|
|
14801
|
+
? '#ffffff'
|
|
14802
|
+
: this.getContrastColor(fillColor.dark);
|
|
14803
|
+
return {
|
|
14804
|
+
light: lightThemeTextColor,
|
|
14805
|
+
dark: darkThemeTextColor,
|
|
14806
|
+
};
|
|
14807
|
+
}
|
|
14751
14808
|
}
|
|
14752
14809
|
|
|
14753
14810
|
class KritzelText extends KritzelBaseObject {
|
|
@@ -16614,7 +16671,7 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
16614
16671
|
this._core.store.state.objects.insert(path);
|
|
16615
16672
|
}
|
|
16616
16673
|
}
|
|
16617
|
-
if (event.pointerType === 'touch') {
|
|
16674
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
16618
16675
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
16619
16676
|
if (activePointers.length === 1) {
|
|
16620
16677
|
const viewportScale = this._core.store.state.scale;
|
|
@@ -16669,7 +16726,7 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
16669
16726
|
}
|
|
16670
16727
|
}
|
|
16671
16728
|
}
|
|
16672
|
-
if (event.pointerType === 'touch') {
|
|
16729
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
16673
16730
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
16674
16731
|
if (activePointers.length === 1) {
|
|
16675
16732
|
if (this._currentPathId) {
|
|
@@ -16719,7 +16776,7 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
16719
16776
|
}
|
|
16720
16777
|
}
|
|
16721
16778
|
}
|
|
16722
|
-
if (event.pointerType === 'touch') {
|
|
16779
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
16723
16780
|
if (this._core.store.state.isDrawing) {
|
|
16724
16781
|
this._core.store.state.isDrawing = false;
|
|
16725
16782
|
if (this._currentPathId) {
|
|
@@ -17111,7 +17168,7 @@ class KritzelLineTool extends KritzelBaseTool {
|
|
|
17111
17168
|
this._core.store.state.objects.insert(line);
|
|
17112
17169
|
}
|
|
17113
17170
|
}
|
|
17114
|
-
if (event.pointerType === 'touch') {
|
|
17171
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
17115
17172
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
17116
17173
|
if (activePointers.length === 1) {
|
|
17117
17174
|
const viewportScale = this._core.store.state.scale;
|
|
@@ -17174,7 +17231,7 @@ class KritzelLineTool extends KritzelBaseTool {
|
|
|
17174
17231
|
}
|
|
17175
17232
|
}
|
|
17176
17233
|
}
|
|
17177
|
-
if (event.pointerType === 'touch') {
|
|
17234
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
17178
17235
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
17179
17236
|
if (activePointers.length === 1) {
|
|
17180
17237
|
const currentLine = this._core.store.currentLine;
|
|
@@ -17223,7 +17280,7 @@ class KritzelLineTool extends KritzelBaseTool {
|
|
|
17223
17280
|
}
|
|
17224
17281
|
}
|
|
17225
17282
|
}
|
|
17226
|
-
if (event.pointerType === 'touch') {
|
|
17283
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
17227
17284
|
if (this._core.store.state.isDrawing) {
|
|
17228
17285
|
this._core.store.state.isDrawing = false;
|
|
17229
17286
|
const currentLine = this._core.store.currentLine;
|
|
@@ -17263,7 +17320,7 @@ class KritzelEraserTool extends KritzelBaseTool {
|
|
|
17263
17320
|
this._core.store.state.isErasing = true;
|
|
17264
17321
|
}
|
|
17265
17322
|
}
|
|
17266
|
-
if (event.pointerType === 'touch') {
|
|
17323
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
17267
17324
|
this.touchStartTimeout = setTimeout(() => {
|
|
17268
17325
|
if (this._core.store.state.pointers.size === 1 && !this._core.store.state.isScaling) {
|
|
17269
17326
|
this._core.store.state.isErasing = true;
|
|
@@ -17285,7 +17342,7 @@ class KritzelEraserTool extends KritzelBaseTool {
|
|
|
17285
17342
|
this._core.rerender();
|
|
17286
17343
|
}
|
|
17287
17344
|
}
|
|
17288
|
-
if (event.pointerType === 'touch') {
|
|
17345
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
17289
17346
|
if (this._core.store.state.pointers.size === 1 && this._core.store.state.isErasing) {
|
|
17290
17347
|
const shadowRoot = this._core.store.state.host?.shadowRoot;
|
|
17291
17348
|
if (!shadowRoot)
|
|
@@ -17317,7 +17374,7 @@ class KritzelEraserTool extends KritzelBaseTool {
|
|
|
17317
17374
|
this._core.engine.emitObjectsChange();
|
|
17318
17375
|
}
|
|
17319
17376
|
}
|
|
17320
|
-
if (event.pointerType === 'touch') {
|
|
17377
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
17321
17378
|
clearTimeout(this.touchStartTimeout);
|
|
17322
17379
|
if (this._core.store.state.isErasing) {
|
|
17323
17380
|
const objectsToRemove = this._core.store.allObjects.filter(object => object.markedForRemoval);
|
|
@@ -17472,7 +17529,7 @@ class KritzelTextTool extends KritzelBaseTool {
|
|
|
17472
17529
|
this._core.rerender();
|
|
17473
17530
|
text.edit(event);
|
|
17474
17531
|
}
|
|
17475
|
-
if (event.pointerType === 'touch') {
|
|
17532
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
17476
17533
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
17477
17534
|
const path = event.composedPath().slice(1);
|
|
17478
17535
|
const objectElement = path.find(element => element.classList && element.classList.contains('object'));
|
|
@@ -17710,7 +17767,7 @@ class KritzelMoveHandler extends KritzelBaseHandler {
|
|
|
17710
17767
|
this.trackedPointerId = null;
|
|
17711
17768
|
}
|
|
17712
17769
|
}
|
|
17713
|
-
if (event.pointerType === 'touch') {
|
|
17770
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
17714
17771
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
17715
17772
|
if (this._core.store.state.pointers.size === 1) {
|
|
17716
17773
|
if (this._core.store.state.isScaling) {
|
|
@@ -17760,7 +17817,7 @@ class KritzelMoveHandler extends KritzelBaseHandler {
|
|
|
17760
17817
|
}
|
|
17761
17818
|
}
|
|
17762
17819
|
}
|
|
17763
|
-
if (event.pointerType === 'touch') {
|
|
17820
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
17764
17821
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
17765
17822
|
const selectionGroup = this._core.store.selectionGroup;
|
|
17766
17823
|
if (this._core.store.state.pointers.size === 1 &&
|
|
@@ -17802,7 +17859,7 @@ class KritzelMoveHandler extends KritzelBaseHandler {
|
|
|
17802
17859
|
}
|
|
17803
17860
|
}
|
|
17804
17861
|
}
|
|
17805
|
-
if (event.pointerType === 'touch') {
|
|
17862
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
17806
17863
|
if (this._core.store.state.isDragging) {
|
|
17807
17864
|
this._core.store.state.isDragging = false;
|
|
17808
17865
|
if (this.hasMoved) {
|
|
@@ -17905,7 +17962,7 @@ class KritzelResizeHandler extends KritzelBaseHandler {
|
|
|
17905
17962
|
}
|
|
17906
17963
|
}
|
|
17907
17964
|
}
|
|
17908
|
-
if (event.pointerType === 'touch') {
|
|
17965
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
17909
17966
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
17910
17967
|
const firstTouch = activePointers[0];
|
|
17911
17968
|
if (!firstTouch) {
|
|
@@ -17985,7 +18042,7 @@ class KritzelResizeHandler extends KritzelBaseHandler {
|
|
|
17985
18042
|
selectionGroup.resize(this.newSize.x, this.newSize.y, this.newSize.width, this.newSize.height);
|
|
17986
18043
|
}
|
|
17987
18044
|
}
|
|
17988
|
-
if (event.pointerType === 'touch') {
|
|
18045
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
17989
18046
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
17990
18047
|
const oneFingerTouch = activePointers[0];
|
|
17991
18048
|
if (!oneFingerTouch) {
|
|
@@ -18060,7 +18117,7 @@ class KritzelResizeHandler extends KritzelBaseHandler {
|
|
|
18060
18117
|
this.reset();
|
|
18061
18118
|
}
|
|
18062
18119
|
}
|
|
18063
|
-
if (event.pointerType === 'touch') {
|
|
18120
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
18064
18121
|
if (this._core.store.state.isResizing) {
|
|
18065
18122
|
this._core.store.state.isResizing = false;
|
|
18066
18123
|
if (this.hasResized) {
|
|
@@ -18108,7 +18165,7 @@ class KritzelRotationHandler extends KritzelBaseHandler {
|
|
|
18108
18165
|
}
|
|
18109
18166
|
}
|
|
18110
18167
|
}
|
|
18111
|
-
if (event.pointerType === 'touch') {
|
|
18168
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
18112
18169
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
18113
18170
|
const firstTouch = activePointers[0];
|
|
18114
18171
|
if (!firstTouch) {
|
|
@@ -18150,7 +18207,7 @@ class KritzelRotationHandler extends KritzelBaseHandler {
|
|
|
18150
18207
|
selectionGroup.rotate(this.rotation);
|
|
18151
18208
|
}
|
|
18152
18209
|
}
|
|
18153
|
-
if (event.pointerType === 'touch') {
|
|
18210
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
18154
18211
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
18155
18212
|
const firstTouch = activePointers[0];
|
|
18156
18213
|
if (!firstTouch) {
|
|
@@ -18182,7 +18239,7 @@ class KritzelRotationHandler extends KritzelBaseHandler {
|
|
|
18182
18239
|
this.reset();
|
|
18183
18240
|
}
|
|
18184
18241
|
}
|
|
18185
|
-
if (event.pointerType === 'touch') {
|
|
18242
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
18186
18243
|
if (this._core.store.state.isRotating) {
|
|
18187
18244
|
this._core.store.selectionGroup.update();
|
|
18188
18245
|
this._core.engine.emitObjectsChange();
|
|
@@ -18236,7 +18293,7 @@ class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
18236
18293
|
this.startMouseSelection(event);
|
|
18237
18294
|
}
|
|
18238
18295
|
}
|
|
18239
|
-
if (event.pointerType === 'touch') {
|
|
18296
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
18240
18297
|
this.touchStartTimeout = setTimeout(() => {
|
|
18241
18298
|
if (this._core.store.state.pointers.size === 1 && !this._core.store.state.isScaling && !this._core.store.selectionGroup) {
|
|
18242
18299
|
this.startTouchSelection();
|
|
@@ -18251,7 +18308,7 @@ class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
18251
18308
|
this.updateMouseSelection(event);
|
|
18252
18309
|
}
|
|
18253
18310
|
}
|
|
18254
|
-
if (event.pointerType === 'touch') {
|
|
18311
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
18255
18312
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
18256
18313
|
const x = Math.round(activePointers[0].clientX - this._core.store.offsetX);
|
|
18257
18314
|
const y = Math.round(activePointers[0].clientY - this._core.store.offsetY);
|
|
@@ -18286,7 +18343,7 @@ class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
18286
18343
|
}
|
|
18287
18344
|
}
|
|
18288
18345
|
}
|
|
18289
|
-
if (event.pointerType === 'touch') {
|
|
18346
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
18290
18347
|
clearTimeout(this.touchStartTimeout);
|
|
18291
18348
|
const hasObjectsMoved = this._core.store.state.hasObjectsChanged;
|
|
18292
18349
|
const selectionGroup = this._core.store.selectionGroup;
|
|
@@ -18526,7 +18583,7 @@ class KritzelLineHandleHandler extends KritzelBaseHandler {
|
|
|
18526
18583
|
this.startHandleDrag(event);
|
|
18527
18584
|
}
|
|
18528
18585
|
}
|
|
18529
|
-
if (event.pointerType === 'touch') {
|
|
18586
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
18530
18587
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
18531
18588
|
if (activePointers.length === 1) {
|
|
18532
18589
|
this.startHandleDrag(event);
|
|
@@ -18922,7 +18979,7 @@ class KritzelShape extends KritzelBaseObject {
|
|
|
18922
18979
|
this.strokeWidth = config.strokeWidth ?? 4;
|
|
18923
18980
|
this.fontSize = config.fontSize ?? 16;
|
|
18924
18981
|
this.fontFamily = config.fontFamily ?? 'Arial';
|
|
18925
|
-
this.fontColor = config.fontColor ??
|
|
18982
|
+
this.fontColor = config.fontColor ?? KritzelColorHelper.determineTextColor(this.fillColor);
|
|
18926
18983
|
this.scale = config.scale ?? 1;
|
|
18927
18984
|
this.scaleFactor = config.scaleX ?? 1;
|
|
18928
18985
|
}
|
|
@@ -18953,7 +19010,7 @@ class KritzelShape extends KritzelBaseObject {
|
|
|
18953
19010
|
object.opacity = config?.opacity ?? 1;
|
|
18954
19011
|
object.fontSize = config?.fontSize ?? 16;
|
|
18955
19012
|
object.fontFamily = config?.fontFamily ?? 'Arial';
|
|
18956
|
-
object.fontColor = config?.fontColor ??
|
|
19013
|
+
object.fontColor = config?.fontColor ?? KritzelColorHelper.determineTextColor(object.fillColor);
|
|
18957
19014
|
object.backgroundColor = { light: 'transparent', dark: 'transparent' };
|
|
18958
19015
|
object.scaleFactor = 1;
|
|
18959
19016
|
object.scale = config?.scale ?? core.store.state.scale;
|
|
@@ -19134,6 +19191,25 @@ class KritzelShape extends KritzelBaseObject {
|
|
|
19134
19191
|
}
|
|
19135
19192
|
return this;
|
|
19136
19193
|
}
|
|
19194
|
+
/**
|
|
19195
|
+
* Called after properties are updated via updateObject.
|
|
19196
|
+
* Automatically adjusts text color based on fill color brightness.
|
|
19197
|
+
*/
|
|
19198
|
+
onAfterUpdate(changedProperties) {
|
|
19199
|
+
if (changedProperties.includes('fillColor')) {
|
|
19200
|
+
this.fontColor = KritzelColorHelper.determineTextColor(this.fillColor);
|
|
19201
|
+
// Update the editor's text color immediately
|
|
19202
|
+
if (this.editor?.dom?.parentElement) {
|
|
19203
|
+
this.editor.dom.parentElement.style.color = KritzelColorHelper.resolveThemeColor(this.fontColor);
|
|
19204
|
+
}
|
|
19205
|
+
}
|
|
19206
|
+
else if (changedProperties.includes('fontColor')) {
|
|
19207
|
+
// Also update editor when fontColor changes directly
|
|
19208
|
+
if (this.editor?.dom?.parentElement) {
|
|
19209
|
+
this.editor.dom.parentElement.style.color = KritzelColorHelper.resolveThemeColor(this.fontColor);
|
|
19210
|
+
}
|
|
19211
|
+
}
|
|
19212
|
+
}
|
|
19137
19213
|
/**
|
|
19138
19214
|
* Returns the clipping polygon for arrow intersection.
|
|
19139
19215
|
* For ellipse: returns a many-sided polygon approximation
|
|
@@ -19347,7 +19423,9 @@ class KritzelSelectionTool extends KritzelBaseTool {
|
|
|
19347
19423
|
const objects = this.flattenObjects(this.getSelectedObjects());
|
|
19348
19424
|
objects.forEach(obj => {
|
|
19349
19425
|
if (obj instanceof KritzelShape) {
|
|
19350
|
-
|
|
19426
|
+
// Calculate new font color based on fill color
|
|
19427
|
+
const newFontColor = KritzelColorHelper.determineTextColor(value);
|
|
19428
|
+
this._core.updateObject(obj, { fillColor: value, fontColor: newFontColor });
|
|
19351
19429
|
// When switching to fill mode, also update stroke color to match
|
|
19352
19430
|
const isTransparent = typeof value === 'string' ? value === 'transparent' :
|
|
19353
19431
|
(value.light === 'transparent' && value.dark === 'transparent');
|
|
@@ -19503,7 +19581,7 @@ class KritzelSelectionTool extends KritzelBaseTool {
|
|
|
19503
19581
|
this.rotationHandler.handlePointerDown(event);
|
|
19504
19582
|
this._core.rerender();
|
|
19505
19583
|
}
|
|
19506
|
-
if (event.pointerType === 'touch') {
|
|
19584
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
19507
19585
|
if (this._core.store.state.isScaling === true) {
|
|
19508
19586
|
return;
|
|
19509
19587
|
}
|
|
@@ -19549,7 +19627,7 @@ class KritzelSelectionTool extends KritzelBaseTool {
|
|
|
19549
19627
|
this.rotationHandler.handlePointerMove(event);
|
|
19550
19628
|
this._core.rerender();
|
|
19551
19629
|
}
|
|
19552
|
-
if (event.pointerType === 'touch') {
|
|
19630
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
19553
19631
|
if (this._core.store.state.isScaling === true) {
|
|
19554
19632
|
return;
|
|
19555
19633
|
}
|
|
@@ -19573,7 +19651,7 @@ class KritzelSelectionTool extends KritzelBaseTool {
|
|
|
19573
19651
|
this.selectionHandler.handlePointerUp(event);
|
|
19574
19652
|
this._core.rerender();
|
|
19575
19653
|
}
|
|
19576
|
-
if (event.pointerType === 'touch') {
|
|
19654
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
19577
19655
|
if (this._core.store.state.isScaling === true) {
|
|
19578
19656
|
return;
|
|
19579
19657
|
}
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-i21-qqbc.js');
|
|
4
|
-
var defaultLineTool_config = require('./default-line-tool.config-
|
|
4
|
+
var defaultLineTool_config = require('./default-line-tool.config-B0ttzt48.js');
|
|
5
5
|
|
|
6
6
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
7
7
|
|
|
@@ -297,7 +297,7 @@ class KritzelShapeTool extends defaultLineTool_config.KritzelBaseTool {
|
|
|
297
297
|
}
|
|
298
298
|
this.startDrawing(event.clientX, event.clientY);
|
|
299
299
|
}
|
|
300
|
-
if (event.pointerType === 'touch') {
|
|
300
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
301
301
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
302
302
|
const path = event.composedPath().slice(1);
|
|
303
303
|
const objectElement = path.find(element => element.classList && element.classList.contains('object'));
|
|
@@ -335,7 +335,7 @@ class KritzelShapeTool extends defaultLineTool_config.KritzelBaseTool {
|
|
|
335
335
|
if (event.pointerType === 'mouse') {
|
|
336
336
|
this.updateShapeSize(event.clientX, event.clientY);
|
|
337
337
|
}
|
|
338
|
-
if (event.pointerType === 'touch') {
|
|
338
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
339
339
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
340
340
|
if (activePointers.length === 1) {
|
|
341
341
|
const clientX = Math.round(activePointers[0].clientX);
|
|
@@ -383,7 +383,6 @@ class KritzelShapeTool extends defaultLineTool_config.KritzelBaseTool {
|
|
|
383
383
|
opacity: this.opacity,
|
|
384
384
|
fontSize: this.fontSize,
|
|
385
385
|
fontFamily: this.fontFamily,
|
|
386
|
-
fontColor: this.fontColor,
|
|
387
386
|
scale: lockScale ? 1 : viewportScale,
|
|
388
387
|
});
|
|
389
388
|
this._core.store.state.objects.insert(this.currentShape);
|
|
@@ -19077,7 +19076,7 @@ class KritzelViewport {
|
|
|
19077
19076
|
this._core.store.state.startY = adjustedClientY;
|
|
19078
19077
|
}
|
|
19079
19078
|
}
|
|
19080
|
-
if (event.pointerType === 'touch') {
|
|
19079
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
19081
19080
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
19082
19081
|
if (activePointers.length === 2) {
|
|
19083
19082
|
const currentPath = this._core.store.currentPath;
|
|
@@ -19125,7 +19124,7 @@ class KritzelViewport {
|
|
|
19125
19124
|
this._debounceUpdate();
|
|
19126
19125
|
}
|
|
19127
19126
|
}
|
|
19128
|
-
if (event.pointerType === 'touch') {
|
|
19127
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
19129
19128
|
const hostRect = this._core.store.state.host.getBoundingClientRect();
|
|
19130
19129
|
const xRelativeToHost = event.clientX - hostRect.left;
|
|
19131
19130
|
const yRelativeToHost = event.clientY - hostRect.top;
|
|
@@ -19169,7 +19168,7 @@ class KritzelViewport {
|
|
|
19169
19168
|
this._core.rerender();
|
|
19170
19169
|
}
|
|
19171
19170
|
}
|
|
19172
|
-
if (event.pointerType === 'touch') {
|
|
19171
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
19173
19172
|
if (this._core.store.state.pointers.size === 0) {
|
|
19174
19173
|
this._debounceEndScaling();
|
|
19175
19174
|
}
|
|
@@ -22064,7 +22063,7 @@ const KritzelEngine = class {
|
|
|
22064
22063
|
if (this.core.store.isDisabled) {
|
|
22065
22064
|
return;
|
|
22066
22065
|
}
|
|
22067
|
-
if (ev.pointerType === 'touch') {
|
|
22066
|
+
if (ev.pointerType === 'touch' || ev.pointerType === 'pen') {
|
|
22068
22067
|
return;
|
|
22069
22068
|
}
|
|
22070
22069
|
this.contextMenuHandler.handleContextMenu(ev);
|
|
@@ -22425,7 +22424,7 @@ const KritzelEngine = class {
|
|
|
22425
22424
|
if (this.core.store.totalObjectCount > 0) {
|
|
22426
22425
|
this.objectsInViewportChange.emit(visibleObjects);
|
|
22427
22426
|
}
|
|
22428
|
-
return (index.h(index.Host, { key: '
|
|
22427
|
+
return (index.h(index.Host, { key: '26d2ef50f28fb809d046b60dff6e977dec53fc8c' }, this.core.store.state.debugInfo.showViewportInfo && (index.h("div", { key: 'bbacc63967672c6934d1c90913139f1f96e532cb', class: "debug-panel" }, index.h("div", { key: '59d46ef1a1a8dffe7b1bd97b0df3c77fdd095d97' }, "ActiveWorkspaceId: ", this.core.store.state?.activeWorkspace?.id), index.h("div", { key: 'd6bc9b3c6076540ccfec4fd2ef3b3e2edf08d524' }, "ActiveWorkspaceName: ", this.core.store.state?.activeWorkspace?.name), index.h("div", { key: '12e229d893933a01bbfdd038e1bd14eee198b34e' }, "TranslateX: ", this.core.store.state?.translateX), index.h("div", { key: '9caf69c342d545a478bb4945aa7b2c37ea77561f' }, "TranslateY: ", this.core.store.state?.translateY), index.h("div", { key: '123f6b17777475f4de32872b940abd3b7ffe6d78' }, "ViewportWidth: ", this.core.store.state?.viewportWidth), index.h("div", { key: '463c70e208dad8572317bbde0df0f4b149674a7d' }, "ViewportHeight: ", this.core.store.state?.viewportHeight), index.h("div", { key: '82deb6d97ae66c86431b32582114f81bcd83e5ae' }, "PointerCount: ", this.core.store.state.pointers.size), index.h("div", { key: 'be32ffe65da2fc92f556ac037afa5b50c27cedd2' }, "Scale: ", this.core.store.state?.scale), index.h("div", { key: '53029e75a8972f670ef0fa427549415fd8be7986' }, "ActiveTool: ", this.core.store.state?.activeTool?.name), index.h("div", { key: '27517882d278f0df7df59858a9219d356e5bbd8d' }, "HasViewportChanged: ", this.core.store.state?.hasViewportChanged ? 'true' : 'false'), index.h("div", { key: '616611f9ad570741c9be3eabd0c78dc978c16c4f' }, "IsEnabled: ", this.core.store.state?.isEnabled ? 'true' : 'false'), index.h("div", { key: '318a17d0b0d7eb2a58233c76063cc72e87782f1b' }, "IsScaling: ", this.core.store.state?.isScaling ? 'true' : 'false'), index.h("div", { key: '45c92f5cc524338b5c0cab5f5123faf0296e7484' }, "IsPanning: ", this.core.store.state?.isPanning ? 'true' : 'false'), index.h("div", { key: '4b295ddaf8eb9e49547430c839a9ba50daacd42e' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), index.h("div", { key: 'eef9039260d0f1ffa23102aee0f18ebd90111738' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), index.h("div", { key: '1a22a4a93ddab249532fe40640f1fa7bbb485d76' }, "IsResizeHandleSelected: ", this.core.store.state.isResizeHandleSelected ? 'true' : 'false'), index.h("div", { key: '094daef63fffab66051e1c65392baac58d8f3eca' }, "IsRotationHandleSelected: ", this.core.store.state.isRotationHandleSelected ? 'true' : 'false'), index.h("div", { key: 'dae17ba3dec0ededdfb873eda4081fb51cea0c52' }, "IsRotationHandleHovered: ", this.core.store.state.isRotationHandleHovered ? 'true' : 'false'), index.h("div", { key: '11b4c3fb7fef201e6a98a58f586e1c717f255af4' }, "IsDrawing: ", this.core.store.state.isDrawing ? 'true' : 'false'), index.h("div", { key: 'ac7b98f441747b90f047069b9e7eac2ac5194eec' }, "IsWriting: ", this.core.store.state.isWriting ? 'true' : 'false'), index.h("div", { key: 'eb2285428d88835319c68ff26cb99e1e631cba82' }, "IsPointerDown: ", this.core.store.isPointerDown ? 'true' : 'false'), index.h("div", { key: 'd32cb23e569a84b16a50b98d2e3d778c6462c88c' }, "PointerX: ", this.core.store.state?.pointerX), index.h("div", { key: '0b4fafde05bb83d4046b103015a4f008c5b268d8' }, "PointerY: ", this.core.store.state?.pointerY), index.h("div", { key: '0083eb1e81cd1d0552e0fa2d6cca147e14e0bd86' }, "SelectedObjects: ", this.core.store.selectionGroup?.objects.length || 0), index.h("div", { key: '232f452fd89d22db9e4aaf8e6d3b672f934422a5' }, "ViewportCenter: (", viewportCenterX.toFixed(2), ", ", viewportCenterY.toFixed(2), ")"))), index.h("div", { key: '66a0d3a6ac62153acf6ed1b7c57b3ae77daa3c5e', id: "origin", class: "origin", style: {
|
|
22429
22428
|
transform: `matrix(${this.core.store.state?.scale}, 0, 0, ${this.core.store.state?.scale}, ${this.core.store.state?.translateX}, ${this.core.store.state?.translateY})`,
|
|
22430
22429
|
} }, visibleObjects?.map(object => {
|
|
22431
22430
|
return (index.h("div", { key: object.id, style: {
|
|
@@ -22701,7 +22700,7 @@ const KritzelEngine = class {
|
|
|
22701
22700
|
stroke: 'var(--kritzel-snap-indicator-stroke, #007bff)',
|
|
22702
22701
|
strokeWidth: data.indicatorStrokeWidth,
|
|
22703
22702
|
} }))));
|
|
22704
|
-
})()), this.core.store.state.isContextMenuVisible && (index.h("kritzel-context-menu", { key: '
|
|
22703
|
+
})()), this.core.store.state.isContextMenuVisible && (index.h("kritzel-context-menu", { key: '1e1cd8f60b4621c2045c863965f00808fb6945cc', class: "context-menu", ref: el => (this.contextMenuElement = el), items: this.core.store.state.contextMenuItems, objects: this.core.store.selectionGroup?.objects || [], style: {
|
|
22705
22704
|
position: 'fixed',
|
|
22706
22705
|
left: `${this.core.store.state.contextMenuX}px`,
|
|
22707
22706
|
top: `${this.core.store.state.contextMenuY}px`,
|
|
@@ -22712,7 +22711,7 @@ const KritzelEngine = class {
|
|
|
22712
22711
|
y: (-this.core.store.state.translateY + this.core.store.state.contextMenuY) / this.core.store.state.scale,
|
|
22713
22712
|
}, this.core.store.selectionGroup?.objects);
|
|
22714
22713
|
this.hideContextMenu();
|
|
22715
|
-
}, onClose: () => this.hideContextMenu() })), this.core.store.state?.activeTool instanceof defaultLineTool_config.KritzelEraserTool && !this.core.store.state.isScaling && index.h("kritzel-cursor-trail", { key: '
|
|
22714
|
+
}, onClose: () => this.hideContextMenu() })), this.core.store.state?.activeTool instanceof defaultLineTool_config.KritzelEraserTool && !this.core.store.state.isScaling && index.h("kritzel-cursor-trail", { key: 'f76c7695d997e395cc588760515d730d88947401', core: this.core })));
|
|
22716
22715
|
}
|
|
22717
22716
|
static get watchers() { return {
|
|
22718
22717
|
"workspace": [{
|
|
@@ -23723,7 +23722,7 @@ const KritzelPortal = class {
|
|
|
23723
23722
|
* This file is auto-generated by the version bump scripts.
|
|
23724
23723
|
* Do not modify manually.
|
|
23725
23724
|
*/
|
|
23726
|
-
const KRITZEL_VERSION = '0.1.
|
|
23725
|
+
const KRITZEL_VERSION = '0.1.18';
|
|
23727
23726
|
|
|
23728
23727
|
const kritzelSettingsCss = () => `:host{display:contents}kritzel-dialog{--kritzel-dialog-body-padding:0;--kritzel-dialog-width-large:800px;--kritzel-dialog-height-large:500px}.footer-button{padding:8px 16px;border-radius:6px;cursor:pointer;font-size:14px}.cancel-button{border:1px solid #ebebeb;background:#fff;color:inherit}.cancel-button:hover{background:#f5f5f5}.settings-content{padding:0}.settings-content h3{margin:0 0 16px 0;font-size:18px;font-weight:600;color:var(--kritzel-settings-content-heading-color, #333333)}.settings-content p{margin:0;font-size:14px;color:var(--kritzel-settings-content-text-color, #666666);line-height:1.5}.settings-group{display:flex;flex-direction:column;gap:24px}.settings-item{display:flex;flex-direction:column;gap:8px}.settings-row{display:flex;align-items:center;justify-content:space-between;gap:16px}.settings-label{font-size:14px;font-weight:500;color:var(--kritzel-settings-label-color, #333333);margin:0}.settings-description{font-size:12px;color:var(--kritzel-settings-description-color, #888888);margin:0;line-height:1.4}`;
|
|
23729
23728
|
|
|
@@ -52,7 +52,7 @@ export class KritzelViewport {
|
|
|
52
52
|
this._core.store.state.startY = adjustedClientY;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
if (event.pointerType === 'touch') {
|
|
55
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
56
56
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
57
57
|
if (activePointers.length === 2) {
|
|
58
58
|
const currentPath = this._core.store.currentPath;
|
|
@@ -100,7 +100,7 @@ export class KritzelViewport {
|
|
|
100
100
|
this._debounceUpdate();
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
if (event.pointerType === 'touch') {
|
|
103
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
104
104
|
const hostRect = this._core.store.state.host.getBoundingClientRect();
|
|
105
105
|
const xRelativeToHost = event.clientX - hostRect.left;
|
|
106
106
|
const yRelativeToHost = event.clientY - hostRect.top;
|
|
@@ -144,7 +144,7 @@ export class KritzelViewport {
|
|
|
144
144
|
this._core.rerender();
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
if (event.pointerType === 'touch') {
|
|
147
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
148
148
|
if (this._core.store.state.pointers.size === 0) {
|
|
149
149
|
this._debounceEndScaling();
|
|
150
150
|
}
|
|
@@ -12,7 +12,7 @@ export class KritzelHoverHandler extends KritzelBaseHandler {
|
|
|
12
12
|
const y = this._core.store.state.pointerY;
|
|
13
13
|
hoveredObject.isHovered = hoveredObject.hitTest(x, y);
|
|
14
14
|
}
|
|
15
|
-
if (event.pointerType === 'touch') {
|
|
15
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -40,7 +40,7 @@ export class KritzelLineHandleHandler extends KritzelBaseHandler {
|
|
|
40
40
|
this.startHandleDrag(event);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
if (event.pointerType === 'touch') {
|
|
43
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
44
44
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
45
45
|
if (activePointers.length === 1) {
|
|
46
46
|
this.startHandleDrag(event);
|
|
@@ -62,7 +62,7 @@ export class KritzelMoveHandler extends KritzelBaseHandler {
|
|
|
62
62
|
this.trackedPointerId = null;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
if (event.pointerType === 'touch') {
|
|
65
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
66
66
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
67
67
|
if (this._core.store.state.pointers.size === 1) {
|
|
68
68
|
if (this._core.store.state.isScaling) {
|
|
@@ -112,7 +112,7 @@ export class KritzelMoveHandler extends KritzelBaseHandler {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
if (event.pointerType === 'touch') {
|
|
115
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
116
116
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
117
117
|
const selectionGroup = this._core.store.selectionGroup;
|
|
118
118
|
if (this._core.store.state.pointers.size === 1 &&
|
|
@@ -154,7 +154,7 @@ export class KritzelMoveHandler extends KritzelBaseHandler {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
if (event.pointerType === 'touch') {
|
|
157
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
158
158
|
if (this._core.store.state.isDragging) {
|
|
159
159
|
this._core.store.state.isDragging = false;
|
|
160
160
|
if (this.hasMoved) {
|
|
@@ -34,7 +34,7 @@ export class KritzelResizeHandler extends KritzelBaseHandler {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
if (event.pointerType === 'touch') {
|
|
37
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
38
38
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
39
39
|
const firstTouch = activePointers[0];
|
|
40
40
|
if (!firstTouch) {
|
|
@@ -114,7 +114,7 @@ export class KritzelResizeHandler extends KritzelBaseHandler {
|
|
|
114
114
|
selectionGroup.resize(this.newSize.x, this.newSize.y, this.newSize.width, this.newSize.height);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
if (event.pointerType === 'touch') {
|
|
117
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
118
118
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
119
119
|
const oneFingerTouch = activePointers[0];
|
|
120
120
|
if (!oneFingerTouch) {
|
|
@@ -189,7 +189,7 @@ export class KritzelResizeHandler extends KritzelBaseHandler {
|
|
|
189
189
|
this.reset();
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
if (event.pointerType === 'touch') {
|
|
192
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
193
193
|
if (this._core.store.state.isResizing) {
|
|
194
194
|
this._core.store.state.isResizing = false;
|
|
195
195
|
if (this.hasResized) {
|
|
@@ -33,7 +33,7 @@ export class KritzelRotationHandler extends KritzelBaseHandler {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
if (event.pointerType === 'touch') {
|
|
36
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
37
37
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
38
38
|
const firstTouch = activePointers[0];
|
|
39
39
|
if (!firstTouch) {
|
|
@@ -75,7 +75,7 @@ export class KritzelRotationHandler extends KritzelBaseHandler {
|
|
|
75
75
|
selectionGroup.rotate(this.rotation);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
if (event.pointerType === 'touch') {
|
|
78
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
79
79
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
80
80
|
const firstTouch = activePointers[0];
|
|
81
81
|
if (!firstTouch) {
|
|
@@ -107,7 +107,7 @@ export class KritzelRotationHandler extends KritzelBaseHandler {
|
|
|
107
107
|
this.reset();
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
if (event.pointerType === 'touch') {
|
|
110
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
111
111
|
if (this._core.store.state.isRotating) {
|
|
112
112
|
this._core.store.selectionGroup.update();
|
|
113
113
|
this._core.engine.emitObjectsChange();
|
|
@@ -26,7 +26,7 @@ export class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
26
26
|
this.startMouseSelection(event);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
if (event.pointerType === 'touch') {
|
|
29
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
30
30
|
this.touchStartTimeout = setTimeout(() => {
|
|
31
31
|
if (this._core.store.state.pointers.size === 1 && !this._core.store.state.isScaling && !this._core.store.selectionGroup) {
|
|
32
32
|
this.startTouchSelection();
|
|
@@ -41,7 +41,7 @@ export class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
41
41
|
this.updateMouseSelection(event);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
if (event.pointerType === 'touch') {
|
|
44
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
45
45
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
46
46
|
const x = Math.round(activePointers[0].clientX - this._core.store.offsetX);
|
|
47
47
|
const y = Math.round(activePointers[0].clientY - this._core.store.offsetY);
|
|
@@ -76,7 +76,7 @@ export class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
if (event.pointerType === 'touch') {
|
|
79
|
+
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
80
80
|
clearTimeout(this.touchStartTimeout);
|
|
81
81
|
const hasObjectsMoved = this._core.store.state.hasObjectsChanged;
|
|
82
82
|
const selectionGroup = this._core.store.selectionGroup;
|