@node-projects/web-component-designer 0.0.36 → 0.0.37
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/chromeDevtools/flex-direction-row-icon.svg +82 -1
- package/assets/images/chromeDevtools/{flex-nowrap-icon.svg → flex-wrap-nowrap-icon.svg} +0 -0
- package/assets/images/chromeDevtools/{flex-wrap-icon.svg → flex-wrap-wrap-icon.svg} +0 -0
- package/dist/elements/item/DesignItem.d.ts +1 -0
- package/dist/elements/item/DesignItem.js +3 -0
- package/dist/elements/item/IDesignItem.d.ts +1 -0
- package/dist/elements/services/propertiesService/propertyEditors/NumberPropertyEditor.js +1 -1
- package/dist/elements/services/propertiesService/services/CssPropertiesService.js +10 -0
- package/dist/elements/widgets/designerView/IDesignerCanvas.d.ts +1 -0
- package/dist/elements/widgets/designerView/designerCanvas.d.ts +2 -0
- package/dist/elements/widgets/designerView/designerCanvas.js +9 -0
- package/dist/elements/widgets/designerView/tools/PointerTool.js +1 -5
- package/package.json +1 -1
|
@@ -1 +1,82 @@
|
|
|
1
|
-
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<svg
|
|
3
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
4
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
|
5
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
6
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
9
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
10
|
+
fill="none"
|
|
11
|
+
viewBox="0 0 13 13"
|
|
12
|
+
version="1.1"
|
|
13
|
+
id="svg15"
|
|
14
|
+
sodipodi:docname="flex-direction-row-icon.svg"
|
|
15
|
+
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
|
|
16
|
+
<metadata
|
|
17
|
+
id="metadata19">
|
|
18
|
+
<rdf:RDF>
|
|
19
|
+
<cc:Work
|
|
20
|
+
rdf:about="">
|
|
21
|
+
<dc:format>image/svg+xml</dc:format>
|
|
22
|
+
<dc:type
|
|
23
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
24
|
+
</cc:Work>
|
|
25
|
+
</rdf:RDF>
|
|
26
|
+
</metadata>
|
|
27
|
+
<sodipodi:namedview
|
|
28
|
+
pagecolor="#ffffff"
|
|
29
|
+
bordercolor="#666666"
|
|
30
|
+
borderopacity="1"
|
|
31
|
+
objecttolerance="10"
|
|
32
|
+
gridtolerance="10"
|
|
33
|
+
guidetolerance="10"
|
|
34
|
+
inkscape:pageopacity="0"
|
|
35
|
+
inkscape:pageshadow="2"
|
|
36
|
+
inkscape:window-width="1680"
|
|
37
|
+
inkscape:window-height="987"
|
|
38
|
+
id="namedview17"
|
|
39
|
+
showgrid="false"
|
|
40
|
+
inkscape:zoom="63.076923"
|
|
41
|
+
inkscape:cx="6.5"
|
|
42
|
+
inkscape:cy="6.5"
|
|
43
|
+
inkscape:window-x="-8"
|
|
44
|
+
inkscape:window-y="-8"
|
|
45
|
+
inkscape:window-maximized="1"
|
|
46
|
+
inkscape:current-layer="svg15" />
|
|
47
|
+
<g
|
|
48
|
+
clip-path="url(#clip0)"
|
|
49
|
+
id="g8"
|
|
50
|
+
transform="matrix(0,1,1,0,0,0)">
|
|
51
|
+
<rect
|
|
52
|
+
x="2"
|
|
53
|
+
y="2.816"
|
|
54
|
+
width="4.6069999"
|
|
55
|
+
height="2.7379999"
|
|
56
|
+
rx="0.5"
|
|
57
|
+
stroke="#000000"
|
|
58
|
+
id="rect2" />
|
|
59
|
+
<rect
|
|
60
|
+
x="1.5"
|
|
61
|
+
y="6.9889998"
|
|
62
|
+
width="5.6069999"
|
|
63
|
+
height="3.7379999"
|
|
64
|
+
rx="1"
|
|
65
|
+
fill="#000000"
|
|
66
|
+
id="rect4" />
|
|
67
|
+
<path
|
|
68
|
+
d="M 9.461,1.5 V 9.13 H 8 L 10.002,12 12,9.13 H 10.542 V 1.5 h -1.08 z"
|
|
69
|
+
fill="#000000"
|
|
70
|
+
id="path6" />
|
|
71
|
+
</g>
|
|
72
|
+
<defs
|
|
73
|
+
id="defs13">
|
|
74
|
+
<clipPath
|
|
75
|
+
id="clip0">
|
|
76
|
+
<path
|
|
77
|
+
fill="#fff"
|
|
78
|
+
d="M0 0h13v13H0z"
|
|
79
|
+
id="path10" />
|
|
80
|
+
</clipPath>
|
|
81
|
+
</defs>
|
|
82
|
+
</svg>
|
|
File without changes
|
|
File without changes
|
|
@@ -44,6 +44,9 @@ export class DesignItem {
|
|
|
44
44
|
set id(value) {
|
|
45
45
|
this.element.id = value;
|
|
46
46
|
}
|
|
47
|
+
get isRootItem() {
|
|
48
|
+
return this.instanceServiceContainer.contentService.rootDesignItem === this;
|
|
49
|
+
}
|
|
47
50
|
_childArray = [];
|
|
48
51
|
get hasChildren() {
|
|
49
52
|
return this._childArray.length > 0;
|
|
@@ -115,6 +115,11 @@ export class CssPropertiesService {
|
|
|
115
115
|
type: "list",
|
|
116
116
|
values: ["block", "inline-block", "flex", "contents", "grid", "inherit", "initial", "none"],
|
|
117
117
|
service: this
|
|
118
|
+
}, {
|
|
119
|
+
name: "position",
|
|
120
|
+
type: "list",
|
|
121
|
+
values: ["static", "relative", "absolute"],
|
|
122
|
+
service: this
|
|
118
123
|
}, {
|
|
119
124
|
name: "grid-template-columns",
|
|
120
125
|
type: "string",
|
|
@@ -160,6 +165,11 @@ export class CssPropertiesService {
|
|
|
160
165
|
type: "list",
|
|
161
166
|
values: ["block", "inline-block", "flex", "contents", "grid", "inherit", "initial", "none"],
|
|
162
167
|
service: this
|
|
168
|
+
}, {
|
|
169
|
+
name: "position",
|
|
170
|
+
type: "list",
|
|
171
|
+
values: ["static", "relative", "absolute"],
|
|
172
|
+
service: this
|
|
163
173
|
}, {
|
|
164
174
|
name: "flex-direction",
|
|
165
175
|
type: "img-list",
|
|
@@ -22,6 +22,7 @@ export interface IDesignerCanvas extends IPlacementView, IUiCommandHandler {
|
|
|
22
22
|
eatEvents: Element;
|
|
23
23
|
initialize(serviceContainer: ServiceContainer): any;
|
|
24
24
|
getNormalizedEventCoordinates(event: MouseEvent): IPoint;
|
|
25
|
+
getNormalizedOffsetInElement(event: MouseEvent, element: Element): IPoint;
|
|
25
26
|
getElementAtPoint(point: IPoint, ignoreElementCallback?: (element: HTMLElement) => boolean): any;
|
|
26
27
|
elementFromPoint(x: number, y: number): Element;
|
|
27
28
|
}
|
|
@@ -70,6 +70,8 @@ export declare class DesignerCanvas extends BaseCustomWebComponentLazyAppend imp
|
|
|
70
70
|
private onKeyUp;
|
|
71
71
|
private onKeyDown;
|
|
72
72
|
getNormalizedEventCoordinates(event: MouseEvent): IPoint;
|
|
73
|
+
getNormalizedElementCoordinates(element: Element): IPoint;
|
|
74
|
+
getNormalizedOffsetInElement(event: MouseEvent, element: Element): IPoint;
|
|
73
75
|
static getHost(node: Node): Element;
|
|
74
76
|
getElementAtPoint(point: IPoint, ignoreElementCallback?: (element: HTMLElement) => boolean): HTMLElement;
|
|
75
77
|
_rect: SVGRectElement;
|
|
@@ -486,6 +486,15 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
486
486
|
y: offsetOfOuterY - offsetOfCanvasY
|
|
487
487
|
};
|
|
488
488
|
}
|
|
489
|
+
getNormalizedElementCoordinates(element) {
|
|
490
|
+
const targetRect = element.getBoundingClientRect();
|
|
491
|
+
return { x: targetRect.x - this.containerBoundingRect.x, y: targetRect.y - this.containerBoundingRect.y };
|
|
492
|
+
}
|
|
493
|
+
getNormalizedOffsetInElement(event, element) {
|
|
494
|
+
const normEvt = this.getNormalizedEventCoordinates(event);
|
|
495
|
+
const normEl = this.getNormalizedElementCoordinates(element);
|
|
496
|
+
return { x: normEvt.x - normEl.x, y: normEvt.y - normEl.y };
|
|
497
|
+
}
|
|
489
498
|
//todo remove, is in base custom webcomp domhelper
|
|
490
499
|
static getHost(node) {
|
|
491
500
|
while (node.parentElement)
|
|
@@ -40,11 +40,7 @@ export class PointerTool {
|
|
|
40
40
|
const currentDesignItem = DesignItem.GetOrCreateDesignItem(currentElement, designerCanvas.serviceContainer, designerCanvas.instanceServiceContainer);
|
|
41
41
|
if (this._actionType == null) {
|
|
42
42
|
this._initialPoint = currentPoint;
|
|
43
|
-
|
|
44
|
-
this._initialOffset = {
|
|
45
|
-
x: event.x - targetRect.x,
|
|
46
|
-
y: event.y - targetRect.y
|
|
47
|
-
};
|
|
43
|
+
this._initialOffset = designerCanvas.getNormalizedOffsetInElement(event, currentElement);
|
|
48
44
|
if (event.type == EventNames.PointerDown) {
|
|
49
45
|
this._actionStartedDesignItem = currentDesignItem;
|
|
50
46
|
designerCanvas.snapLines.clearSnaplines();
|