@inweb/viewer-visualize 25.6.0 → 25.6.2
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/viewer-visualize.js +106 -58
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +88 -65
- package/dist/viewer-visualize.module.js.map +1 -1
- package/package.json +4 -4
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaArrow.ts +1 -1
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaCloud.ts +14 -11
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.ts +19 -14
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaImage.ts +25 -11
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaLine.ts +1 -1
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.ts +14 -11
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaText.ts +12 -9
- package/src/Viewer/Markup/Impl/Konva/KonvaMarkup.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/viewer-visualize",
|
|
3
|
-
"version": "25.6.
|
|
3
|
+
"version": "25.6.2",
|
|
4
4
|
"description": "3D CAD and BIM data Viewer powered by Visualize",
|
|
5
5
|
"homepage": "https://cloud.opendesign.com/docs/index.html",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"ts-docs": "typedoc"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@inweb/client": "~25.6.
|
|
33
|
-
"@inweb/eventemitter2": "~25.6.
|
|
34
|
-
"@inweb/viewer-core": "~25.6.
|
|
32
|
+
"@inweb/client": "~25.6.2",
|
|
33
|
+
"@inweb/eventemitter2": "~25.6.2",
|
|
34
|
+
"@inweb/viewer-core": "~25.6.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"canvas": "^2.11.2",
|
|
@@ -59,7 +59,7 @@ export class KonvaArrow implements IMarkupArrow, IMarkupColorable {
|
|
|
59
59
|
this._ref.on("transform", (e) => {
|
|
60
60
|
const attrs = e.target.attrs;
|
|
61
61
|
|
|
62
|
-
if (attrs.rotation !== this.
|
|
62
|
+
if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
this._ref.id(this._ref._id.toString());
|
|
@@ -95,25 +95,28 @@ export class KonvaCloud implements IMarkupCloud, IMarkupColorable {
|
|
|
95
95
|
this._ref.on("transform", (e) => {
|
|
96
96
|
const attrs = e.target.attrs;
|
|
97
97
|
|
|
98
|
-
if (attrs.rotation !== this.
|
|
98
|
+
if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
|
|
99
99
|
|
|
100
|
-
const
|
|
101
|
-
const
|
|
100
|
+
const scaleByX = Math.abs(attrs.scaleX - 1) > 10e-6;
|
|
101
|
+
const scaleByY = Math.abs(attrs.scaleY - 1) > 10e-6;
|
|
102
|
+
|
|
103
|
+
let newWidth = this._ref.width();
|
|
104
|
+
if (scaleByX) newWidth *= attrs.scaleX;
|
|
105
|
+
let newHeight = this._ref.height();
|
|
106
|
+
if (scaleByY) newHeight *= attrs.scaleY;
|
|
102
107
|
|
|
103
108
|
const minWidth = 100;
|
|
104
109
|
const minHeight = 100;
|
|
105
110
|
|
|
106
|
-
if (newWidth < minWidth
|
|
107
|
-
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
111
|
+
if (newWidth < minWidth) newWidth = minWidth;
|
|
112
|
+
if (newHeight < minHeight) newHeight = minHeight;
|
|
110
113
|
|
|
111
|
-
if (
|
|
112
|
-
this.
|
|
114
|
+
if (scaleByX) {
|
|
115
|
+
this._ref.width(newWidth);
|
|
113
116
|
}
|
|
114
117
|
|
|
115
|
-
if (
|
|
116
|
-
this.
|
|
118
|
+
if (scaleByY) {
|
|
119
|
+
this._ref.height(newHeight);
|
|
117
120
|
}
|
|
118
121
|
|
|
119
122
|
this._ref.scale({ x: 1, y: 1 });
|
|
@@ -39,25 +39,30 @@ export class KonvaEllipse implements IMarkupEllipse, IMarkupColorable {
|
|
|
39
39
|
this._ref.on("transform", (e) => {
|
|
40
40
|
const attrs = e.target.attrs;
|
|
41
41
|
|
|
42
|
-
if (attrs.rotation !== this.
|
|
42
|
+
if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
|
|
43
43
|
|
|
44
|
-
const
|
|
45
|
-
const
|
|
44
|
+
const scaleByX = Math.abs(attrs.scaleX - 1) > 10e-6;
|
|
45
|
+
const scaleByY = Math.abs(attrs.scaleY - 1) > 10e-6;
|
|
46
|
+
|
|
47
|
+
let newRadiusX = this._ref.radiusX();
|
|
48
|
+
if (scaleByX) newRadiusX *= attrs.scaleX;
|
|
49
|
+
let newRadiusY = this._ref.radiusY();
|
|
50
|
+
if (scaleByY) newRadiusY *= attrs.scaleY;
|
|
46
51
|
|
|
47
52
|
const minRadiusX = 25;
|
|
48
53
|
const minRadiusY = 25;
|
|
49
54
|
|
|
50
|
-
if (newRadiusX < minRadiusX
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.
|
|
55
|
+
if (newRadiusX < minRadiusX) newRadiusX = minRadiusX;
|
|
56
|
+
if (newRadiusY < minRadiusY) newRadiusY = minRadiusY;
|
|
57
|
+
|
|
58
|
+
if (e.evt.ctrlKey || e.evt.shiftKey) {
|
|
59
|
+
if (scaleByX) {
|
|
60
|
+
this._ref.radius({ x: newRadiusX, y: newRadiusX });
|
|
61
|
+
} else {
|
|
62
|
+
this._ref.radius({ x: newRadiusY, y: newRadiusY });
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
this._ref.radius({ x: newRadiusX, y: newRadiusY });
|
|
61
66
|
}
|
|
62
67
|
|
|
63
68
|
this._ref.scale({ x: 1, y: 1 });
|
|
@@ -43,17 +43,31 @@ export class KonvaImage implements IMarkupImage {
|
|
|
43
43
|
this._ref.on("transform", (e) => {
|
|
44
44
|
const attrs = e.target.attrs;
|
|
45
45
|
|
|
46
|
-
if (attrs.rotation !== this.
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
|
|
47
|
+
|
|
48
|
+
const scaleByX = Math.abs(attrs.scaleX - 1) > 10e-6;
|
|
49
|
+
const scaleByY = Math.abs(attrs.scaleY - 1) > 10e-6;
|
|
50
|
+
|
|
51
|
+
let newWidth = this._ref.width();
|
|
52
|
+
if (scaleByX) newWidth *= attrs.scaleX;
|
|
53
|
+
let newHeight = this._ref.height();
|
|
54
|
+
if (scaleByY) newHeight *= attrs.scaleY;
|
|
55
|
+
|
|
56
|
+
if (e.evt.ctrlKey || e.evt.shiftKey) {
|
|
57
|
+
if (scaleByX) {
|
|
58
|
+
this._ref.width(newWidth);
|
|
59
|
+
this._ref.height(newWidth * this._ratio);
|
|
60
|
+
} else {
|
|
61
|
+
this._ref.width(newHeight / this._ratio);
|
|
62
|
+
this._ref.height(newHeight);
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
if (scaleByX) {
|
|
66
|
+
this._ref.width(newWidth);
|
|
67
|
+
}
|
|
68
|
+
if (scaleByY) {
|
|
69
|
+
this._ref.height(newHeight);
|
|
70
|
+
}
|
|
57
71
|
}
|
|
58
72
|
|
|
59
73
|
this._ref.scale({ x: 1, y: 1 });
|
|
@@ -41,7 +41,7 @@ export class KonvaLine implements IMarkupLine, IMarkupColorable {
|
|
|
41
41
|
this._ref.on("transform", (e) => {
|
|
42
42
|
const attrs = e.target.attrs;
|
|
43
43
|
|
|
44
|
-
if (attrs.rotation !== this.
|
|
44
|
+
if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
this._ref.id(this._ref._id.toString());
|
|
@@ -40,25 +40,28 @@ export class KonvaRectangle implements IMarkupRectangle, IMarkupColorable {
|
|
|
40
40
|
this._ref.on("transform", (e) => {
|
|
41
41
|
const attrs = e.target.attrs;
|
|
42
42
|
|
|
43
|
-
if (attrs.rotation !== this.
|
|
43
|
+
if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const scaleByX = Math.abs(attrs.scaleX - 1) > 10e-6;
|
|
46
|
+
const scaleByY = Math.abs(attrs.scaleY - 1) > 10e-6;
|
|
47
|
+
|
|
48
|
+
let newWidth = this._ref.width();
|
|
49
|
+
if (scaleByX) newWidth *= attrs.scaleX;
|
|
50
|
+
let newHeight = this._ref.height();
|
|
51
|
+
if (scaleByY) newHeight *= attrs.scaleY;
|
|
47
52
|
|
|
48
53
|
const minWidth = 50;
|
|
49
54
|
const minHeight = 50;
|
|
50
55
|
|
|
51
|
-
if (newWidth < minWidth
|
|
52
|
-
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
56
|
+
if (newWidth < minWidth) newWidth = minWidth;
|
|
57
|
+
if (newHeight < minHeight) newHeight = minHeight;
|
|
55
58
|
|
|
56
|
-
if (
|
|
57
|
-
this.
|
|
59
|
+
if (scaleByX) {
|
|
60
|
+
this._ref.width(newWidth);
|
|
58
61
|
}
|
|
59
62
|
|
|
60
|
-
if (
|
|
61
|
-
this.
|
|
63
|
+
if (scaleByY) {
|
|
64
|
+
this._ref.height(newHeight);
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
this._ref.scale({ x: 1, y: 1 });
|
|
@@ -41,23 +41,26 @@ export class KonvaText implements IMarkupText, IMarkupColorable {
|
|
|
41
41
|
this._ref.on("transform", (e) => {
|
|
42
42
|
const attrs = e.target.attrs;
|
|
43
43
|
|
|
44
|
-
if (attrs.rotation !== this.
|
|
44
|
+
if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
|
|
45
45
|
|
|
46
|
-
const
|
|
47
|
-
const
|
|
46
|
+
const scaleByX = Math.abs(attrs.scaleX - 1) > 10e-6;
|
|
47
|
+
const scaleByY = Math.abs(attrs.scaleY - 1) > 10e-6;
|
|
48
|
+
|
|
49
|
+
let newWidth = this._ref.width();
|
|
50
|
+
if (scaleByX) newWidth *= attrs.scaleX;
|
|
51
|
+
let newHeight = this._ref.height();
|
|
52
|
+
if (scaleByY) newHeight *= attrs.scaleY;
|
|
48
53
|
|
|
49
54
|
const minWidth = 50;
|
|
50
55
|
|
|
51
|
-
if (newWidth < minWidth
|
|
52
|
-
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
56
|
+
if (newWidth < minWidth) newWidth = minWidth;
|
|
57
|
+
if (newHeight < Math.round(this.getFontSize())) newHeight = Math.round(this.getFontSize());
|
|
55
58
|
|
|
56
|
-
if (
|
|
59
|
+
if (scaleByX) {
|
|
57
60
|
this._ref.width(newWidth);
|
|
58
61
|
}
|
|
59
62
|
|
|
60
|
-
if (
|
|
63
|
+
if (scaleByY) {
|
|
61
64
|
this._ref.height(newHeight);
|
|
62
65
|
}
|
|
63
66
|
|