@plait/core 0.0.46 → 0.0.48
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/board/board.component.d.ts +2 -1
- package/esm2020/board/board.component.mjs +11 -13
- package/esm2020/plugins/with-move.mjs +4 -1
- package/fesm2015/plait-core.mjs +13 -12
- package/fesm2015/plait-core.mjs.map +1 -1
- package/fesm2020/plait-core.mjs +13 -12
- package/fesm2020/plait-core.mjs.map +1 -1
- package/package.json +1 -1
package/fesm2020/plait-core.mjs
CHANGED
|
@@ -993,6 +993,9 @@ function withMove(board) {
|
|
|
993
993
|
board.mousemove = (event) => {
|
|
994
994
|
const boardComponent = PLAIT_BOARD_TO_COMPONENT.get(board);
|
|
995
995
|
if (board.cursor === BaseCursorStatus.move && board.selection && boardComponent.isMoving) {
|
|
996
|
+
const left = event.x - plaitBoardMove.x;
|
|
997
|
+
const top = event.y - plaitBoardMove.y;
|
|
998
|
+
boardComponent.setScroll(boardComponent.scrollLeft - left, boardComponent.scrollTop - top);
|
|
996
999
|
plaitBoardMove.x = event.x;
|
|
997
1000
|
plaitBoardMove.y = event.y;
|
|
998
1001
|
}
|
|
@@ -1354,7 +1357,7 @@ class PlaitBoardComponent {
|
|
|
1354
1357
|
.subscribe((event) => {
|
|
1355
1358
|
const scrollLeft = event.target.scrollLeft;
|
|
1356
1359
|
const scrollTop = event.target.scrollTop;
|
|
1357
|
-
this.
|
|
1360
|
+
this.setScroll(scrollLeft, scrollTop);
|
|
1358
1361
|
});
|
|
1359
1362
|
window.onresize = () => {
|
|
1360
1363
|
this.updateViewport();
|
|
@@ -1377,13 +1380,8 @@ class PlaitBoardComponent {
|
|
|
1377
1380
|
this.renderer2.setStyle(this.contentContainer.nativeElement, 'maxHeight', height);
|
|
1378
1381
|
}
|
|
1379
1382
|
setScroll(left, top) {
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
top,
|
|
1383
|
-
left
|
|
1384
|
-
});
|
|
1385
|
-
}
|
|
1386
|
-
getScrollOffset(left, top) {
|
|
1383
|
+
this.scrollLeft = left;
|
|
1384
|
+
this.scrollTop = top;
|
|
1387
1385
|
const viewportBox = getViewportClientBox(this.board);
|
|
1388
1386
|
const viewBox = getViewBox(this.board);
|
|
1389
1387
|
const scrollLeftRatio = left / (viewBox.viewportWidth - viewportBox.width);
|
|
@@ -1400,16 +1398,19 @@ class PlaitBoardComponent {
|
|
|
1400
1398
|
const viewportBox = getViewportClientBox(this.board);
|
|
1401
1399
|
const { minX, minY, width, height, viewportWidth, viewportHeight } = viewBox;
|
|
1402
1400
|
const box = [minX, minY, width, height];
|
|
1403
|
-
|
|
1404
|
-
|
|
1401
|
+
this.scrollLeft = (viewportWidth - viewportBox.width) * offsetXRatio;
|
|
1402
|
+
this.scrollTop = (viewportHeight - viewportBox.height) * offsetYRatio;
|
|
1405
1403
|
this.renderer2.setStyle(this.host, 'display', 'block');
|
|
1406
1404
|
this.renderer2.setStyle(this.host, 'width', `${viewportWidth}px`);
|
|
1407
1405
|
this.renderer2.setStyle(this.host, 'height', `${viewportHeight}px`);
|
|
1408
|
-
this.renderer2.setStyle(this.host, 'cursor', this.isMoveMode ? 'grab' : 'default');
|
|
1409
1406
|
if (width > 0 && height > 0) {
|
|
1410
1407
|
this.renderer2.setAttribute(this.host, 'viewBox', box.join());
|
|
1411
1408
|
}
|
|
1412
|
-
this.
|
|
1409
|
+
const container = this.contentContainer.nativeElement;
|
|
1410
|
+
container.scrollTo({
|
|
1411
|
+
top: this.scrollTop,
|
|
1412
|
+
left: this.scrollLeft
|
|
1413
|
+
});
|
|
1413
1414
|
}
|
|
1414
1415
|
updateViewport() {
|
|
1415
1416
|
this.resizeViewport();
|