@plait/core 0.0.50 → 0.0.52
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/esm2020/board/board.component.mjs +4 -4
- package/esm2020/utils/matrix.mjs +23 -1
- package/fesm2015/plait-core.mjs +25 -4
- package/fesm2015/plait-core.mjs.map +1 -1
- package/fesm2020/plait-core.mjs +25 -4
- package/fesm2020/plait-core.mjs.map +1 -1
- package/package.json +1 -1
- package/styles/styles.scss +4 -0
- package/utils/matrix.d.ts +4 -0
package/fesm2020/plait-core.mjs
CHANGED
|
@@ -899,6 +899,27 @@ function getViewBox(board) {
|
|
|
899
899
|
const height = viewportHeight / zoom;
|
|
900
900
|
return { minX, minY, width, height, viewportWidth, viewportHeight };
|
|
901
901
|
}
|
|
902
|
+
function isOutExtent(board, node, gap) {
|
|
903
|
+
const result = { x: 0, y: 0 };
|
|
904
|
+
if (!node)
|
|
905
|
+
return result;
|
|
906
|
+
const boardComponent = PLAIT_BOARD_TO_COMPONENT.get(board);
|
|
907
|
+
const scrollBarWidth = board.options.hideScrollbar ? SCROLL_BAR_WIDTH : 0;
|
|
908
|
+
const canvasRect = boardComponent.contentContainer.nativeElement.getBoundingClientRect();
|
|
909
|
+
if (node.left < canvasRect.left + gap) {
|
|
910
|
+
result.x = canvasRect.left - node.left - gap;
|
|
911
|
+
}
|
|
912
|
+
else if (node.right > canvasRect.right - scrollBarWidth - gap) {
|
|
913
|
+
result.x = canvasRect.right - scrollBarWidth - gap - node.right - node.width;
|
|
914
|
+
}
|
|
915
|
+
if (node.top < canvasRect.top + gap) {
|
|
916
|
+
result.y = canvasRect.top - node.top - gap;
|
|
917
|
+
}
|
|
918
|
+
else if (node.bottom > canvasRect.bottom - scrollBarWidth - gap) {
|
|
919
|
+
result.y = canvasRect.bottom - scrollBarWidth - gap - node.bottom - node.height;
|
|
920
|
+
}
|
|
921
|
+
return result;
|
|
922
|
+
}
|
|
902
923
|
|
|
903
924
|
function withHistory(board) {
|
|
904
925
|
const { apply, keydown } = board;
|
|
@@ -1493,7 +1514,7 @@ class PlaitBoardComponent {
|
|
|
1493
1514
|
zoom = 1;
|
|
1494
1515
|
}
|
|
1495
1516
|
this.setViewport({
|
|
1496
|
-
zoom,
|
|
1517
|
+
zoom: calculateZoom(zoom),
|
|
1497
1518
|
offsetXRatio: 0.5,
|
|
1498
1519
|
offsetYRatio: 0.5
|
|
1499
1520
|
});
|
|
@@ -1536,7 +1557,7 @@ class PlaitBoardComponent {
|
|
|
1536
1557
|
PlaitBoardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PlaitBoardComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1537
1558
|
PlaitBoardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: PlaitBoardComponent, selector: "plait-board", inputs: { plaitValue: "plaitValue", plaitViewport: "plaitViewport", plaitPlugins: "plaitPlugins", plaitOptions: "plaitOptions" }, outputs: { plaitChange: "plaitChange", plaitBoardInitialized: "plaitBoardInitialized" }, host: { properties: { "class": "this.hostClass", "class.readonly": "this.readonly", "class.moving": "this.moving", "class.focused": "this.focused" } }, queries: [{ propertyName: "toolbarTemplateRef", first: true, predicate: ["plaitToolbar"], descendants: true }], viewQueries: [{ propertyName: "svg", first: true, predicate: ["svg"], descendants: true, static: true }, { propertyName: "contentContainer", first: true, predicate: ["container"], descendants: true, read: ElementRef, static: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
1538
1559
|
<div class="container" #container>
|
|
1539
|
-
<svg #svg width="100%" height="100%" style="position: relative"></svg>
|
|
1560
|
+
<svg #svg width="100%" height="100%" style="position: relative;"></svg>
|
|
1540
1561
|
<plait-element
|
|
1541
1562
|
*ngFor="let item of board.children; let index = index; trackBy: trackBy"
|
|
1542
1563
|
[index]="index"
|
|
@@ -1565,7 +1586,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1565
1586
|
selector: 'plait-board',
|
|
1566
1587
|
template: `
|
|
1567
1588
|
<div class="container" #container>
|
|
1568
|
-
<svg #svg width="100%" height="100%" style="position: relative"></svg>
|
|
1589
|
+
<svg #svg width="100%" height="100%" style="position: relative;"></svg>
|
|
1569
1590
|
<plait-element
|
|
1570
1591
|
*ngFor="let item of board.children; let index = index; trackBy: trackBy"
|
|
1571
1592
|
[index]="index"
|
|
@@ -1648,5 +1669,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1648
1669
|
* Generated bundle index. Do not edit.
|
|
1649
1670
|
*/
|
|
1650
1671
|
|
|
1651
|
-
export { BOARD_TO_ON_CHANGE, BaseCursorStatus, CLIP_BOARD_FORMAT_KEY, FLUSHING, HOST_TO_ROUGH_SVG, IS_APPLE, IS_CHROME, IS_CHROME_LEGACY, IS_EDGE_LEGACY, IS_FIREFOX, IS_IOS, IS_SAFARI, IS_TEXT_EDITABLE, MERGING, NS, PLAIT_BOARD_TO_COMPONENT, Path, PlaitBoardComponent, PlaitElementComponent, PlaitHistoryBoard, PlaitModule, PlaitNode, PlaitOperation, PlaitToolbarComponent, SAVING, SCROLL_BAR_WIDTH, Transforms, Viewport, calculateBBox, calculateZoom, createG, createSVG, createText, distanceBetweenPointAndPoint, distanceBetweenPointAndSegment, getViewBox, getViewportClientBox, hotkeys, idCreator, inverse, invert, isNoSelectionElement, isNullOrUndefined, isSetViewportOperation, rotate, shouldClear, shouldMerge, shouldSave, toPoint, toRectangleClient, transformMat3, transformPoint, transformPoints, updateCursorStatus };
|
|
1672
|
+
export { BOARD_TO_ON_CHANGE, BaseCursorStatus, CLIP_BOARD_FORMAT_KEY, FLUSHING, HOST_TO_ROUGH_SVG, IS_APPLE, IS_CHROME, IS_CHROME_LEGACY, IS_EDGE_LEGACY, IS_FIREFOX, IS_IOS, IS_SAFARI, IS_TEXT_EDITABLE, MERGING, NS, PLAIT_BOARD_TO_COMPONENT, Path, PlaitBoardComponent, PlaitElementComponent, PlaitHistoryBoard, PlaitModule, PlaitNode, PlaitOperation, PlaitToolbarComponent, SAVING, SCROLL_BAR_WIDTH, Transforms, Viewport, calculateBBox, calculateZoom, createG, createSVG, createText, distanceBetweenPointAndPoint, distanceBetweenPointAndSegment, getViewBox, getViewportClientBox, hotkeys, idCreator, inverse, invert, isNoSelectionElement, isNullOrUndefined, isOutExtent, isSetViewportOperation, rotate, shouldClear, shouldMerge, shouldSave, toPoint, toRectangleClient, transformMat3, transformPoint, transformPoints, updateCursorStatus };
|
|
1652
1673
|
//# sourceMappingURL=plait-core.mjs.map
|