@node-projects/web-component-designer 0.1.90 → 0.1.92
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/assets/images/tools/PanTool.svg +5 -0
- package/config/elements-native.json +1 -0
- package/dist/elements/helper/ElementHelper.js +9 -4
- package/dist/elements/helper/SelectionHelper.d.ts +2 -0
- package/dist/elements/helper/SelectionHelper.js +51 -0
- package/dist/elements/helper/TransformHelper.js +5 -0
- package/dist/elements/item/DesignItem.d.ts +1 -0
- package/dist/elements/item/DesignItem.js +10 -0
- package/dist/elements/item/IDesignItem.d.ts +1 -0
- package/dist/elements/services/DefaultServiceBootstrap.js +1 -1
- package/dist/elements/services/dragDropService/DragDropService.js +1 -2
- package/dist/elements/services/placementService/AbsolutePlacementService.d.ts +19 -0
- package/dist/elements/services/placementService/AbsolutePlacementService.js +153 -0
- package/dist/elements/services/placementService/DefaultPlacementService copy.d.ts +19 -0
- package/dist/elements/services/placementService/DefaultPlacementService copy.js +151 -0
- package/dist/elements/services/placementService/DefaultPlacementService.d.ts +1 -1
- package/dist/elements/services/placementService/DefaultPlacementService.js +3 -1
- package/dist/elements/services/placementService/FlexBoxPlacementService.d.ts +1 -1
- package/dist/elements/services/placementService/FlexBoxPlacementService.js +1 -1
- package/dist/elements/services/placementService/GridPlacementService.d.ts +1 -1
- package/dist/elements/services/placementService/GridPlacementService.js +1 -1
- package/dist/elements/services/placementService/IPlacementService.d.ts +1 -1
- package/dist/elements/services/propertiesService/propertyEditors/FontPropertyEditor.d.ts +2 -1
- package/dist/elements/services/propertiesService/propertyEditors/FontPropertyEditor.js +9 -6
- package/dist/elements/widgets/designerView/IDesignerCanvas.d.ts +0 -1
- package/dist/elements/widgets/designerView/designerCanvas.d.ts +0 -1
- package/dist/elements/widgets/designerView/designerCanvas.js +0 -9
- package/dist/elements/widgets/designerView/extensions/AltToEnterContainerExtension.js +1 -1
- package/dist/elements/widgets/designerView/extensions/EditText/EditTextExtension.d.ts +2 -8
- package/dist/elements/widgets/designerView/extensions/EditText/EditTextExtension.js +60 -53
- package/dist/elements/widgets/designerView/extensions/EditText/EditTextExtensionProvider.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/EditText/EditTextExtensionProvider.js +5 -1
- package/dist/elements/widgets/designerView/extensions/ElementDragTitleExtension.js +3 -3
- package/dist/elements/widgets/designerView/extensions/ExtensionManager.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/ExtensionManager.js +15 -0
- package/dist/elements/widgets/designerView/extensions/ExtensionType.d.ts +2 -1
- package/dist/elements/widgets/designerView/extensions/ExtensionType.js +2 -1
- package/dist/elements/widgets/designerView/extensions/GrayOutExtension.d.ts +0 -2
- package/dist/elements/widgets/designerView/extensions/GrayOutExtension.js +6 -9
- package/dist/elements/widgets/designerView/extensions/IExtensionManger.d.ts +1 -0
- package/dist/elements/widgets/designerView/tools/PointerTool.d.ts +2 -1
- package/dist/elements/widgets/designerView/tools/PointerTool.js +26 -10
- package/dist/elements/widgets/designerView/tools/TextTool.js +3 -5
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/PointerToolButtonProvider.js +4 -1
- package/dist/elements/widgets/designerView/tools/toolBar/popups/AbstractBaseToolPopup.d.ts +5 -0
- package/dist/elements/widgets/designerView/tools/toolBar/popups/AbstractBaseToolPopup.js +37 -0
- package/dist/elements/widgets/designerView/tools/toolBar/popups/DrawToolPopup.d.ts +3 -3
- package/dist/elements/widgets/designerView/tools/toolBar/popups/DrawToolPopup.js +6 -33
- package/dist/elements/widgets/designerView/tools/toolBar/popups/PointerToolPopup copy.d.ts +6 -0
- package/dist/elements/widgets/designerView/tools/toolBar/popups/PointerToolPopup copy.js +49 -0
- package/dist/elements/widgets/designerView/tools/toolBar/popups/PointerToolPopup.d.ts +4 -0
- package/dist/elements/widgets/designerView/tools/toolBar/popups/PointerToolPopup.js +16 -0
- package/dist/elements/widgets/designerView/tools/toolBar/popups/SelectionToolPopup copy.d.ts +6 -0
- package/dist/elements/widgets/designerView/tools/toolBar/popups/SelectionToolPopup copy.js +49 -0
- package/dist/elements/widgets/designerView/tools/toolBar/popups/SelectionToolPopup.d.ts +2 -4
- package/dist/elements/widgets/designerView/tools/toolBar/popups/SelectionToolPopup.js +3 -36
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/package.json +24 -24
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<svg width="800px" height="800px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="M20.206 21.427l.185.573h-.566l-.187-.603-.063-.171c-.203-.545-.433-.775-.433-1.265a44.468 44.468 0 0 0 .195-4.722c-.056-.762-.025-1.491-.1-2.076-.062-.495-.112-.885-.112-1.09a7.746 7.746 0 0 0-.405-2.233 1.544 1.544 0 0 0-.805-1.014 2.121 2.121 0 0 0-.68-.12c-.396 0-.408.084-.3.764.047.293.108.66.118.703.198.872.3 1.204.07 1.204-.146 0-.47-.172-.5-.372-.012-.086-.331-1.839-.371-2.08A2.883 2.883 0 0 0 15.8 7.8a1.195 1.195 0 0 0-.841-.503.712.712 0 0 0-.646.198 1.77 1.77 0 0 0-.169.283c.014.003.118.535.214.852.097.319.271 1.548.357 1.676a.994.994 0 0 1 .15.645.147.147 0 0 1-.099.061 1.18 1.18 0 0 1-.53-.364c-.122-.156-.273-1.43-.426-1.89-.04-.12-.085-.272-.134-.435a5.147 5.147 0 0 0-.444-1.185 1.394 1.394 0 0 0-.835-.432.869.869 0 0 0-.829.344 1.363 1.363 0 0 0-.246.834 8.518 8.518 0 0 0 .164 1.391l.045.202a6.999 6.999 0 0 0 .401 1.204.174.174 0 0 1 .015.13c-.056.112-.275.116-.299.116a.301.301 0 0 1-.205-.062 7.393 7.393 0 0 1-.473-1.383c-.12-.533-.304-1.681-.645-1.748a1.285 1.285 0 0 0-.254-.025 1.023 1.023 0 0 0-.654.212 2.389 2.389 0 0 0-.742.998 5.79 5.79 0 0 0 .1 1.77c.712 2.656.774 2.617.796 2.788a2.123 2.123 0 0 0 .1.67c.07.203.233.645.251.696a1.967 1.967 0 0 1-.119.753l-.038.154a5.276 5.276 0 0 0-.114.624.082.082 0 0 1-.147.065 1.197 1.197 0 0 1-.241-.65 1.413 1.413 0 0 1 .071-.297.772.772 0 0 0 .043-.522 4.079 4.079 0 0 0-.163-.39 3.069 3.069 0 0 1-.145-.354 1.953 1.953 0 0 1-.067-.336 2.628 2.628 0 0 0-.16-.64 7.251 7.251 0 0 1-.229-.869 12.474 12.474 0 0 0-.287-1.431.685.685 0 0 0-.5-.282.642.642 0 0 0-.23.047.372.372 0 0 0-.205.377 36.57 36.57 0 0 0-.127 1.393.365.365 0 0 1-.071.192.407.407 0 0 0-.06.13 34.4 34.4 0 0 1-.385 1.269l-.08.256c-.032.105-.08.224-.129.347-.135.34-.303.761-.186.977a9.522 9.522 0 0 0 1.087 1.495 6.62 6.62 0 0 1 .57.65c.137.17.273.337.386.46a4.675 4.675 0 0 0 1.004.664c.131.074.252.14.342.196.112.069.265.178.442.305a11.3 11.3 0 0 0 .994.662c.124.071.188.101.376.196.569.28 1.336.705 1.609.85A3.88 3.88 0 0 1 14 22h-.717s-.341-.272-.756-.573a10.113 10.113 0 0 0-1.21-.658l-.18-.088a9.9 9.9 0 0 1-1.25-.8c-.185-.133-.325-.235-.43-.3-.06-.037-.32-.183-.32-.183a4.96 4.96 0 0 1-1.139-.77 8.711 8.711 0 0 1-.367-.434 7.55 7.55 0 0 0-.554-.64 9.849 9.849 0 0 1-1.202-1.64 1.73 1.73 0 0 1 .16-1.431 5.91 5.91 0 0 0 .115-.312l.061-.194c.1-.32.367-1.169.39-1.278a.976.976 0 0 1 .127-.302c.011-.164.069-.876.12-1.311a.913.913 0 0 1 .547-.874 1.185 1.185 0 0 1 .429-.086 1.043 1.043 0 0 1 .34.057 5.276 5.276 0 0 1-.03-1.314 2.742 2.742 0 0 1 .94-1.367 1.609 1.609 0 0 1 .988-.365 1.117 1.117 0 0 1 .47.097.84.84 0 0 1 .283.232 2.171 2.171 0 0 1 .283-.684 1.372 1.372 0 0 1 1.299-.617 1.872 1.872 0 0 1 1.258.634 1.617 1.617 0 0 1 .214.392 1.234 1.234 0 0 1 1.165-.43 1.741 1.741 0 0 1 1.218.74 4.562 4.562 0 0 1 .343.756.98.98 0 0 1 .64-.192 2.63 2.63 0 0 1 .905.17 2.235 2.235 0 0 1 1.087 1.413 8.22 8.22 0 0 1 .44 2.423c0 .17.048.55.11 1.026.08.631.045 1.349.1 2.103a41.59 41.59 0 0 1-.196 4.81 7.328 7.328 0 0 0 .502 1.353l.023.064z"/>
|
|
4
|
+
<path fill="none" d="M0 0h24v24H0z"/>
|
|
5
|
+
</svg>
|
|
@@ -31,6 +31,8 @@ export function isInlineAfter(element) {
|
|
|
31
31
|
export function getElementDisplaytype(element) {
|
|
32
32
|
if (element instanceof SVGElement)
|
|
33
33
|
return ElementDisplayType.block;
|
|
34
|
+
if (element instanceof MathMLElement)
|
|
35
|
+
return ElementDisplayType.block;
|
|
34
36
|
const display = window.getComputedStyle(element).display;
|
|
35
37
|
return display == 'none' ? ElementDisplayType.none : display.startsWith('inline') ? ElementDisplayType.inline : ElementDisplayType.block;
|
|
36
38
|
}
|
|
@@ -76,11 +78,14 @@ export function getElementsWindowOffsetWithoutSelfAndParentTransformations(eleme
|
|
|
76
78
|
break;
|
|
77
79
|
}
|
|
78
80
|
let nextParent = element.offsetParent ? element.offsetParent : element.getRootNode().host;
|
|
79
|
-
if (element instanceof
|
|
81
|
+
if (element instanceof SVGSVGElement || element instanceof HTMLBodyElement || element instanceof HTMLHtmlElement) {
|
|
82
|
+
nextParent = element.parentElement ? element.parentElement : element.getRootNode().host;
|
|
83
|
+
}
|
|
84
|
+
else if (element instanceof SVGGraphicsElement) {
|
|
80
85
|
nextParent = element.ownerSVGElement;
|
|
81
86
|
}
|
|
82
|
-
else if (element instanceof
|
|
83
|
-
nextParent = element.parentElement
|
|
87
|
+
else if (element instanceof MathMLElement) {
|
|
88
|
+
nextParent = element.parentElement;
|
|
84
89
|
}
|
|
85
90
|
let scrollLeft = 0;
|
|
86
91
|
let scrollTop = 0;
|
|
@@ -90,7 +95,7 @@ export function getElementsWindowOffsetWithoutSelfAndParentTransformations(eleme
|
|
|
90
95
|
}
|
|
91
96
|
let currLeft = 0;
|
|
92
97
|
let currTop = 0;
|
|
93
|
-
if (element instanceof SVGSVGElement) {
|
|
98
|
+
if (element instanceof SVGSVGElement || element instanceof MathMLElement) {
|
|
94
99
|
//TODO: !huge Perf impact! - fix without transformation
|
|
95
100
|
let t = element.style.transform;
|
|
96
101
|
element.style.transform = '';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export function shadowrootGetSelection(shadowRoot) {
|
|
2
|
+
let selection = document.getSelection();
|
|
3
|
+
if (selection.getComposedRanges)
|
|
4
|
+
selection = selection.getComposedRanges(shadowRoot);
|
|
5
|
+
else if (shadowRoot.getSelection)
|
|
6
|
+
selection = shadowRoot.getSelection();
|
|
7
|
+
return selection;
|
|
8
|
+
}
|
|
9
|
+
function wrapTextNodesInSpan(range, spans) {
|
|
10
|
+
function wrapNode(node) {
|
|
11
|
+
const span = document.createElement('span');
|
|
12
|
+
spans.push(span);
|
|
13
|
+
node.parentNode.insertBefore(span, node);
|
|
14
|
+
span.appendChild(node);
|
|
15
|
+
}
|
|
16
|
+
function processNode(node) {
|
|
17
|
+
switch (node.nodeType) {
|
|
18
|
+
case Node.TEXT_NODE:
|
|
19
|
+
wrapNode(node);
|
|
20
|
+
break;
|
|
21
|
+
case Node.DOCUMENT_FRAGMENT_NODE:
|
|
22
|
+
case Node.ELEMENT_NODE:
|
|
23
|
+
Array.from(node.childNodes).forEach(processNode);
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const fragment = range.extractContents();
|
|
28
|
+
processNode(fragment);
|
|
29
|
+
range.insertNode(fragment);
|
|
30
|
+
}
|
|
31
|
+
function staticRangeToRange(staticRange) {
|
|
32
|
+
const range = document.createRange();
|
|
33
|
+
range.setStart(staticRange.startContainer, staticRange.startOffset);
|
|
34
|
+
range.setEnd(staticRange.endContainer, staticRange.endOffset);
|
|
35
|
+
return range;
|
|
36
|
+
}
|
|
37
|
+
export function wrapSelectionInSpans(selection) {
|
|
38
|
+
const spans = [];
|
|
39
|
+
if (selection[0] instanceof StaticRange) {
|
|
40
|
+
wrapTextNodesInSpan(staticRangeToRange(selection[0]), spans);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
if (!selection.rangeCount)
|
|
44
|
+
return spans;
|
|
45
|
+
const range = selection.getRangeAt(0);
|
|
46
|
+
wrapTextNodesInSpan(range, spans);
|
|
47
|
+
}
|
|
48
|
+
if (selection.removeAllRanges)
|
|
49
|
+
selection.removeAllRanges();
|
|
50
|
+
return spans;
|
|
51
|
+
}
|
|
@@ -196,6 +196,11 @@ export function getElementSize(element) {
|
|
|
196
196
|
width = bbox.width;
|
|
197
197
|
height = bbox.height;
|
|
198
198
|
}
|
|
199
|
+
else if (element instanceof MathMLElement) {
|
|
200
|
+
let bbox = element.getBoundingClientRect();
|
|
201
|
+
width = bbox.width;
|
|
202
|
+
height = bbox.height;
|
|
203
|
+
}
|
|
199
204
|
return { width, height };
|
|
200
205
|
}
|
|
201
206
|
export function getDesignerCanvasNormalizedTransformedCornerDOMPoints(element, untransformedCornerPointsOffset, designerCanvas, cache) {
|
|
@@ -74,6 +74,7 @@ export declare class DesignItem implements IDesignItem {
|
|
|
74
74
|
set lockAtDesignTime(value: boolean);
|
|
75
75
|
static createDesignItemFromInstance(node: Node, serviceContainer: ServiceContainer, instanceServiceContainer: InstanceServiceContainer): DesignItem;
|
|
76
76
|
querySelectorAll(selectors: string): NodeListOf<HTMLElement>;
|
|
77
|
+
removeDesignerAttributesAndStylesFromChildren(): void;
|
|
77
78
|
updateChildrenFromNodesChildren(): void;
|
|
78
79
|
constructor(node: Node, parsedNode: any, serviceContainer: ServiceContainer, instanceServiceContainer: InstanceServiceContainer);
|
|
79
80
|
setView(node: Element): void;
|
|
@@ -351,6 +351,16 @@ export class DesignItem {
|
|
|
351
351
|
return this.element.querySelectorAll(selectors);
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
+
removeDesignerAttributesAndStylesFromChildren() {
|
|
355
|
+
const els = this.querySelectorAll('*');
|
|
356
|
+
for (let e of els) {
|
|
357
|
+
const di = DesignItem.GetDesignItem(e);
|
|
358
|
+
if (!di.hasAttribute("draggable"))
|
|
359
|
+
e.removeAttribute("draggable");
|
|
360
|
+
if (!di.hasStyle("pointer-events"))
|
|
361
|
+
e.style.pointerEvents = '';
|
|
362
|
+
}
|
|
363
|
+
}
|
|
354
364
|
updateChildrenFromNodesChildren() {
|
|
355
365
|
this._childArray = [];
|
|
356
366
|
if (this.nodeType == NodeType.Element) {
|
|
@@ -39,6 +39,7 @@ export interface IDesignItem {
|
|
|
39
39
|
removeChild(designItem: IDesignItem): any;
|
|
40
40
|
remove(): any;
|
|
41
41
|
clearChildren(): any;
|
|
42
|
+
removeDesignerAttributesAndStylesFromChildren(): any;
|
|
42
43
|
updateChildrenFromNodesChildren(): any;
|
|
43
44
|
readonly hasContent: boolean;
|
|
44
45
|
content: string;
|
|
@@ -121,7 +121,7 @@ export function createDefaultServiceContainer() {
|
|
|
121
121
|
]);
|
|
122
122
|
serviceContainer.designerExtensions.set(ExtensionType.PrimarySelection, [
|
|
123
123
|
new ElementDragTitleExtensionProvider(),
|
|
124
|
-
new TransformOriginExtensionProvider(),
|
|
124
|
+
new TransformOriginExtensionProvider(true),
|
|
125
125
|
new CanvasExtensionProvider(),
|
|
126
126
|
new PositionExtensionProvider(),
|
|
127
127
|
new EllipsisExtensionProvider(),
|
|
@@ -40,9 +40,8 @@ export class DragDropService {
|
|
|
40
40
|
const elementDefinition = JSON.parse(transferData);
|
|
41
41
|
const di = await designerCanvas.serviceContainer.forSomeServicesTillResult("instanceService", (service) => service.getElement(elementDefinition, designerCanvas.serviceContainer, designerCanvas.instanceServiceContainer));
|
|
42
42
|
const grp = di.openGroup("Insert of <" + di.name + ">");
|
|
43
|
-
di.setStyle('position', 'absolute');
|
|
44
43
|
const containerService = designerCanvas.serviceContainer.getLastServiceWhere('containerService', x => x.serviceForContainer(newContainer, newContainer.getComputedStyle()));
|
|
45
|
-
containerService.enterContainer(newContainer, [di]);
|
|
44
|
+
containerService.enterContainer(newContainer, [di], 'drop');
|
|
46
45
|
const containerPos = designerCanvas.getNormalizedElementCoordinates(newContainer.element);
|
|
47
46
|
const evCoord = designerCanvas.getNormalizedEventCoordinates(event);
|
|
48
47
|
const pos = { x: evCoord.x - containerPos.x, y: evCoord.y - containerPos.y };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { IPoint } from '../../../interfaces/IPoint.js';
|
|
2
|
+
import type { IPlacementService } from './IPlacementService.js';
|
|
3
|
+
import type { IDesignItem } from '../../item/IDesignItem.js';
|
|
4
|
+
import { IPlacementView } from '../../widgets/designerView/IPlacementView.js';
|
|
5
|
+
export declare class AbsolutePlacementService implements IPlacementService {
|
|
6
|
+
serviceForContainer(container: IDesignItem, containerStyle: CSSStyleDeclaration): boolean;
|
|
7
|
+
isEnterableContainer(container: IDesignItem): boolean;
|
|
8
|
+
canEnter(container: IDesignItem, items: IDesignItem[]): boolean;
|
|
9
|
+
canLeave(container: IDesignItem, items: IDesignItem[]): boolean;
|
|
10
|
+
getElementOffset(container: IDesignItem, designItem?: IDesignItem): IPoint;
|
|
11
|
+
private calculateTrack;
|
|
12
|
+
placePoint(event: MouseEvent, placementView: IPlacementView, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): IPoint;
|
|
13
|
+
startPlace(event: MouseEvent, placementView: IPlacementView, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): void;
|
|
14
|
+
place(event: MouseEvent, placementView: IPlacementView, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): void;
|
|
15
|
+
moveElements(designItems: IDesignItem[], position: IPoint, absolute: boolean): void;
|
|
16
|
+
enterContainer(container: IDesignItem, items: IDesignItem[], mode: 'normal' | 'drop'): void;
|
|
17
|
+
leaveContainer(container: IDesignItem, items: IDesignItem[]): void;
|
|
18
|
+
finishPlace(event: MouseEvent, placementView: IPlacementView, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { DomConverter } from '../../widgets/designerView/DomConverter.js';
|
|
2
|
+
import { combineTransforms, extractTranslationFromDOMMatrix, getResultingTransformationBetweenElementAndAllAncestors } from '../../helper/TransformHelper.js';
|
|
3
|
+
import { filterChildPlaceItems, getDesignItemCurrentPos, placeDesignItem } from '../../helper/LayoutHelper.js';
|
|
4
|
+
import { ExtensionType } from '../../widgets/designerView/extensions/ExtensionType.js';
|
|
5
|
+
import { straightenLine } from '../../helper/PathDataPolyfill.js';
|
|
6
|
+
export class AbsolutePlacementService {
|
|
7
|
+
serviceForContainer(container, containerStyle) {
|
|
8
|
+
if (containerStyle.display === 'grid' || containerStyle.display === 'inline-grid' ||
|
|
9
|
+
containerStyle.display === 'flex' || containerStyle.display === 'inline-flex')
|
|
10
|
+
return false;
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
isEnterableContainer(container) {
|
|
14
|
+
if (DomConverter.IsSelfClosingElement(container.element.localName))
|
|
15
|
+
return false;
|
|
16
|
+
if (!container.isRootItem && container.element.shadowRoot && container.element.shadowRoot.querySelector('slot') == null)
|
|
17
|
+
return false;
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
canEnter(container, items) {
|
|
21
|
+
if (!this.isEnterableContainer(container))
|
|
22
|
+
return false;
|
|
23
|
+
if (!items.every(x => !x.element.contains(container.element) && x !== container))
|
|
24
|
+
return false;
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
canLeave(container, items) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
getElementOffset(container, designItem) {
|
|
31
|
+
return container.instanceServiceContainer.designerCanvas.getNormalizedElementCoordinates(container.element);
|
|
32
|
+
}
|
|
33
|
+
calculateTrack(event, placementView, startPoint, offsetInControl, newPoint, item) {
|
|
34
|
+
let trackX = newPoint.x - startPoint.x;
|
|
35
|
+
let trackY = newPoint.y - startPoint.y;
|
|
36
|
+
if (!event.ctrlKey) {
|
|
37
|
+
if (placementView.alignOnGrid) {
|
|
38
|
+
let p = getDesignItemCurrentPos(item, 'position');
|
|
39
|
+
p.x = p.x % placementView.gridSize;
|
|
40
|
+
p.y = p.y % placementView.gridSize;
|
|
41
|
+
trackX = Math.round(trackX / placementView.gridSize) * placementView.gridSize - p.x;
|
|
42
|
+
trackY = Math.round(trackY / placementView.gridSize) * placementView.gridSize - p.y;
|
|
43
|
+
}
|
|
44
|
+
else if (placementView.alignOnSnap) {
|
|
45
|
+
let rect = item.element.getBoundingClientRect();
|
|
46
|
+
let newPos = placementView.snapLines.snapToPosition({ x: (newPoint.x - offsetInControl.x), y: (newPoint.y - offsetInControl.y) }, { width: rect.width / placementView.scaleFactor, height: rect.height / placementView.scaleFactor }, { x: trackX > 0 ? 1 : -1, y: trackY > 0 ? 1 : -1 });
|
|
47
|
+
if (newPos.x !== null) {
|
|
48
|
+
trackX = newPos.x - Math.round(startPoint.x) + Math.round(offsetInControl.x);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
trackX = Math.round(trackX);
|
|
52
|
+
}
|
|
53
|
+
if (newPos.y !== null) {
|
|
54
|
+
trackY = newPos.y - Math.round(startPoint.y) + Math.round(offsetInControl.y);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
trackY = Math.round(trackY);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return { x: trackX, y: trackY };
|
|
62
|
+
}
|
|
63
|
+
placePoint(event, placementView, container, startPoint, offsetInControl, newPoint, items) {
|
|
64
|
+
let trackX = newPoint.x;
|
|
65
|
+
let trackY = newPoint.y;
|
|
66
|
+
if (!event.ctrlKey) {
|
|
67
|
+
if (placementView.alignOnGrid) {
|
|
68
|
+
trackX = Math.round(trackX / placementView.gridSize) * placementView.gridSize;
|
|
69
|
+
trackY = Math.round(trackY / placementView.gridSize) * placementView.gridSize;
|
|
70
|
+
}
|
|
71
|
+
else if (placementView.alignOnSnap) {
|
|
72
|
+
let newPos = placementView.snapLines.snapToPosition({ x: newPoint.x - offsetInControl.x, y: newPoint.y - offsetInControl.y }, null, { x: trackX > 0 ? 1 : -1, y: trackY > 0 ? 1 : -1 });
|
|
73
|
+
if (newPos.x !== null) {
|
|
74
|
+
trackX = newPos.x;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
trackX = Math.round(trackX);
|
|
78
|
+
}
|
|
79
|
+
if (newPos.y !== null) {
|
|
80
|
+
trackY = newPos.y;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
trackY = Math.round(trackY);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return { x: trackX, y: trackY };
|
|
88
|
+
}
|
|
89
|
+
startPlace(event, placementView, container, startPoint, offsetInControl, newPoint, items) {
|
|
90
|
+
}
|
|
91
|
+
place(event, placementView, container, startPoint, offsetInControl, newPoint, items) {
|
|
92
|
+
//TODO: this should revert all undo actions while active
|
|
93
|
+
//maybe a undo actions returns itself or an id so it could be changed?
|
|
94
|
+
let track = this.calculateTrack(event, placementView, startPoint, offsetInControl, newPoint, items[0]);
|
|
95
|
+
if (event.shiftKey) {
|
|
96
|
+
track = straightenLine({ x: 0, y: 0 }, track, true);
|
|
97
|
+
}
|
|
98
|
+
let filteredItems = filterChildPlaceItems(items);
|
|
99
|
+
for (const designItem of filteredItems) {
|
|
100
|
+
const canvas = designItem.instanceServiceContainer.designerCanvas.rootDesignItem.element;
|
|
101
|
+
let originalElementAndAllAncestorsMultipliedMatrix = getResultingTransformationBetweenElementAndAllAncestors(designItem.parent.element, canvas, true);
|
|
102
|
+
let transformMatrixParentTransformsCompensated = null;
|
|
103
|
+
if (originalElementAndAllAncestorsMultipliedMatrix) {
|
|
104
|
+
transformMatrixParentTransformsCompensated = new DOMPoint(track.x, track.y, 0, 0).matrixTransform(originalElementAndAllAncestorsMultipliedMatrix.inverse());
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
transformMatrixParentTransformsCompensated = new DOMPoint(track.x, track.y, 0, 0);
|
|
108
|
+
}
|
|
109
|
+
const translationMatrix = new DOMMatrix().translate(transformMatrixParentTransformsCompensated.x, transformMatrixParentTransformsCompensated.y);
|
|
110
|
+
combineTransforms(designItem.element, designItem.getStyle('transform'), translationMatrix.toString());
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
moveElements(designItems, position, absolute) {
|
|
114
|
+
//TODO: Check if we set left or right
|
|
115
|
+
//TODO: Use CSS units
|
|
116
|
+
for (let d of designItems) {
|
|
117
|
+
if (position.x)
|
|
118
|
+
d.setStyle('left', parseInt(d.element.style.left) - position.x + 'px');
|
|
119
|
+
if (position.y)
|
|
120
|
+
d.setStyle('top', parseInt(d.element.style.top) - position.y + 'px');
|
|
121
|
+
}
|
|
122
|
+
designItems[0].instanceServiceContainer.designerCanvas.extensionManager.refreshExtensions(designItems);
|
|
123
|
+
}
|
|
124
|
+
enterContainer(container, items, mode) {
|
|
125
|
+
let filterdItems = filterChildPlaceItems(items);
|
|
126
|
+
for (let i of filterdItems) {
|
|
127
|
+
if (mode == 'drop')
|
|
128
|
+
i.setStyle('position', 'absolute');
|
|
129
|
+
container.insertChild(i);
|
|
130
|
+
if (i.lastContainerSize) {
|
|
131
|
+
if (!i.hasStyle('width'))
|
|
132
|
+
i.setStyle('width', i.lastContainerSize.width + 'px');
|
|
133
|
+
if (!i.hasStyle('height'))
|
|
134
|
+
i.setStyle('height', i.lastContainerSize.height + 'px');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
leaveContainer(container, items) {
|
|
139
|
+
}
|
|
140
|
+
finishPlace(event, placementView, container, startPoint, offsetInControl, newPoint, items) {
|
|
141
|
+
let filterdItems = filterChildPlaceItems(items);
|
|
142
|
+
for (const designItem of filterdItems) {
|
|
143
|
+
let translation = extractTranslationFromDOMMatrix(new DOMMatrix(designItem.element.style.transform));
|
|
144
|
+
const stylesMapOffset = extractTranslationFromDOMMatrix(new DOMMatrix(designItem.getStyle('transform') ?? ''));
|
|
145
|
+
designItem.element.style.transform = designItem.getStyle('transform') ?? '';
|
|
146
|
+
let track = { x: translation.x, y: translation.y };
|
|
147
|
+
placeDesignItem(container, designItem, { x: track.x - stylesMapOffset.x, y: track.y - stylesMapOffset.y }, 'position');
|
|
148
|
+
}
|
|
149
|
+
for (const item of items) {
|
|
150
|
+
placementView.extensionManager.removeExtension(item, ExtensionType.Placement);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { IPoint } from '../../../interfaces/IPoint.js';
|
|
2
|
+
import type { IPlacementService } from './IPlacementService.js';
|
|
3
|
+
import type { IDesignItem } from '../../item/IDesignItem.js';
|
|
4
|
+
import { IPlacementView } from '../../widgets/designerView/IPlacementView.js';
|
|
5
|
+
export declare class DefaultPlacementService implements IPlacementService {
|
|
6
|
+
serviceForContainer(container: IDesignItem, containerStyle: CSSStyleDeclaration): boolean;
|
|
7
|
+
isEnterableContainer(container: IDesignItem): boolean;
|
|
8
|
+
canEnter(container: IDesignItem, items: IDesignItem[]): boolean;
|
|
9
|
+
canLeave(container: IDesignItem, items: IDesignItem[]): boolean;
|
|
10
|
+
getElementOffset(container: IDesignItem, designItem?: IDesignItem): IPoint;
|
|
11
|
+
private calculateTrack;
|
|
12
|
+
placePoint(event: MouseEvent, placementView: IPlacementView, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): IPoint;
|
|
13
|
+
startPlace(event: MouseEvent, placementView: IPlacementView, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): void;
|
|
14
|
+
place(event: MouseEvent, placementView: IPlacementView, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): void;
|
|
15
|
+
moveElements(designItems: IDesignItem[], position: IPoint, absolute: boolean): void;
|
|
16
|
+
enterContainer(container: IDesignItem, items: IDesignItem[]): void;
|
|
17
|
+
leaveContainer(container: IDesignItem, items: IDesignItem[]): void;
|
|
18
|
+
finishPlace(event: MouseEvent, placementView: IPlacementView, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { DomConverter } from '../../widgets/designerView/DomConverter.js';
|
|
2
|
+
import { combineTransforms, extractTranslationFromDOMMatrix, getResultingTransformationBetweenElementAndAllAncestors } from '../../helper/TransformHelper.js';
|
|
3
|
+
import { filterChildPlaceItems, getDesignItemCurrentPos, placeDesignItem } from '../../helper/LayoutHelper.js';
|
|
4
|
+
import { ExtensionType } from '../../widgets/designerView/extensions/ExtensionType.js';
|
|
5
|
+
import { straightenLine } from '../../helper/PathDataPolyfill.js';
|
|
6
|
+
export class DefaultPlacementService {
|
|
7
|
+
serviceForContainer(container, containerStyle) {
|
|
8
|
+
if (containerStyle.display === 'grid' || containerStyle.display === 'inline-grid' ||
|
|
9
|
+
containerStyle.display === 'flex' || containerStyle.display === 'inline-flex')
|
|
10
|
+
return false;
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
isEnterableContainer(container) {
|
|
14
|
+
if (DomConverter.IsSelfClosingElement(container.element.localName))
|
|
15
|
+
return false;
|
|
16
|
+
if (!container.isRootItem && container.element.shadowRoot && container.element.shadowRoot.querySelector('slot') == null)
|
|
17
|
+
return false;
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
canEnter(container, items) {
|
|
21
|
+
if (!this.isEnterableContainer(container))
|
|
22
|
+
return false;
|
|
23
|
+
if (!items.every(x => !x.element.contains(container.element) && x !== container))
|
|
24
|
+
return false;
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
canLeave(container, items) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
getElementOffset(container, designItem) {
|
|
31
|
+
return container.instanceServiceContainer.designerCanvas.getNormalizedElementCoordinates(container.element);
|
|
32
|
+
}
|
|
33
|
+
calculateTrack(event, placementView, startPoint, offsetInControl, newPoint, item) {
|
|
34
|
+
let trackX = newPoint.x - startPoint.x;
|
|
35
|
+
let trackY = newPoint.y - startPoint.y;
|
|
36
|
+
if (!event.ctrlKey) {
|
|
37
|
+
if (placementView.alignOnGrid) {
|
|
38
|
+
let p = getDesignItemCurrentPos(item, 'position');
|
|
39
|
+
p.x = p.x % placementView.gridSize;
|
|
40
|
+
p.y = p.y % placementView.gridSize;
|
|
41
|
+
trackX = Math.round(trackX / placementView.gridSize) * placementView.gridSize - p.x;
|
|
42
|
+
trackY = Math.round(trackY / placementView.gridSize) * placementView.gridSize - p.y;
|
|
43
|
+
}
|
|
44
|
+
else if (placementView.alignOnSnap) {
|
|
45
|
+
let rect = item.element.getBoundingClientRect();
|
|
46
|
+
let newPos = placementView.snapLines.snapToPosition({ x: (newPoint.x - offsetInControl.x), y: (newPoint.y - offsetInControl.y) }, { width: rect.width / placementView.scaleFactor, height: rect.height / placementView.scaleFactor }, { x: trackX > 0 ? 1 : -1, y: trackY > 0 ? 1 : -1 });
|
|
47
|
+
if (newPos.x !== null) {
|
|
48
|
+
trackX = newPos.x - Math.round(startPoint.x) + Math.round(offsetInControl.x);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
trackX = Math.round(trackX);
|
|
52
|
+
}
|
|
53
|
+
if (newPos.y !== null) {
|
|
54
|
+
trackY = newPos.y - Math.round(startPoint.y) + Math.round(offsetInControl.y);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
trackY = Math.round(trackY);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return { x: trackX, y: trackY };
|
|
62
|
+
}
|
|
63
|
+
placePoint(event, placementView, container, startPoint, offsetInControl, newPoint, items) {
|
|
64
|
+
let trackX = newPoint.x;
|
|
65
|
+
let trackY = newPoint.y;
|
|
66
|
+
if (!event.ctrlKey) {
|
|
67
|
+
if (placementView.alignOnGrid) {
|
|
68
|
+
trackX = Math.round(trackX / placementView.gridSize) * placementView.gridSize;
|
|
69
|
+
trackY = Math.round(trackY / placementView.gridSize) * placementView.gridSize;
|
|
70
|
+
}
|
|
71
|
+
else if (placementView.alignOnSnap) {
|
|
72
|
+
let newPos = placementView.snapLines.snapToPosition({ x: newPoint.x - offsetInControl.x, y: newPoint.y - offsetInControl.y }, null, { x: trackX > 0 ? 1 : -1, y: trackY > 0 ? 1 : -1 });
|
|
73
|
+
if (newPos.x !== null) {
|
|
74
|
+
trackX = newPos.x;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
trackX = Math.round(trackX);
|
|
78
|
+
}
|
|
79
|
+
if (newPos.y !== null) {
|
|
80
|
+
trackY = newPos.y;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
trackY = Math.round(trackY);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return { x: trackX, y: trackY };
|
|
88
|
+
}
|
|
89
|
+
startPlace(event, placementView, container, startPoint, offsetInControl, newPoint, items) {
|
|
90
|
+
}
|
|
91
|
+
place(event, placementView, container, startPoint, offsetInControl, newPoint, items) {
|
|
92
|
+
//TODO: this should revert all undo actions while active
|
|
93
|
+
//maybe a undo actions returns itself or an id so it could be changed?
|
|
94
|
+
let track = this.calculateTrack(event, placementView, startPoint, offsetInControl, newPoint, items[0]);
|
|
95
|
+
if (event.shiftKey) {
|
|
96
|
+
track = straightenLine({ x: 0, y: 0 }, track, true);
|
|
97
|
+
}
|
|
98
|
+
let filteredItems = filterChildPlaceItems(items);
|
|
99
|
+
for (const designItem of filteredItems) {
|
|
100
|
+
const canvas = designItem.instanceServiceContainer.designerCanvas.rootDesignItem.element;
|
|
101
|
+
let originalElementAndAllAncestorsMultipliedMatrix = getResultingTransformationBetweenElementAndAllAncestors(designItem.parent.element, canvas, true);
|
|
102
|
+
let transformMatrixParentTransformsCompensated = null;
|
|
103
|
+
if (originalElementAndAllAncestorsMultipliedMatrix) {
|
|
104
|
+
transformMatrixParentTransformsCompensated = new DOMPoint(track.x, track.y, 0, 0).matrixTransform(originalElementAndAllAncestorsMultipliedMatrix.inverse());
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
transformMatrixParentTransformsCompensated = new DOMPoint(track.x, track.y, 0, 0);
|
|
108
|
+
}
|
|
109
|
+
const translationMatrix = new DOMMatrix().translate(transformMatrixParentTransformsCompensated.x, transformMatrixParentTransformsCompensated.y);
|
|
110
|
+
combineTransforms(designItem.element, designItem.getStyle('transform'), translationMatrix.toString());
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
moveElements(designItems, position, absolute) {
|
|
114
|
+
//TODO: Check if we set left or right
|
|
115
|
+
//TODO: Use CSS units
|
|
116
|
+
for (let d of designItems) {
|
|
117
|
+
if (position.x)
|
|
118
|
+
d.setStyle('left', parseInt(d.element.style.left) - position.x + 'px');
|
|
119
|
+
if (position.y)
|
|
120
|
+
d.setStyle('top', parseInt(d.element.style.top) - position.y + 'px');
|
|
121
|
+
}
|
|
122
|
+
designItems[0].instanceServiceContainer.designerCanvas.extensionManager.refreshExtensions(designItems);
|
|
123
|
+
}
|
|
124
|
+
enterContainer(container, items) {
|
|
125
|
+
let filterdItems = filterChildPlaceItems(items);
|
|
126
|
+
for (let i of filterdItems) {
|
|
127
|
+
container.insertChild(i);
|
|
128
|
+
if (i.lastContainerSize) {
|
|
129
|
+
if (!i.hasStyle('width'))
|
|
130
|
+
i.setStyle('width', i.lastContainerSize.width + 'px');
|
|
131
|
+
if (!i.hasStyle('height'))
|
|
132
|
+
i.setStyle('height', i.lastContainerSize.height + 'px');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
leaveContainer(container, items) {
|
|
137
|
+
}
|
|
138
|
+
finishPlace(event, placementView, container, startPoint, offsetInControl, newPoint, items) {
|
|
139
|
+
let filterdItems = filterChildPlaceItems(items);
|
|
140
|
+
for (const designItem of filterdItems) {
|
|
141
|
+
let translation = extractTranslationFromDOMMatrix(new DOMMatrix(designItem.element.style.transform));
|
|
142
|
+
const stylesMapOffset = extractTranslationFromDOMMatrix(new DOMMatrix(designItem.getStyle('transform') ?? ''));
|
|
143
|
+
designItem.element.style.transform = designItem.getStyle('transform') ?? '';
|
|
144
|
+
let track = { x: translation.x, y: translation.y };
|
|
145
|
+
placeDesignItem(container, designItem, { x: track.x - stylesMapOffset.x, y: track.y - stylesMapOffset.y }, 'position');
|
|
146
|
+
}
|
|
147
|
+
for (const item of items) {
|
|
148
|
+
placementView.extensionManager.removeExtension(item, ExtensionType.Placement);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -13,7 +13,7 @@ export declare class DefaultPlacementService implements IPlacementService {
|
|
|
13
13
|
startPlace(event: MouseEvent, placementView: IPlacementView, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): void;
|
|
14
14
|
place(event: MouseEvent, placementView: IPlacementView, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): void;
|
|
15
15
|
moveElements(designItems: IDesignItem[], position: IPoint, absolute: boolean): void;
|
|
16
|
-
enterContainer(container: IDesignItem, items: IDesignItem[]): void;
|
|
16
|
+
enterContainer(container: IDesignItem, items: IDesignItem[], mode: 'normal' | 'drop'): void;
|
|
17
17
|
leaveContainer(container: IDesignItem, items: IDesignItem[]): void;
|
|
18
18
|
finishPlace(event: MouseEvent, placementView: IPlacementView, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): void;
|
|
19
19
|
}
|
|
@@ -121,9 +121,11 @@ export class DefaultPlacementService {
|
|
|
121
121
|
}
|
|
122
122
|
designItems[0].instanceServiceContainer.designerCanvas.extensionManager.refreshExtensions(designItems);
|
|
123
123
|
}
|
|
124
|
-
enterContainer(container, items) {
|
|
124
|
+
enterContainer(container, items, mode) {
|
|
125
125
|
let filterdItems = filterChildPlaceItems(items);
|
|
126
126
|
for (let i of filterdItems) {
|
|
127
|
+
if (mode == 'drop')
|
|
128
|
+
i.setStyle('position', 'absolute');
|
|
127
129
|
container.insertChild(i);
|
|
128
130
|
if (i.lastContainerSize) {
|
|
129
131
|
if (!i.hasStyle('width'))
|
|
@@ -5,7 +5,7 @@ import { IPlacementService } from './IPlacementService.js';
|
|
|
5
5
|
export declare class FlexBoxPlacementService implements IPlacementService {
|
|
6
6
|
private _basePlacementService;
|
|
7
7
|
constructor(basePlacementService: IPlacementService);
|
|
8
|
-
enterContainer(container: IDesignItem, items: IDesignItem[]): void;
|
|
8
|
+
enterContainer(container: IDesignItem, items: IDesignItem[], mode: 'normal' | 'drop'): void;
|
|
9
9
|
leaveContainer(container: IDesignItem, items: IDesignItem[]): void;
|
|
10
10
|
serviceForContainer(container: IDesignItem, containerStyle: CSSStyleDeclaration): boolean;
|
|
11
11
|
isEnterableContainer(container: IDesignItem): any;
|
|
@@ -4,7 +4,7 @@ export class FlexBoxPlacementService {
|
|
|
4
4
|
constructor(basePlacementService) {
|
|
5
5
|
this._basePlacementService = basePlacementService ?? new DefaultPlacementService();
|
|
6
6
|
}
|
|
7
|
-
enterContainer(container, items) {
|
|
7
|
+
enterContainer(container, items, mode) {
|
|
8
8
|
for (let i of items) {
|
|
9
9
|
container.insertChild(i);
|
|
10
10
|
i.removeStyle("position");
|
|
@@ -5,7 +5,7 @@ import { IPlacementView } from '../../widgets/designerView/IPlacementView.js';
|
|
|
5
5
|
export declare class GridPlacementService implements IPlacementService {
|
|
6
6
|
private _basePlacementService;
|
|
7
7
|
constructor(basePlacementService: IPlacementService);
|
|
8
|
-
enterContainer(container: IDesignItem, items: IDesignItem[]): void;
|
|
8
|
+
enterContainer(container: IDesignItem, items: IDesignItem[], mode: 'normal' | 'drop'): void;
|
|
9
9
|
leaveContainer(container: IDesignItem, items: IDesignItem[]): void;
|
|
10
10
|
serviceForContainer(container: IDesignItem, containerStyle: CSSStyleDeclaration): boolean;
|
|
11
11
|
isEnterableContainer(container: IDesignItem): any;
|
|
@@ -6,7 +6,7 @@ export class GridPlacementService {
|
|
|
6
6
|
constructor(basePlacementService) {
|
|
7
7
|
this._basePlacementService = basePlacementService ?? new DefaultPlacementService();
|
|
8
8
|
}
|
|
9
|
-
enterContainer(container, items) {
|
|
9
|
+
enterContainer(container, items, mode) {
|
|
10
10
|
for (let i of items) {
|
|
11
11
|
container.insertChild(i);
|
|
12
12
|
i.removeStyle("position");
|
|
@@ -7,7 +7,7 @@ export interface IPlacementService extends IService {
|
|
|
7
7
|
isEnterableContainer(container: IDesignItem): boolean;
|
|
8
8
|
canEnter(container: IDesignItem, items: IDesignItem[]): boolean;
|
|
9
9
|
canLeave(container: IDesignItem, items: IDesignItem[]): boolean;
|
|
10
|
-
enterContainer(container: IDesignItem, items: IDesignItem[]): any;
|
|
10
|
+
enterContainer(container: IDesignItem, items: IDesignItem[], mode: 'normal' | 'drop'): any;
|
|
11
11
|
leaveContainer(container: IDesignItem, items: IDesignItem[]): any;
|
|
12
12
|
getElementOffset(container: IDesignItem, designItem?: IDesignItem): IPoint;
|
|
13
13
|
placePoint(event: MouseEvent, placementView: IPlacementView, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): IPoint;
|
|
@@ -4,6 +4,7 @@ import { ValueType } from '../ValueType.js';
|
|
|
4
4
|
export declare class FontPropertyEditor extends BasePropertyEditor<HTMLSelectElement> {
|
|
5
5
|
static fontList: string[];
|
|
6
6
|
constructor(property: IProperty);
|
|
7
|
-
|
|
7
|
+
static addFontsToSelect(select: HTMLSelectElement): void;
|
|
8
|
+
private static parseFontList;
|
|
8
9
|
refreshValue(valueType: ValueType, value: any): void;
|
|
9
10
|
}
|