|
1 |
| -import { HSide, VSide } from 'index'; |
2 | 1 | import { Rect } from 'plugin.model';
|
3 | 2 | import { Selection, SelectionChangedEvent } from '../selection';
|
4 | 3 | import { SelectionUtil } from '../selection.util';
|
5 | 4 | import { Gizmo, GIZMO_MOVE } from './gizmo';
|
6 |
| -import { ScaleGizmo } from './scale-gizmo'; |
| 5 | +import { HSide, ScaleGizmo, VSide } from './scale-gizmo'; |
7 | 6 | import './selection-gizmo.scss';
|
8 | 7 |
|
9 | 8 | // interface PropertiesCache {
|
@@ -40,21 +39,17 @@ export class SelectionGizmo extends HTMLElement implements Gizmo {
|
40 | 39 | }
|
41 | 40 |
|
42 | 41 | private createResizeHandlers(handlers: HTMLElement[]) {
|
43 |
| - const tl = this.appendChild(document.createElement(ScaleGizmo.tagName)) as ScaleGizmo; |
44 |
| - tl.init(VSide.Top, HSide.Left); |
45 |
| - handlers.push(tl); |
46 |
| - |
47 |
| - const tr = this.appendChild(document.createElement(ScaleGizmo.tagName)) as ScaleGizmo; |
48 |
| - tr.init(VSide.Top, HSide.Right); |
49 |
| - handlers.push(tr); |
50 |
| - |
51 |
| - const bl = this.appendChild(document.createElement(ScaleGizmo.tagName)) as ScaleGizmo; |
52 |
| - bl.init(VSide.Bottom, HSide.Left); |
53 |
| - handlers.push(bl); |
54 |
| - |
55 |
| - const br = this.appendChild(document.createElement(ScaleGizmo.tagName)) as ScaleGizmo; |
56 |
| - br.init(VSide.Bottom, HSide.Right); |
57 |
| - handlers.push(br); |
| 42 | + const vsides = [VSide.Top, VSide.Middle, VSide.Bottom]; |
| 43 | + const hsides = [HSide.Left, HSide.Center, HSide.Right]; |
| 44 | + |
| 45 | + vsides.forEach(v => { |
| 46 | + hsides.forEach(h => { |
| 47 | + if (v === VSide.Middle && h === HSide.Center) return; |
| 48 | + const el = this.appendChild(document.createElement(ScaleGizmo.tagName)) as ScaleGizmo; |
| 49 | + el.init(v, h); |
| 50 | + handlers.push(el); |
| 51 | + }); |
| 52 | + }); |
58 | 53 | }
|
59 | 54 |
|
60 | 55 | public redraw(object: PIXI.DisplayObject, checkCache = true) {
|
|
0 commit comments