@operato/board 1.4.71 → 1.4.73

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/board",
3
- "version": "1.4.71",
3
+ "version": "1.4.73",
4
4
  "description": "Webcomponent for board following open-wc recommendations",
5
5
  "author": "heartyoh",
6
6
  "main": "dist/src/index.js",
@@ -148,5 +148,5 @@
148
148
  "prettier --write"
149
149
  ]
150
150
  },
151
- "gitHead": "b33419d8c667b6457f2a93424afe2845faa63350"
151
+ "gitHead": "815c4b813f8c6a960867ef0aff00290bcba4041b"
152
152
  }
@@ -171,6 +171,10 @@ export const style = css`
171
171
  background-position-y: -1142px;
172
172
  }
173
173
 
174
+ #databind-copy {
175
+ background-position-y: -692px;
176
+ }
177
+
174
178
  #context-menu {
175
179
  background-position-y: -692px;
176
180
  }
@@ -25,6 +25,8 @@ export class EditToolbar extends LitElement {
25
25
  @query('#undo') private undo!: HTMLElement
26
26
 
27
27
  @query('#fullscreen') private fullscreen!: HTMLElement
28
+ @query('#style-copy') private styleCopy!: HTMLElement
29
+ @query('#databind-copy') private databindCopy!: HTMLElement
28
30
  @query('#cut') private cut!: HTMLElement
29
31
  @query('#copy') private copy!: HTMLElement
30
32
  @query('#paste') private paste!: HTMLElement
@@ -59,6 +61,8 @@ export class EditToolbar extends LitElement {
59
61
  this.undo.addEventListener('tap', this.onTapUndo.bind(this) as EventListener)
60
62
  this.redo.addEventListener('tap', this.onTapRedo.bind(this) as EventListener)
61
63
  this.fullscreen.addEventListener('tap', this.onTapFullscreen.bind(this) as EventListener)
64
+ this.styleCopy.addEventListener('tap', this.onStartStylePasteMode.bind(this) as EventListener)
65
+ this.databindCopy.addEventListener('tap', this.onStartDatabindPasteMode.bind(this) as EventListener)
62
66
  this.cut.addEventListener('tap', this.onTapCut.bind(this) as EventListener)
63
67
  this.copy.addEventListener('tap', this.onTapCopy.bind(this) as EventListener)
64
68
  this.paste.addEventListener('tap', this.onTapPaste.bind(this) as EventListener)
@@ -94,6 +98,11 @@ export class EditToolbar extends LitElement {
94
98
 
95
99
  <span class="vline"></span>
96
100
 
101
+ <span button id="style-copy" title="style copy (${this.getShortcutString('cmd', '1')})"> </span>
102
+ <span button id="databind-copy" title="databind copy (${this.getShortcutString('cmd', '2')})"> </span>
103
+
104
+ <span class="vline"></span>
105
+
97
106
  <span button id="cut" title="cut (${this.getShortcutString('cmd', 'x')})"> </span>
98
107
  <span button id="copy" title="copy (${this.getShortcutString('cmd', 'c')})"> </span>
99
108
  <span button id="paste" title="paste (${this.getShortcutString('cmd', 'v')})"> </span>
@@ -106,11 +115,6 @@ export class EditToolbar extends LitElement {
106
115
 
107
116
  <span class="vline"></span>
108
117
 
109
- <!-- TODO Implement style-copy
110
- <span button id="style-copy" title="format painter"></span>
111
- <span class="vline"></span>
112
- -->
113
-
114
118
  <span
115
119
  button
116
120
  data-align="left"
@@ -275,6 +279,12 @@ export class EditToolbar extends LitElement {
275
279
  case 'KeyY':
276
280
  if (ctrlKey && !shiftKey) this.onTapRedo()
277
281
  break
282
+ case 'Digit1':
283
+ if (ctrlKey) this.onStartStylePasteMode()
284
+ break
285
+ case 'Digit2':
286
+ if (ctrlKey) this.onStartDatabindPasteMode()
287
+ break
278
288
  case 'KeyC':
279
289
  if (ctrlKey && !shiftKey) this.onTapCopy()
280
290
  else if (altKey && shiftKey) this.onTapAlign('center')
@@ -306,12 +316,6 @@ export class EditToolbar extends LitElement {
306
316
  else if (ctrlKey && shiftKey) this.scene?.zorder('back')
307
317
  else if (altKey && shiftKey) this.onTapAlign('bottom')
308
318
  break
309
- // case 'Equal':
310
- // if (ctrlKey) this.onTapZoom(zoomin)
311
- // break
312
- // case 'Minus':
313
- // if (ctrlKey) this.onTapZoom(zoomout)
314
- // break
315
319
  case 'KeyH':
316
320
  if (ctrlKey && !shiftKey) this.onTapToggle()
317
321
  else if (altKey && shiftKey) this.onTapDistribute('HORIZONTAL')
@@ -400,13 +404,6 @@ export class EditToolbar extends LitElement {
400
404
  }
401
405
  }
402
406
 
403
- // @query('#align-left') private alignLeft!: HTMLElement
404
- // @query('#align-center') private alignCenter!: HTMLElement
405
- // @query('#align-right') private alignRight!: HTMLElement
406
- // @query('#align-top') private alignTop!: HTMLElement
407
- // @query('#align-middle') private alignMiddle!: HTMLElement
408
- // @query('#align-bottom') private alignBottom!: HTMLElement
409
-
410
407
  onSelectedChanged(after: Component[], before: Component[]) {
411
408
  var alignable = after.length > 1
412
409
 
@@ -433,6 +430,14 @@ export class EditToolbar extends LitElement {
433
430
  this.scene?.redo()
434
431
  }
435
432
 
433
+ onStartStylePasteMode() {
434
+ this.scene?.startStylePasteMode()
435
+ }
436
+
437
+ onStartDatabindPasteMode() {
438
+ this.scene?.startDatabindPasteMode()
439
+ }
440
+
436
441
  onTapCut() {
437
442
  this.scene?.cut()
438
443
  }
@@ -7,7 +7,7 @@ import './modeller/scene-viewer/ox-scene-viewer.js'
7
7
  import './ox-board-viewer'
8
8
 
9
9
  import { saveAs } from 'file-saver'
10
- import { css, html, LitElement } from 'lit'
10
+ import { css, html, LitElement, PropertyValues } from 'lit'
11
11
  import { customElement, property, query } from 'lit/decorators.js'
12
12
 
13
13
  import { Scene, SCENE_MODE } from '@hatiolab/things-scene'
@@ -19,6 +19,7 @@ import { ComponentToolbar } from './modeller/component-toolbar/component-toolbar
19
19
  import { EditToolbar } from './modeller/edit-toolbar'
20
20
  import { PropertySidebar } from './modeller/property-sidebar/property-sidebar'
21
21
  import { ComponentGroup, ComponentTemplate } from './types'
22
+ import OxSceneViewer from './modeller/scene-viewer/ox-scene-viewer.js'
22
23
 
23
24
  const MACOS = isMacOS()
24
25
 
@@ -160,6 +161,7 @@ export class BoardModeller extends ScopedElementsMixin(LitElement) {
160
161
  @property({ type: Array }) propertyEditor: any[] = []
161
162
 
162
163
  @query('edit-toolbar') private editToolbar!: EditToolbar
164
+ @query('ox-scene-viewer') private viewer!: OxSceneViewer
163
165
 
164
166
  private group: string = ''
165
167
  private shortcutHandler?: (e: KeyboardEvent) => void
@@ -273,6 +275,7 @@ export class BoardModeller extends ScopedElementsMixin(LitElement) {
273
275
  <ox-scene-layer type="decotag-layer"></ox-scene-layer>
274
276
  <ox-scene-handler type="text-editor"></ox-scene-handler>
275
277
  <ox-scene-handler type="move-handler"></ox-scene-handler>
278
+ <ox-scene-handler type="paste-handler"></ox-scene-handler>
276
279
  </ox-scene-viewer>
277
280
 
278
281
  <mwc-fab icon="save" @click=${() => this.onTapSave()} title="save"> </mwc-fab>
@@ -296,10 +299,49 @@ export class BoardModeller extends ScopedElementsMixin(LitElement) {
296
299
  }
297
300
 
298
301
  disconnectedCallback(): void {
302
+ if (this.scene) {
303
+ this.scene.stopStylePasteMode()
304
+ this.scene.stopDatabindPasteMode()
305
+ }
306
+
299
307
  super.disconnectedCallback()
300
308
  this.unbindShortcutEvent()
301
309
  }
302
310
 
311
+ updated(changes: PropertyValues<this>) {
312
+ if (changes.has('scene')) {
313
+ const old = changes.get('scene')
314
+
315
+ if (old) {
316
+ old.off('stylepastestart')
317
+ old.off('stylepastestop')
318
+ old.off('databindpastestart')
319
+ old.off('databindpastestop')
320
+
321
+ if (old) {
322
+ old.stopStylePasteMode()
323
+ old.stopDatabindPasteMode()
324
+ }
325
+ }
326
+
327
+ const scene = this.scene
328
+ if (scene) {
329
+ this.scene?.on('stylepastestart', () => {
330
+ this.viewer.style.cursor = 'copy'
331
+ })
332
+ this.scene?.on('stylepastestop', () => {
333
+ this.viewer.style.cursor = 'default'
334
+ })
335
+ this.scene?.on('databindpastestart', () => {
336
+ this.viewer.style.cursor = 'context-menu'
337
+ })
338
+ this.scene?.on('databindpastestop', () => {
339
+ this.viewer.style.cursor = 'default'
340
+ })
341
+ }
342
+ }
343
+ }
344
+
303
345
  close() {
304
346
  this.model = null
305
347
  this.requestUpdate()