@inweb/viewer-visualize 25.8.11 → 25.8.13

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.
@@ -12298,7 +12298,7 @@
12298
12298
  this._ref.draggable(value);
12299
12299
  }
12300
12300
  type() {
12301
- return "line";
12301
+ return "Line";
12302
12302
  }
12303
12303
  getColor() {
12304
12304
  return this._ref.stroke();
@@ -12418,7 +12418,7 @@
12418
12418
  this._ref.draggable(value);
12419
12419
  }
12420
12420
  type() {
12421
- return "text";
12421
+ return "Text";
12422
12422
  }
12423
12423
  getColor() {
12424
12424
  return this._ref.fill();
@@ -12543,7 +12543,7 @@
12543
12543
  this._ref.draggable(value);
12544
12544
  }
12545
12545
  type() {
12546
- return "rectangle";
12546
+ return "Rectangle";
12547
12547
  }
12548
12548
  getColor() {
12549
12549
  return this._ref.stroke();
@@ -12671,7 +12671,7 @@
12671
12671
  this._ref.draggable(value);
12672
12672
  }
12673
12673
  type() {
12674
- return "ellipse";
12674
+ return "Ellipse";
12675
12675
  }
12676
12676
  getColor() {
12677
12677
  return this._ref.stroke();
@@ -12732,7 +12732,7 @@
12732
12732
  this._ref.draggable(value);
12733
12733
  }
12734
12734
  type() {
12735
- return "arrow";
12735
+ return "Arrow";
12736
12736
  }
12737
12737
  getColor() {
12738
12738
  return this._ref.stroke();
@@ -12885,7 +12885,7 @@
12885
12885
  this._ref.draggable(value);
12886
12886
  }
12887
12887
  type() {
12888
- return "image";
12888
+ return "Image";
12889
12889
  }
12890
12890
  getRotation() {
12891
12891
  return this._ref.rotation();
@@ -13036,7 +13036,7 @@
13036
13036
  this._ref.draggable(value);
13037
13037
  }
13038
13038
  type() {
13039
- return "cloud";
13039
+ return "Cloud";
13040
13040
  }
13041
13041
  getColor() {
13042
13042
  return this._ref.stroke();
@@ -13096,8 +13096,7 @@
13096
13096
  },
13097
13097
  Line: {
13098
13098
  name: "Line",
13099
- initializer: (ref, params = null) => new KonvaLine(params, ref),
13100
- zIndex: 1
13099
+ initializer: (ref, params = null) => new KonvaLine(params, ref)
13101
13100
  },
13102
13101
  Text: {
13103
13102
  name: "Text",
@@ -13105,28 +13104,23 @@
13105
13104
  },
13106
13105
  Rectangle: {
13107
13106
  name: "Rect",
13108
- initializer: (ref, params = null) => new KonvaRectangle(params, ref),
13109
- zIndex: 1
13107
+ initializer: (ref, params = null) => new KonvaRectangle(params, ref)
13110
13108
  },
13111
13109
  Ellipse: {
13112
13110
  name: "Ellipse",
13113
- initializer: (ref, params = null) => new KonvaEllipse(params, ref),
13114
- zIndex: 1
13111
+ initializer: (ref, params = null) => new KonvaEllipse(params, ref)
13115
13112
  },
13116
13113
  Arrow: {
13117
13114
  name: "Arrow",
13118
- initializer: (ref, params = null) => new KonvaArrow(params, ref),
13119
- zIndex: 1
13115
+ initializer: (ref, params = null) => new KonvaArrow(params, ref)
13120
13116
  },
13121
13117
  Image: {
13122
13118
  name: "Image",
13123
- initializer: (ref, params = null) => new KonvaImage(params, ref),
13124
- zIndex: 0
13119
+ initializer: (ref, params = null) => new KonvaImage(params, ref)
13125
13120
  },
13126
13121
  Cloud: {
13127
13122
  name: "Cloud",
13128
- initializer: (ref, params = null) => new KonvaCloud(params, ref),
13129
- zIndex: 1
13123
+ initializer: (ref, params = null) => new KonvaCloud(params, ref)
13130
13124
  }
13131
13125
  };
13132
13126
 
@@ -13135,7 +13129,6 @@
13135
13129
  this._pointerEvents = [];
13136
13130
  this._markupIsActive = false;
13137
13131
  this._markupColor = new MarkupColor(255, 0, 0);
13138
- this._zIndex = 1;
13139
13132
  this.lineWidth = 4;
13140
13133
  this.lineType = "solid";
13141
13134
  this.fontSize = 34;
@@ -13235,6 +13228,9 @@
13235
13228
  }
13236
13229
  setViewpoint(viewpoint) {
13237
13230
  var _a, _b, _c, _d, _e, _f, _g, _h;
13231
+ this.clearSelected();
13232
+ this.removeTextInput();
13233
+ this.removeImageInput();
13238
13234
  const markupColor = ((_a = viewpoint.custom_fields) === null || _a === void 0 ? void 0 : _a.markup_color) || {
13239
13235
  r: 255,
13240
13236
  g: 0,
@@ -13297,6 +13293,8 @@
13297
13293
  enableEditMode(mode) {
13298
13294
  if (!mode || !MarkupMode2Konva[mode]) {
13299
13295
  this.clearSelected();
13296
+ this.removeTextInput();
13297
+ this.removeImageInput();
13300
13298
  this._markupIsActive = false;
13301
13299
  } else {
13302
13300
  this._markupMode = mode;
@@ -13305,13 +13303,10 @@
13305
13303
  return this;
13306
13304
  }
13307
13305
  createObject(type, params) {
13308
- var _a;
13309
13306
  const konvaShape = MarkupMode2Konva[type];
13310
13307
  if (!konvaShape || !konvaShape.initializer) throw new Error(`Markup CreateObject - unsupported markup type ${type}`);
13311
13308
  const object = konvaShape.initializer(null, params);
13312
13309
  this.addObject(object);
13313
- object.setZIndex((_a = konvaShape.zIndex) !== null && _a !== void 0 ? _a : this._zIndex);
13314
- this._zIndex++;
13315
13310
  return object;
13316
13311
  }
13317
13312
  getObjects() {
@@ -13339,13 +13334,13 @@
13339
13334
  if (this._konvaTransformer) this._konvaTransformer.nodes([]);
13340
13335
  }
13341
13336
  addObject(object) {
13342
- if (this._konvaLayer) this._konvaLayer.add(object.ref());
13337
+ if (object.type() === "Image") this._groupImages.add(object.ref()); else if (object.type() === "Text") this._groupTexts.add(object.ref()); else this._groupGeometry.add(object.ref());
13343
13338
  }
13344
13339
  konvaLayerFind(type) {
13345
13340
  if (!this._konvaLayer) return [];
13346
13341
  const konvaShape = MarkupMode2Konva[type];
13347
13342
  if (!konvaShape || !konvaShape.initializer) return [];
13348
- return this._konvaLayer.find(konvaShape.name).filter((ref => ref.parent === this._konvaLayer));
13343
+ return this._konvaLayer.find(konvaShape.name).filter((ref => ref.parent === this._konvaLayer || ref.parent === this._groupImages || ref.parent === this._groupGeometry || ref.parent === this._groupTexts));
13349
13344
  }
13350
13345
  initializeKonva() {
13351
13346
  const stage = new Konva.Stage({
@@ -13358,6 +13353,12 @@
13358
13353
  pixelRation: window.devicePixelRatio
13359
13354
  });
13360
13355
  stage.add(layer);
13356
+ this._groupImages = new Konva.Group;
13357
+ layer.add(this._groupImages);
13358
+ this._groupGeometry = new Konva.Group;
13359
+ layer.add(this._groupGeometry);
13360
+ this._groupTexts = new Konva.Group;
13361
+ layer.add(this._groupTexts);
13361
13362
  this._konvaLayer = layer;
13362
13363
  const transformer = new Konva.Transformer({
13363
13364
  shouldOverdrawWholeArea: false,
@@ -13523,7 +13524,7 @@
13523
13524
  this.removeImageInput();
13524
13525
  }
13525
13526
  }
13526
- if (transformer.nodes().filter((x => x.className === "Cloud")).length > 0 || e.target.className === "Cloud") {
13527
+ if (transformer.nodes().filter((x => x.className === "Cloud" || x.className === "Image")).length > 0 || e.target.className === "Cloud" || e.target.className === "Image") {
13527
13528
  transformer.rotateEnabled(false);
13528
13529
  } else {
13529
13530
  transformer.rotateEnabled(true);
@@ -13556,8 +13557,13 @@
13556
13557
  }
13557
13558
  destroyKonva() {
13558
13559
  var _a;
13560
+ this.removeTextInput();
13561
+ this.removeImageInput();
13559
13562
  this.clearOverlay();
13560
13563
  (_a = this._konvaStage) === null || _a === void 0 ? void 0 : _a.destroy();
13564
+ this._groupImages = undefined;
13565
+ this._groupGeometry = undefined;
13566
+ this._groupTexts = undefined;
13561
13567
  this._konvaLayer = undefined;
13562
13568
  this._konvaTransformer = undefined;
13563
13569
  this._konvaStage = undefined;
@@ -13754,6 +13760,9 @@
13754
13760
  this._textInputRef.style.display = "block";
13755
13761
  this._textInputRef.style.top = inputY + "px";
13756
13762
  this._textInputRef.style.left = inputX + "px";
13763
+ this._textInputRef.style.fontSize = `${this.fontSize}px`;
13764
+ this._textInputRef.style.color = `${this._markupColor.HexColor}`;
13765
+ this._textInputRef.style.fontFamily = "Calibri";
13757
13766
  this._textInputRef.onkeydown = event => {
13758
13767
  if (event.key === "Enter" && !event.shiftKey) {
13759
13768
  event.preventDefault();
@@ -16229,21 +16238,19 @@
16229
16238
  visViewer.attachPartialResolver(objectHandler);
16230
16239
  try {
16231
16240
  this.viewer.emitEvent({ type: "geometrystart", model: this.model });
16232
- await this.model
16233
- .downloadResource(this.model.database, chunkLoadHandler, abortController.signal)
16234
- .catch((error) => {
16241
+ await this.model.downloadResource(this.model.database, chunkLoadHandler, abortController.signal).catch((e) => {
16235
16242
  if (!servicePartAborted)
16236
- throw error;
16243
+ throw e;
16237
16244
  });
16238
16245
  this.viewer.emitEvent({ type: "geometryend", model: this.model });
16239
16246
  }
16240
- catch (error) {
16247
+ catch (e) {
16241
16248
  if (pendingRequestsTimerId) {
16242
16249
  window.clearTimeout(pendingRequestsTimerId);
16243
16250
  pendingRequestsTimerId = 0;
16244
16251
  }
16245
- this.viewer.emitEvent({ type: "geometryerror", data: error, model: this.model });
16246
- throw error;
16252
+ this.viewer.emitEvent({ type: "geometryerror", data: e, model: this.model });
16253
+ throw e;
16247
16254
  }
16248
16255
  }
16249
16256
  }