@node-projects/web-component-designer 0.1.85 → 0.1.86
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/designerView/tools/toolBar/DesignerToolbarButton.d.ts +1 -0
- package/dist/elements/widgets/designerView/tools/toolBar/DesignerToolbarButton.js +18 -5
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/TransformToolButtonProvider.js +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ export declare class DesignerToolbarButton extends BaseCustomWebComponentConstru
|
|
|
11
11
|
currentToolOnButton: string;
|
|
12
12
|
private _img;
|
|
13
13
|
private _div;
|
|
14
|
+
private _longPress;
|
|
14
15
|
constructor(designerCanvas: IDesignerCanvas, tools: Record<string | NamedTools, {
|
|
15
16
|
icon: string;
|
|
16
17
|
}>);
|
|
@@ -17,6 +17,7 @@ export class DesignerToolbarButton extends BaseCustomWebComponentConstructorAppe
|
|
|
17
17
|
img {
|
|
18
18
|
width: calc(100% - 4px);
|
|
19
19
|
height: calc(100% - 4px);
|
|
20
|
+
-webkit-user-drag: none;
|
|
20
21
|
}
|
|
21
22
|
`;
|
|
22
23
|
static template = html `<div id="div"><img id="img"></div>`;
|
|
@@ -25,17 +26,29 @@ export class DesignerToolbarButton extends BaseCustomWebComponentConstructorAppe
|
|
|
25
26
|
currentToolOnButton;
|
|
26
27
|
_img;
|
|
27
28
|
_div;
|
|
29
|
+
_longPress;
|
|
28
30
|
constructor(designerCanvas, tools) {
|
|
29
31
|
super();
|
|
30
32
|
this.tools = tools;
|
|
31
33
|
this._img = this._getDomElement('img');
|
|
32
34
|
this._div = this._getDomElement('div');
|
|
33
|
-
this._div.
|
|
34
|
-
if (this.
|
|
35
|
-
this.getRootNode().host.showPopup(this);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
35
|
+
this._div.onpointerdown = () => {
|
|
36
|
+
if (this.currentToolOnButton) {
|
|
38
37
|
this.getRootNode().host.setTool(this.currentToolOnButton);
|
|
38
|
+
if (this.popup) {
|
|
39
|
+
this._longPress = setTimeout(() => {
|
|
40
|
+
this._longPress = null;
|
|
41
|
+
this.getRootNode().host.showPopup(this);
|
|
42
|
+
}, 200);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else if (this.popup)
|
|
46
|
+
this.getRootNode().host.showPopup(this);
|
|
47
|
+
};
|
|
48
|
+
this._div.onpointerup = () => {
|
|
49
|
+
if (this._longPress) {
|
|
50
|
+
clearTimeout(this._longPress);
|
|
51
|
+
this._longPress = null;
|
|
39
52
|
}
|
|
40
53
|
};
|
|
41
54
|
this.showTool(Object.getOwnPropertyNames(tools)[0]);
|
package/dist/elements/widgets/designerView/tools/toolBar/buttons/TransformToolButtonProvider.js
CHANGED
|
@@ -3,7 +3,7 @@ import { assetsPath } from "../../../../../../Constants.js";
|
|
|
3
3
|
import { TransformToolPopup } from "../popups/TransformToolPopup.js";
|
|
4
4
|
export class TransformToolButtonProvider {
|
|
5
5
|
provideButton(designerCanvas) {
|
|
6
|
-
const button = new DesignerToolbarButton(designerCanvas, { '
|
|
6
|
+
const button = new DesignerToolbarButton(designerCanvas, { '': { icon: assetsPath + 'images/layout/TransformTool.svg' } });
|
|
7
7
|
button.popup = TransformToolPopup;
|
|
8
8
|
return button;
|
|
9
9
|
}
|