@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inweb/viewer-visualize",
3
- "version": "25.6.0",
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.0",
33
- "@inweb/eventemitter2": "~25.6.0",
34
- "@inweb/viewer-core": "~25.6.0"
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.getRotation()) this.setRotation(attrs.rotation);
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.getRotation()) this.setRotation(attrs.rotation);
98
+ if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
99
99
 
100
- const newWidth = this._ref.width() * attrs.scaleX;
101
- const newHeight = this._ref.height() * attrs.scaleY;
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 || newHeight < minHeight) {
107
- this._ref.scale({ x: 1, y: 1 });
108
- return;
109
- }
111
+ if (newWidth < minWidth) newWidth = minWidth;
112
+ if (newHeight < minHeight) newHeight = minHeight;
110
113
 
111
- if (Math.abs(attrs.scaleX - 1) > 10e-6) {
112
- this.setWidth(newWidth);
114
+ if (scaleByX) {
115
+ this._ref.width(newWidth);
113
116
  }
114
117
 
115
- if (Math.abs(attrs.scaleY - 1) > 10e-6) {
116
- this.setHeight(newHeight);
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.getRotation()) this.setRotation(attrs.rotation);
42
+ if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
43
43
 
44
- const newRadiusX = this._ref.radiusX() * attrs.scaleX;
45
- const newRadiusY = this._ref.radiusY() * attrs.scaleY;
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 || newRadiusY < minRadiusY) {
51
- this._ref.scale({ x: 1, y: 1 });
52
- return;
53
- }
54
-
55
- if (Math.abs(attrs.scaleX - 1) > 10e-6) {
56
- this.setRadiusX(newRadiusX);
57
- }
58
-
59
- if (Math.abs(attrs.scaleY - 1) > 10e-6) {
60
- this.setRadiusY(newRadiusY);
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.getRotation()) this.setRotation(attrs.rotation);
47
-
48
- const newWidth = this._ref.width() * attrs.scaleX;
49
- const newHeight = this._ref.height() * attrs.scaleY;
50
-
51
- if (Math.abs(attrs.scaleX - 1) > 10e-6) {
52
- this.setWidth(newWidth);
53
- }
54
-
55
- if (Math.abs(attrs.scaleY - 1) > 10e-6) {
56
- this.setHeight(newHeight);
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.getRotation()) this.setRotation(attrs.rotation);
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.getRotation()) this.setRotation(attrs.rotation);
43
+ if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
44
44
 
45
- let newWidth = this._ref.width() * attrs.scaleX;
46
- let newHeight = this._ref.height() * attrs.scaleY;
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 || newHeight < minHeight) {
52
- this._ref.scale({ x: 1, y: 1 });
53
- return;
54
- }
56
+ if (newWidth < minWidth) newWidth = minWidth;
57
+ if (newHeight < minHeight) newHeight = minHeight;
55
58
 
56
- if (Math.abs(attrs.scaleX - 1) > 10e-6) {
57
- this.setWidth(newWidth);
59
+ if (scaleByX) {
60
+ this._ref.width(newWidth);
58
61
  }
59
62
 
60
- if (Math.abs(attrs.scaleY - 1) > 10e-6) {
61
- this.setHeight(newHeight);
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.getRotation()) this.setRotation(attrs.rotation);
44
+ if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
45
45
 
46
- const newWidth = this._ref.width() * attrs.scaleX;
47
- const newHeight = this._ref.height() * attrs.scaleY;
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 || newHeight < Math.round(this.getFontSize())) {
52
- this._ref.scale({ x: 1, y: 1 });
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 (Math.abs(attrs.scaleX - 1) > 10e-6) {
59
+ if (scaleByX) {
57
60
  this._ref.width(newWidth);
58
61
  }
59
62
 
60
- if (Math.abs(attrs.scaleY - 1) > 10e-6) {
63
+ if (scaleByY) {
61
64
  this._ref.height(newHeight);
62
65
  }
63
66
 
@@ -527,6 +527,7 @@ export class KonvaMarkup implements IMarkup {
527
527
  const transformer = new Konva.Transformer({
528
528
  shouldOverdrawWholeArea: false,
529
529
  keepRatio: false,
530
+ flipEnabled: false,
530
531
  });
531
532
 
532
533
  this._konvaTransformer = transformer;