@plait/core 0.89.1 → 0.89.2
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/fesm2022/plait-core.mjs +16 -13
- package/fesm2022/plait-core.mjs.map +1 -1
- package/package.json +1 -1
- package/utils/mobile.d.ts +0 -2
package/fesm2022/plait-core.mjs
CHANGED
|
@@ -5739,10 +5739,6 @@ function withBoard(board) {
|
|
|
5739
5739
|
return board;
|
|
5740
5740
|
}
|
|
5741
5741
|
|
|
5742
|
-
const isSmartHand = (board, event) => {
|
|
5743
|
-
return PlaitBoard.isPointer(board, PlaitPointerType.selection) && isMobileDeviceEvent(event);
|
|
5744
|
-
};
|
|
5745
|
-
|
|
5746
5742
|
const ShortcutKey = 'Space';
|
|
5747
5743
|
const SECONDARY_POINTER_MOVE_THRESHOLD = 5;
|
|
5748
5744
|
const IS_HAND_MODE = new WeakMap();
|
|
@@ -5759,12 +5755,7 @@ function withHandPointer(board) {
|
|
|
5759
5755
|
let beingPressedShortcutKey = false;
|
|
5760
5756
|
board.pointerDown = (event) => {
|
|
5761
5757
|
const options = board.getPluginOptions(PlaitPluginKey.withHand);
|
|
5762
|
-
const
|
|
5763
|
-
const isHitTarget = isHitElement(board, point);
|
|
5764
|
-
const canEnterHandMode = options?.isHandMode(board, event) ||
|
|
5765
|
-
PlaitBoard.isPointer(board, PlaitPointerType.hand) ||
|
|
5766
|
-
(isSmartHand(board, event) && !isHitTarget) ||
|
|
5767
|
-
beingPressedShortcutKey;
|
|
5758
|
+
const canEnterHandMode = options?.isHandMode(board, event) || PlaitBoard.isPointer(board, PlaitPointerType.hand) || beingPressedShortcutKey;
|
|
5768
5759
|
if (canEnterHandMode && isMainPointer(event)) {
|
|
5769
5760
|
movingPoint = {
|
|
5770
5761
|
x: event.x,
|
|
@@ -5813,7 +5804,6 @@ function withHandPointer(board) {
|
|
|
5813
5804
|
}
|
|
5814
5805
|
const canEnterHandMode = options?.isHandMode(board, event) ||
|
|
5815
5806
|
PlaitBoard.isPointer(board, PlaitPointerType.hand) ||
|
|
5816
|
-
isSmartHand(board, event) ||
|
|
5817
5807
|
hasWheelPressed ||
|
|
5818
5808
|
hasSecondaryPressed ||
|
|
5819
5809
|
beingPressedShortcutKey;
|
|
@@ -6265,6 +6255,7 @@ function withMoving(board) {
|
|
|
6265
6255
|
let hitTargetElement = undefined;
|
|
6266
6256
|
let isHitSelectedTarget = undefined;
|
|
6267
6257
|
let pendingNodesG = null;
|
|
6258
|
+
let pointerId = null;
|
|
6268
6259
|
board.globalKeyDown = (event) => {
|
|
6269
6260
|
if (!PlaitBoard.isReadonly(board)) {
|
|
6270
6261
|
if (isKeyHotkey('option', event)) {
|
|
@@ -6303,11 +6294,13 @@ function withMoving(board) {
|
|
|
6303
6294
|
isHitSelectedTarget = hitTargetElement && selectedTargetElements.includes(hitTargetElement);
|
|
6304
6295
|
if (hitTargetElement && isHitSelectedTarget) {
|
|
6305
6296
|
startPoint = point;
|
|
6297
|
+
pointerId = event.pointerId;
|
|
6306
6298
|
activeElements = selectedTargetElements;
|
|
6307
6299
|
activeElementsRectangle = getRectangleByElements(board, activeElements, true);
|
|
6308
6300
|
}
|
|
6309
6301
|
else if (hitTargetElement) {
|
|
6310
6302
|
startPoint = point;
|
|
6303
|
+
pointerId = event.pointerId;
|
|
6311
6304
|
const relatedElements = board.getRelatedFragment([], [hitTargetElement]);
|
|
6312
6305
|
activeElements = [...getElementsInGroupByElement(board, hitTargetElement), ...relatedElements];
|
|
6313
6306
|
activeElementsRectangle = getRectangleByElements(board, activeElements, true);
|
|
@@ -6319,6 +6312,7 @@ function withMoving(board) {
|
|
|
6319
6312
|
const isHitInTargetRectangle = targetRectangle && RectangleClient.isPointInRectangle(targetRectangle, point);
|
|
6320
6313
|
if (isHitInTargetRectangle) {
|
|
6321
6314
|
startPoint = point;
|
|
6315
|
+
pointerId = event.pointerId;
|
|
6322
6316
|
activeElements = selectedTargetElements;
|
|
6323
6317
|
activeElementsRectangle = targetRectangle;
|
|
6324
6318
|
}
|
|
@@ -6333,7 +6327,7 @@ function withMoving(board) {
|
|
|
6333
6327
|
touchMove(event);
|
|
6334
6328
|
};
|
|
6335
6329
|
board.pointerMove = (event) => {
|
|
6336
|
-
if (startPoint && activeElements.length && !PlaitBoard.hasBeenTextEditing(board)) {
|
|
6330
|
+
if (startPoint && activeElements.length && !PlaitBoard.hasBeenTextEditing(board) && pointerId === event.pointerId) {
|
|
6337
6331
|
if (!isPreventDefault) {
|
|
6338
6332
|
isPreventDefault = true;
|
|
6339
6333
|
}
|
|
@@ -6412,6 +6406,7 @@ function withMoving(board) {
|
|
|
6412
6406
|
snapG?.remove();
|
|
6413
6407
|
pendingNodesG?.remove();
|
|
6414
6408
|
startPoint = null;
|
|
6409
|
+
pointerId = null;
|
|
6415
6410
|
activeElementsRectangle = null;
|
|
6416
6411
|
offsetX = 0;
|
|
6417
6412
|
offsetY = 0;
|
|
@@ -6590,10 +6585,14 @@ function withSelection(board) {
|
|
|
6590
6585
|
options.isMultipleSelection &&
|
|
6591
6586
|
!options.isDisabledSelection) {
|
|
6592
6587
|
if (isMobileDeviceEvent(event)) {
|
|
6588
|
+
if (timerId) {
|
|
6589
|
+
clearTimeout(timerId);
|
|
6590
|
+
timerId = null;
|
|
6591
|
+
}
|
|
6593
6592
|
timerId = setTimeout(() => {
|
|
6594
6593
|
screenStart = [event.x, event.y];
|
|
6595
6594
|
timerId = null;
|
|
6596
|
-
},
|
|
6595
|
+
}, 400);
|
|
6597
6596
|
}
|
|
6598
6597
|
else {
|
|
6599
6598
|
screenStart = [event.x, event.y];
|
|
@@ -6603,6 +6602,10 @@ function withSelection(board) {
|
|
|
6603
6602
|
pointerDown(event);
|
|
6604
6603
|
};
|
|
6605
6604
|
board.touchMove = (event) => {
|
|
6605
|
+
if (screenStart && event.touches.length > 1) {
|
|
6606
|
+
screenStart = null;
|
|
6607
|
+
selectionMovingG?.remove();
|
|
6608
|
+
}
|
|
6606
6609
|
if (screenStart) {
|
|
6607
6610
|
event.preventDefault();
|
|
6608
6611
|
return;
|