@node-projects/web-component-designer 0.0.81 → 0.0.82
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/dist/elements/widgets/codeView/code-view-code-mirror.js +1 -1
- package/dist/elements/widgets/designerView/designerCanvas.d.ts +2 -0
- package/dist/elements/widgets/designerView/designerCanvas.js +6 -0
- package/dist/elements/widgets/designerView/designerView.js +21 -6
- package/dist/elements/widgets/designerView/extensions/PathExtension.js +6 -2
- package/package.json +4 -4
|
@@ -20,7 +20,7 @@ export class CodeViewCodeMirror extends BaseCustomWebComponentLazyAppend {
|
|
|
20
20
|
constructor() {
|
|
21
21
|
super();
|
|
22
22
|
//@ts-ignore
|
|
23
|
-
import("
|
|
23
|
+
import("/codemirror/lib/codemirror.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
24
24
|
this.style.display = 'block';
|
|
25
25
|
this._editor = this._getDomElement('textarea');
|
|
26
26
|
}
|
|
@@ -53,6 +53,8 @@ export declare class DesignerCanvas extends BaseCustomWebComponentLazyAppend imp
|
|
|
53
53
|
set designerWidth(value: string);
|
|
54
54
|
get designerHeight(): string;
|
|
55
55
|
set designerHeight(value: string);
|
|
56
|
+
get designerOffsetWidth(): number;
|
|
57
|
+
get designerOffsetHeight(): number;
|
|
56
58
|
set additionalStyle(value: CSSStyleSheet);
|
|
57
59
|
executeCommand(command: IUiCommand): Promise<void>;
|
|
58
60
|
canExecuteCommand(command: IUiCommand): boolean;
|
|
@@ -163,6 +163,12 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
163
163
|
this._canvasContainer.style.height = value;
|
|
164
164
|
this.zoomFactorChanged();
|
|
165
165
|
}
|
|
166
|
+
get designerOffsetWidth() {
|
|
167
|
+
return this._canvasContainer.offsetWidth;
|
|
168
|
+
}
|
|
169
|
+
get designerOffsetHeight() {
|
|
170
|
+
return this._canvasContainer.offsetHeight;
|
|
171
|
+
}
|
|
166
172
|
set additionalStyle(value) {
|
|
167
173
|
if (value) {
|
|
168
174
|
for (let r of value.rules) {
|
|
@@ -201,17 +201,27 @@ export class DesignerView extends BaseCustomWebComponentConstructorAppend {
|
|
|
201
201
|
this._lowertoolbar = this._getDomElement('lowertoolbar');
|
|
202
202
|
this._sVert = this._getDomElement('s-vert');
|
|
203
203
|
this._sHor = this._getDomElement('s-hor');
|
|
204
|
-
this._sVert.addEventListener('scrollbar-input', () => this._onScrollbar());
|
|
205
|
-
this._sHor.addEventListener('scrollbar-input', () => this._onScrollbar());
|
|
204
|
+
this._sVert.addEventListener('scrollbar-input', (e) => this._onScrollbar(e));
|
|
205
|
+
this._sHor.addEventListener('scrollbar-input', (e) => this._onScrollbar(e));
|
|
206
206
|
}
|
|
207
|
-
_onScrollbar() {
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
_onScrollbar(e) {
|
|
208
|
+
if (e?.detail == 'incrementLarge')
|
|
209
|
+
e.target.value += 0.25;
|
|
210
|
+
else if (e?.detail == 'decrementLarge')
|
|
211
|
+
e.target.value -= 0.25;
|
|
212
|
+
else if (e?.detail == 'incrementSmall')
|
|
213
|
+
e.target.value += 0.05;
|
|
214
|
+
else if (e?.detail == 'decrementSmall')
|
|
215
|
+
e.target.value -= 0.05;
|
|
216
|
+
const w = this.designerCanvas.designerOffsetWidth > this.designerCanvas.offsetWidth ? this.designerCanvas.designerOffsetWidth : this.designerCanvas.offsetWidth;
|
|
217
|
+
const h = this.designerCanvas.designerOffsetHeight > this.designerCanvas.offsetHeight ? this.designerCanvas.designerOffsetHeight : this.designerCanvas.offsetHeight;
|
|
218
|
+
const x = w * (this._sHor.value - 0.5) * -2;
|
|
219
|
+
const y = h * (this._sVert.value - 0.5) * -2;
|
|
210
220
|
this.designerCanvas.canvasOffset = { x, y };
|
|
211
221
|
}
|
|
212
222
|
_onWheel(event) {
|
|
223
|
+
event.preventDefault();
|
|
213
224
|
if (event.ctrlKey) {
|
|
214
|
-
event.preventDefault();
|
|
215
225
|
let zf = this._designerCanvas.zoomFactor;
|
|
216
226
|
zf += event.deltaY * -0.001; //deltamode = 0
|
|
217
227
|
if (zf < 0.02)
|
|
@@ -220,6 +230,11 @@ export class DesignerView extends BaseCustomWebComponentConstructorAppend {
|
|
|
220
230
|
this._zoomInput.value = Math.round(zf * 100) + '%';
|
|
221
231
|
//TODO: we should zoom on the current cursor position, so it stays the center
|
|
222
232
|
}
|
|
233
|
+
else {
|
|
234
|
+
this._sHor.value += event.deltaX / 1000;
|
|
235
|
+
this._sVert.value += event.deltaY / 1000;
|
|
236
|
+
this._onScrollbar(null);
|
|
237
|
+
}
|
|
223
238
|
}
|
|
224
239
|
get designerWidth() {
|
|
225
240
|
return this._designerCanvas.designerWidth;
|
|
@@ -55,19 +55,23 @@ export class PathExtension extends AbstractExtension {
|
|
|
55
55
|
case 'S':
|
|
56
56
|
this._drawPathCircle(p.values[0], p.values[1], p, 0);
|
|
57
57
|
this._drawPathCircle(p.values[2], p.values[3], p, 2);
|
|
58
|
+
this._lastPos = { x: p.values[2], y: p.values[3] };
|
|
58
59
|
break;
|
|
59
60
|
case 'Q':
|
|
60
|
-
this._drawPathCircle(p.values[0], p.values[1], p, 0);
|
|
61
|
-
this._drawPathCircle(p.values[2], p.values[3], p, 2);
|
|
62
61
|
this._drawPathLine(this._lastPos.x, this._lastPos.y, p.values[0], p.values[1]);
|
|
63
62
|
this._drawPathLine(p.values[0], p.values[1], p.values[2], p.values[3]);
|
|
63
|
+
this._drawPathCircle(p.values[0], p.values[1], p, 0);
|
|
64
|
+
this._drawPathCircle(p.values[2], p.values[3], p, 2);
|
|
65
|
+
this._lastPos = { x: p.values[2], y: p.values[3] };
|
|
64
66
|
break;
|
|
65
67
|
case 'T':
|
|
66
68
|
this._drawPathCircle(p.values[0], p.values[1], p, 0);
|
|
69
|
+
this._lastPos = { x: p.values[0], y: p.values[1] };
|
|
67
70
|
break;
|
|
68
71
|
case 'A':
|
|
69
72
|
this._drawPathCircle(p.values[0], p.values[1], p, 0);
|
|
70
73
|
this._drawPathCircle(p.values[5], p.values[6], p, 5);
|
|
74
|
+
this._lastPos = { x: p.values[0], y: p.values[1] };
|
|
71
75
|
break;
|
|
72
76
|
}
|
|
73
77
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "A UI designer for Polymer apps",
|
|
3
3
|
"name": "@node-projects/web-component-designer",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.82",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"author": "",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"prepublishOnly": "npm run build"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@node-projects/base-custom-webcomponent": "^0.
|
|
16
|
+
"@node-projects/base-custom-webcomponent": "^0.5.0",
|
|
17
17
|
"construct-style-sheets-polyfill": "^3.0.5"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@types/jquery": "^3.5.13",
|
|
24
24
|
"@types/jquery.fancytree": "0.0.7",
|
|
25
25
|
"ace-builds": "^1.4.13",
|
|
26
|
-
"codemirror": "^5.65.
|
|
26
|
+
"codemirror": "^5.65.1",
|
|
27
27
|
"custom-elements-manifest": "^1.0.0",
|
|
28
28
|
"esprima-next": "^5.8.1",
|
|
29
29
|
"html2canvas": "*",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"jquery.fancytree": "^2.38.1",
|
|
33
33
|
"monaco-editor": "^0.31.1",
|
|
34
34
|
"ts-jest": "^27.1.3",
|
|
35
|
-
"typescript": "^4.5.
|
|
35
|
+
"typescript": "^4.5.5",
|
|
36
36
|
"typescript-lit-html-plugin": "^0.9.0"
|
|
37
37
|
},
|
|
38
38
|
"repository": {
|