@node-projects/web-component-designer 0.0.279 → 0.0.280

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.
@@ -9,6 +9,8 @@ export declare enum CommandType {
9
9
  'holdRedo' = "holdRedo",
10
10
  'rotateCounterClockwise' = "rotateCounterClockwise",
11
11
  'rotateClockwise' = "rotateClockwise",
12
+ 'mirrorHorizontal' = "mirrorHorizontal",
13
+ 'mirrorVertical' = "mirrorVertical",
12
14
  'selectAll' = "selectAll",
13
15
  'moveToFront' = "moveToFront",
14
16
  'moveForward' = "moveForward",
@@ -10,6 +10,8 @@ export var CommandType;
10
10
  CommandType["holdRedo"] = "holdRedo";
11
11
  CommandType["rotateCounterClockwise"] = "rotateCounterClockwise";
12
12
  CommandType["rotateClockwise"] = "rotateClockwise";
13
+ CommandType["mirrorHorizontal"] = "mirrorHorizontal";
14
+ CommandType["mirrorVertical"] = "mirrorVertical";
13
15
  CommandType["selectAll"] = "selectAll";
14
16
  CommandType["moveToFront"] = "moveToFront";
15
17
  CommandType["moveForward"] = "moveForward";
@@ -17,6 +17,11 @@ export class DefaultModelCommandService {
17
17
  command.type == CommandType.unifyHeight ||
18
18
  command.type == CommandType.unifyWidth)
19
19
  return designerCanvas.instanceServiceContainer.selectionService.selectedElements.length > 1;
20
+ if (command.type == CommandType.rotateCounterClockwise ||
21
+ command.type == CommandType.rotateClockwise ||
22
+ command.type == CommandType.mirrorHorizontal ||
23
+ command.type == CommandType.mirrorVertical)
24
+ return designerCanvas.instanceServiceContainer.selectionService.selectedElements.length > 0;
20
25
  return null;
21
26
  }
22
27
  async executeCommand(designerCanvas, command) {
@@ -120,9 +125,24 @@ export class DefaultModelCommandService {
120
125
  }
121
126
  grp.commit();
122
127
  }
128
+ else if (command.type == CommandType.mirrorHorizontal) {
129
+ const grp = designerCanvas.instanceServiceContainer.selectionService.primarySelection.openGroup('mirrorHorizontal');
130
+ for (let s of designerCanvas.instanceServiceContainer.selectionService.selectedElements) {
131
+ s.setStyle('transform', 'scaleX(-1)');
132
+ }
133
+ grp.commit();
134
+ }
135
+ else if (command.type == CommandType.mirrorVertical) {
136
+ const grp = designerCanvas.instanceServiceContainer.selectionService.primarySelection.openGroup('mirrorHorizontal');
137
+ for (let s of designerCanvas.instanceServiceContainer.selectionService.selectedElements) {
138
+ s.setStyle('transform', 'scaleY(-1)');
139
+ }
140
+ grp.commit();
141
+ }
123
142
  else
124
143
  return null;
125
144
  designerCanvas.instanceServiceContainer.selectionService.setSelectedElements(selection);
126
145
  return true;
127
146
  }
128
147
  }
148
+ //TODO: combine transforms, could be easy, add new transform, get the matrix and convert back to simple ones (if possible)
@@ -186,9 +186,11 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
186
186
  let model = this._monacoEditor.getModel();
187
187
  let point1 = model.getPositionAt(position.start);
188
188
  let point2 = model.getPositionAt(position.start + position.length);
189
- this._monacoEditor.setSelection({ startLineNumber: point1.lineNumber, startColumn: point1.column, endLineNumber: point2.lineNumber, endColumn: point2.column });
190
- //@ts-ignore
191
- this._monacoEditor.revealRangeInCenterIfOutsideViewport(new monaco.Range(point1.lineNumber, point1.column, point2.lineNumber, point2.column), 1);
189
+ setTimeout(() => {
190
+ this._monacoEditor.setSelection({ startLineNumber: point1.lineNumber, startColumn: point1.column, endLineNumber: point2.lineNumber, endColumn: point2.column });
191
+ //@ts-ignore
192
+ this._monacoEditor.revealRangeInCenterIfOutsideViewport(new monaco.Range(point1.lineNumber, point1.column, point2.lineNumber, point2.column), 1);
193
+ }, 50);
192
194
  }
193
195
  }
194
196
  }
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.279",
4
+ "version": "0.0.280",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "",
@@ -1,3 +0,0 @@
1
- @echo off
2
- call npm install
3
- pause
@@ -1,13 +0,0 @@
1
- rem @echo off
2
- cd ..
3
-
4
- echo Run typescript convert...
5
-
6
- rmdir build /S /Q
7
- rmdir dist /S /Q
8
- node .\node_modules\typescript\bin\tsc
9
- mkdir build
10
- xcopy assets build /E
11
- call polymer build
12
-
13
- pause
@@ -1,6 +0,0 @@
1
- @echo off
2
- cd ..
3
- call npm install --no-save @vanillawc/wc-marquee
4
- cd build
5
- xcopy /e ..\node_modules\@vanillawc\wc-marquee node_modules\@vanillawc\wc-marquee\
6
- pause
@@ -1,3 +0,0 @@
1
- @echo off
2
- cd ..
3
- npx polymer serve --open