@inweb/markup 26.4.0 → 26.5.0
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/markup.js +636 -137
- package/dist/markup.js.map +1 -1
- package/dist/markup.min.js +1 -1
- package/dist/markup.module.js +772 -151
- package/dist/markup.module.js.map +1 -1
- package/lib/markup/IMarkupArrow.d.ts +8 -8
- package/lib/markup/IMarkupCloud.d.ts +12 -5
- package/lib/markup/IMarkupEllipse.d.ts +19 -4
- package/lib/markup/IMarkupImage.d.ts +15 -7
- package/lib/markup/IMarkupLine.d.ts +2 -2
- package/lib/markup/IMarkupObject.d.ts +4 -0
- package/lib/markup/IMarkupRectangle.d.ts +12 -5
- package/lib/markup/IMarkupText.d.ts +3 -3
- package/lib/markup/Konva/KonvaArrow.d.ts +4 -1
- package/lib/markup/Konva/KonvaCloud.d.ts +4 -1
- package/lib/markup/Konva/KonvaEllipse.d.ts +4 -1
- package/lib/markup/Konva/KonvaImage.d.ts +4 -1
- package/lib/markup/Konva/KonvaLine.d.ts +4 -1
- package/lib/markup/Konva/KonvaMarkup.d.ts +2 -2
- package/lib/markup/Konva/KonvaRectangle.d.ts +4 -1
- package/lib/markup/Konva/KonvaText.d.ts +4 -1
- package/lib/markup/Utils.d.ts +7 -0
- package/package.json +3 -3
- package/src/markup/IMarkupArrow.ts +8 -8
- package/src/markup/IMarkupCloud.ts +10 -5
- package/src/markup/IMarkupEllipse.ts +15 -4
- package/src/markup/IMarkupImage.ts +13 -7
- package/src/markup/IMarkupLine.ts +2 -2
- package/src/markup/IMarkupObject.ts +5 -0
- package/src/markup/IMarkupRectangle.ts +10 -5
- package/src/markup/IMarkupText.ts +3 -3
- package/src/markup/Konva/KonvaArrow.ts +49 -4
- package/src/markup/Konva/KonvaCloud.ts +113 -11
- package/src/markup/Konva/KonvaEllipse.ts +110 -3
- package/src/markup/Konva/KonvaImage.ts +101 -2
- package/src/markup/Konva/KonvaLine.ts +97 -3
- package/src/markup/Konva/KonvaMarkup.ts +216 -172
- package/src/markup/Konva/KonvaRectangle.ts +106 -4
- package/src/markup/Konva/KonvaText.ts +61 -2
- package/src/markup/Utils.ts +3 -0
package/dist/markup.js
CHANGED
|
@@ -12001,16 +12001,50 @@
|
|
|
12001
12001
|
}
|
|
12002
12002
|
}
|
|
12003
12003
|
|
|
12004
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
12005
|
+
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
12006
|
+
// All rights reserved.
|
|
12007
|
+
//
|
|
12008
|
+
// This software and its documentation and related materials are owned by
|
|
12009
|
+
// the Alliance. The software may only be incorporated into application
|
|
12010
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
12011
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
12012
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
12013
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
12014
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12015
|
+
// programs incorporating this software must include the following statement
|
|
12016
|
+
// with their copyright notices:
|
|
12017
|
+
//
|
|
12018
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
12019
|
+
// license agreement with Open Design Alliance.
|
|
12020
|
+
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
|
|
12021
|
+
// All rights reserved.
|
|
12022
|
+
//
|
|
12023
|
+
// By use of this software, its documentation or related materials, you
|
|
12024
|
+
// acknowledge and accept the above terms.
|
|
12025
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
12004
12026
|
const LineTypeSpecs = new Map([
|
|
12005
12027
|
["solid", []],
|
|
12006
12028
|
["dot", [30, 30, 0.001, 30]],
|
|
12007
12029
|
["dash", [30, 30]],
|
|
12008
12030
|
]);
|
|
12009
12031
|
class KonvaLine {
|
|
12010
|
-
constructor(params, ref = null) {
|
|
12032
|
+
constructor(params, ref = null, worldTransformer = new WorldTransform()) {
|
|
12011
12033
|
var _a, _b;
|
|
12034
|
+
this._worldTransformer = worldTransformer;
|
|
12012
12035
|
if (ref) {
|
|
12013
12036
|
this._ref = ref;
|
|
12037
|
+
let wcsPoints = this._ref.getAttr("wcsPoints");
|
|
12038
|
+
if (!wcsPoints) {
|
|
12039
|
+
wcsPoints = [];
|
|
12040
|
+
let points = this._ref.points();
|
|
12041
|
+
let wcsPoint;
|
|
12042
|
+
for (let i = 0; i < points.length; i += 2) {
|
|
12043
|
+
wcsPoint = this._worldTransformer.screenToWorld({ x: points[i], y: points[i + 1] });
|
|
12044
|
+
wcsPoints.push({ x: wcsPoint.x, y: wcsPoint.y, z: wcsPoint.z });
|
|
12045
|
+
}
|
|
12046
|
+
this._ref.setAttr("wcsPoints", wcsPoints);
|
|
12047
|
+
}
|
|
12014
12048
|
return;
|
|
12015
12049
|
}
|
|
12016
12050
|
if (!params)
|
|
@@ -12021,7 +12055,12 @@
|
|
|
12021
12055
|
{ x: 100, y: 100 },
|
|
12022
12056
|
];
|
|
12023
12057
|
const konvaPoints = [];
|
|
12024
|
-
|
|
12058
|
+
const wcsPoints = [];
|
|
12059
|
+
params.points.forEach((point) => {
|
|
12060
|
+
konvaPoints.push(point.x, point.y);
|
|
12061
|
+
let wcsPoint = this._worldTransformer.screenToWorld({ x: point.x, y: point.y });
|
|
12062
|
+
wcsPoints.push({ x: wcsPoint.x, y: wcsPoint.y, z: wcsPoint.z });
|
|
12063
|
+
});
|
|
12025
12064
|
this._ref = new Konva.Line({
|
|
12026
12065
|
stroke: (_a = params.color) !== null && _a !== undefined ? _a : "#ff0000",
|
|
12027
12066
|
strokeWidth: (_b = params.width) !== null && _b !== undefined ? _b : 4,
|
|
@@ -12033,11 +12072,36 @@
|
|
|
12033
12072
|
strokeScaleEnabled: false,
|
|
12034
12073
|
dash: LineTypeSpecs.get(params.type) || [],
|
|
12035
12074
|
});
|
|
12075
|
+
this._ref.setAttr("wcsPoints", wcsPoints);
|
|
12036
12076
|
this._ref.on("transform", (e) => {
|
|
12037
12077
|
const attrs = e.target.attrs;
|
|
12038
12078
|
if (attrs.rotation !== this._ref.rotation())
|
|
12039
12079
|
this._ref.rotation(attrs.rotation);
|
|
12040
12080
|
});
|
|
12081
|
+
this._ref.on("transformend", (e) => {
|
|
12082
|
+
const absoluteTransform = this._ref.getAbsoluteTransform();
|
|
12083
|
+
let wcsPoints = [];
|
|
12084
|
+
let points = this._ref.points();
|
|
12085
|
+
let wcsPoint;
|
|
12086
|
+
for (let i = 0; i < points.length; i += 2) {
|
|
12087
|
+
const position = absoluteTransform.point({ x: points[i], y: points[i + 1] });
|
|
12088
|
+
wcsPoint = this._worldTransformer.screenToWorld({ x: position.x, y: position.y });
|
|
12089
|
+
wcsPoints.push({ x: wcsPoint.x, y: wcsPoint.y, z: wcsPoint.z });
|
|
12090
|
+
}
|
|
12091
|
+
this._ref.setAttr("wcsPoints", wcsPoints);
|
|
12092
|
+
});
|
|
12093
|
+
this._ref.on("dragend", (e) => {
|
|
12094
|
+
const absoluteTransform = this._ref.getAbsoluteTransform();
|
|
12095
|
+
let wcsPoints = [];
|
|
12096
|
+
let points = this._ref.points();
|
|
12097
|
+
let wcsPoint;
|
|
12098
|
+
for (let i = 0; i < points.length; i += 2) {
|
|
12099
|
+
const position = absoluteTransform.point({ x: points[i], y: points[i + 1] });
|
|
12100
|
+
wcsPoint = this._worldTransformer.screenToWorld({ x: position.x, y: position.y });
|
|
12101
|
+
wcsPoints.push({ x: wcsPoint.x, y: wcsPoint.y, z: wcsPoint.z });
|
|
12102
|
+
}
|
|
12103
|
+
this._ref.setAttr("wcsPoints", wcsPoints);
|
|
12104
|
+
});
|
|
12041
12105
|
this._ref.id(this._ref._id.toString());
|
|
12042
12106
|
}
|
|
12043
12107
|
ref() {
|
|
@@ -12106,19 +12170,64 @@
|
|
|
12106
12170
|
}
|
|
12107
12171
|
addPoints(points) {
|
|
12108
12172
|
let newPoints = this._ref.points();
|
|
12173
|
+
let wcsPoints = this._ref.getAttr("wcsPoints");
|
|
12109
12174
|
points.forEach((point) => {
|
|
12110
12175
|
newPoints = newPoints.concat([point.x, point.y]);
|
|
12176
|
+
let wcsPoint = this._worldTransformer.screenToWorld(point);
|
|
12177
|
+
wcsPoints.push(wcsPoint);
|
|
12111
12178
|
});
|
|
12112
12179
|
this._ref.points(newPoints);
|
|
12113
12180
|
}
|
|
12181
|
+
updateScreenCoordinates() {
|
|
12182
|
+
let wcsPoints = this._ref.getAttr("wcsPoints");
|
|
12183
|
+
let points = [];
|
|
12184
|
+
let invert = this._ref.getAbsoluteTransform().copy();
|
|
12185
|
+
invert = invert.invert();
|
|
12186
|
+
wcsPoints.forEach((point) => {
|
|
12187
|
+
let screenPoint = this._worldTransformer.worldToScreen(point);
|
|
12188
|
+
screenPoint = invert.point({ x: screenPoint.x, y: screenPoint.y });
|
|
12189
|
+
points.push(screenPoint.x);
|
|
12190
|
+
points.push(screenPoint.y);
|
|
12191
|
+
});
|
|
12192
|
+
this._ref.points([]);
|
|
12193
|
+
this._ref.points(points);
|
|
12194
|
+
this._ref.clearCache();
|
|
12195
|
+
}
|
|
12114
12196
|
}
|
|
12115
12197
|
|
|
12198
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
12199
|
+
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
12200
|
+
// All rights reserved.
|
|
12201
|
+
//
|
|
12202
|
+
// This software and its documentation and related materials are owned by
|
|
12203
|
+
// the Alliance. The software may only be incorporated into application
|
|
12204
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
12205
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
12206
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
12207
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
12208
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12209
|
+
// programs incorporating this software must include the following statement
|
|
12210
|
+
// with their copyright notices:
|
|
12211
|
+
//
|
|
12212
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
12213
|
+
// license agreement with Open Design Alliance.
|
|
12214
|
+
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
|
|
12215
|
+
// All rights reserved.
|
|
12216
|
+
//
|
|
12217
|
+
// By use of this software, its documentation or related materials, you
|
|
12218
|
+
// acknowledge and accept the above terms.
|
|
12219
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
12116
12220
|
class KonvaText {
|
|
12117
|
-
constructor(params, ref = null) {
|
|
12221
|
+
constructor(params, ref = null, worldTransformer = new WorldTransform()) {
|
|
12118
12222
|
var _a, _b, _c;
|
|
12119
12223
|
this.TEXT_FONT_FAMILY = "Calibri";
|
|
12224
|
+
this._worldTransformer = worldTransformer;
|
|
12120
12225
|
if (ref) {
|
|
12121
12226
|
this._ref = ref;
|
|
12227
|
+
const wcsStart = this._ref.getAttr("wcsStart");
|
|
12228
|
+
if (!wcsStart) {
|
|
12229
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: ref.x(), y: ref.y() }));
|
|
12230
|
+
}
|
|
12122
12231
|
return;
|
|
12123
12232
|
}
|
|
12124
12233
|
if (!params)
|
|
@@ -12139,6 +12248,7 @@
|
|
|
12139
12248
|
rotation: (_c = params.rotation) !== null && _c !== undefined ? _c : 0,
|
|
12140
12249
|
});
|
|
12141
12250
|
this._ref.width(this._ref.getTextWidth());
|
|
12251
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: params.position.x, y: params.position.y }));
|
|
12142
12252
|
this._ref.on("transform", (e) => {
|
|
12143
12253
|
const attrs = e.target.attrs;
|
|
12144
12254
|
if (attrs.rotation !== this._ref.rotation())
|
|
@@ -12164,6 +12274,19 @@
|
|
|
12164
12274
|
}
|
|
12165
12275
|
this._ref.scale({ x: 1, y: 1 });
|
|
12166
12276
|
});
|
|
12277
|
+
this._ref.on("transformend", (e) => {
|
|
12278
|
+
const attrs = e.target.attrs;
|
|
12279
|
+
if (attrs.rotation !== this._ref.rotation())
|
|
12280
|
+
this._ref.rotation(attrs.rotation);
|
|
12281
|
+
const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
|
|
12282
|
+
const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
|
|
12283
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
|
|
12284
|
+
});
|
|
12285
|
+
this._ref.on("dragend", (e) => {
|
|
12286
|
+
const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
|
|
12287
|
+
const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
|
|
12288
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
|
|
12289
|
+
});
|
|
12167
12290
|
this._ref.id(this._ref._id.toString());
|
|
12168
12291
|
}
|
|
12169
12292
|
ref() {
|
|
@@ -12211,6 +12334,7 @@
|
|
|
12211
12334
|
}
|
|
12212
12335
|
setPosition(x, y) {
|
|
12213
12336
|
this._ref.setPosition({ x, y });
|
|
12337
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x, y }));
|
|
12214
12338
|
}
|
|
12215
12339
|
getFontSize() {
|
|
12216
12340
|
return this._ref.fontSize();
|
|
@@ -12218,19 +12342,72 @@
|
|
|
12218
12342
|
setFontSize(size) {
|
|
12219
12343
|
this._ref.fontSize(size);
|
|
12220
12344
|
}
|
|
12345
|
+
updateScreenCoordinates() {
|
|
12346
|
+
let screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
|
|
12347
|
+
let invert = this._ref.getStage().getAbsoluteTransform().copy();
|
|
12348
|
+
invert = invert.invert();
|
|
12349
|
+
const positionStart = invert.point(screenPositionStart);
|
|
12350
|
+
this._ref.position({ x: positionStart.x, y: positionStart.y });
|
|
12351
|
+
}
|
|
12221
12352
|
}
|
|
12222
12353
|
|
|
12354
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
12355
|
+
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
12356
|
+
// All rights reserved.
|
|
12357
|
+
//
|
|
12358
|
+
// This software and its documentation and related materials are owned by
|
|
12359
|
+
// the Alliance. The software may only be incorporated into application
|
|
12360
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
12361
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
12362
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
12363
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
12364
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12365
|
+
// programs incorporating this software must include the following statement
|
|
12366
|
+
// with their copyright notices:
|
|
12367
|
+
//
|
|
12368
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
12369
|
+
// license agreement with Open Design Alliance.
|
|
12370
|
+
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
|
|
12371
|
+
// All rights reserved.
|
|
12372
|
+
//
|
|
12373
|
+
// By use of this software, its documentation or related materials, you
|
|
12374
|
+
// acknowledge and accept the above terms.
|
|
12375
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
12223
12376
|
class KonvaRectangle {
|
|
12224
|
-
constructor(params, ref = null) {
|
|
12377
|
+
constructor(params, ref = null, worldTransformer = new WorldTransform()) {
|
|
12225
12378
|
var _a, _b, _c, _d;
|
|
12379
|
+
this._worldTransformer = worldTransformer;
|
|
12226
12380
|
if (ref) {
|
|
12227
12381
|
this._ref = ref;
|
|
12382
|
+
const wcsStart = this._ref.getAttr("wcsStart");
|
|
12383
|
+
const wcsEnd = this._ref.getAttr("wcsEnd");
|
|
12384
|
+
if (!wcsStart) {
|
|
12385
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: ref.x(), y: ref.y() }));
|
|
12386
|
+
}
|
|
12387
|
+
if (!wcsEnd) {
|
|
12388
|
+
const rightBottomPoint = { x: ref.x() + ref.width(), y: ref.y() + ref.height() };
|
|
12389
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: rightBottomPoint.x, y: rightBottomPoint.y }));
|
|
12390
|
+
}
|
|
12228
12391
|
return;
|
|
12229
12392
|
}
|
|
12230
12393
|
if (!params)
|
|
12231
12394
|
params = {};
|
|
12232
12395
|
if (!params.position)
|
|
12233
12396
|
params.position = { x: 0, y: 0 };
|
|
12397
|
+
if (params.position2) {
|
|
12398
|
+
params.width = params.position2.x - params.position.x;
|
|
12399
|
+
params.height = params.position2.y - params.position.y;
|
|
12400
|
+
}
|
|
12401
|
+
else {
|
|
12402
|
+
if (!params.width || !params.height) {
|
|
12403
|
+
params.position2 = { x: 200, y: 200 };
|
|
12404
|
+
params.width = 200;
|
|
12405
|
+
params.height = 200;
|
|
12406
|
+
}
|
|
12407
|
+
else {
|
|
12408
|
+
params.position2 = { x: params.position.x + params.width, y: params.position.y + params.height };
|
|
12409
|
+
}
|
|
12410
|
+
}
|
|
12234
12411
|
this._ref = new Konva.Rect({
|
|
12235
12412
|
stroke: (_a = params.color) !== null && _a !== undefined ? _a : "#ff0000",
|
|
12236
12413
|
strokeWidth: (_b = params.lineWidth) !== null && _b !== undefined ? _b : 4,
|
|
@@ -12244,10 +12421,10 @@
|
|
|
12244
12421
|
draggable: true,
|
|
12245
12422
|
strokeScaleEnabled: false,
|
|
12246
12423
|
});
|
|
12424
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: params.position.x, y: params.position.y }));
|
|
12425
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: params.position2.x, y: params.position2.y }));
|
|
12247
12426
|
this._ref.on("transform", (e) => {
|
|
12248
12427
|
const attrs = e.target.attrs;
|
|
12249
|
-
if (attrs.rotation !== this._ref.rotation())
|
|
12250
|
-
this._ref.rotation(attrs.rotation);
|
|
12251
12428
|
const scaleByX = Math.abs(attrs.scaleX - 1) > 10e-6;
|
|
12252
12429
|
const scaleByY = Math.abs(attrs.scaleY - 1) > 10e-6;
|
|
12253
12430
|
let newWidth = this._ref.width();
|
|
@@ -12270,6 +12447,21 @@
|
|
|
12270
12447
|
}
|
|
12271
12448
|
this._ref.scale({ x: 1, y: 1 });
|
|
12272
12449
|
});
|
|
12450
|
+
this._ref.on("transformend", (e) => {
|
|
12451
|
+
const attrs = e.target.attrs;
|
|
12452
|
+
if (attrs.rotation !== this._ref.rotation())
|
|
12453
|
+
this._ref.rotation(attrs.rotation);
|
|
12454
|
+
const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
|
|
12455
|
+
const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
|
|
12456
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
|
|
12457
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: position.x + this._ref.width(), y: position.y + this._ref.height() }));
|
|
12458
|
+
});
|
|
12459
|
+
this._ref.on("dragend", (e) => {
|
|
12460
|
+
const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
|
|
12461
|
+
const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
|
|
12462
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
|
|
12463
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: position.x + this._ref.width(), y: position.y + this._ref.height() }));
|
|
12464
|
+
});
|
|
12273
12465
|
this._ref.id(this._ref._id.toString());
|
|
12274
12466
|
}
|
|
12275
12467
|
getPosition() {
|
|
@@ -12283,12 +12475,22 @@
|
|
|
12283
12475
|
}
|
|
12284
12476
|
setWidth(w) {
|
|
12285
12477
|
this._ref.width(w);
|
|
12478
|
+
const rightLowerPoint = { x: this._ref.x() + w, y: this._ref.y() + this._ref.height() };
|
|
12479
|
+
const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
|
|
12480
|
+
this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
|
|
12286
12481
|
}
|
|
12287
12482
|
setHeight(h) {
|
|
12288
12483
|
this._ref.height(h);
|
|
12484
|
+
const rightLowerPoint = { x: this._ref.x() + this._ref.width(), y: this._ref.y() + h };
|
|
12485
|
+
const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
|
|
12486
|
+
this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
|
|
12289
12487
|
}
|
|
12290
12488
|
setPosition(x, y) {
|
|
12291
12489
|
this._ref.setPosition({ x, y });
|
|
12490
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x, y }));
|
|
12491
|
+
const rightLowerPoint = { x: x + this._ref.width(), y: y + this._ref.y() };
|
|
12492
|
+
const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
|
|
12493
|
+
this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
|
|
12292
12494
|
}
|
|
12293
12495
|
ref() {
|
|
12294
12496
|
return this._ref;
|
|
@@ -12330,21 +12532,80 @@
|
|
|
12330
12532
|
getLineWidth() {
|
|
12331
12533
|
return this._ref.strokeWidth();
|
|
12332
12534
|
}
|
|
12535
|
+
updateScreenCoordinates() {
|
|
12536
|
+
let screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
|
|
12537
|
+
let screenPositionEnd = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
|
|
12538
|
+
let invert = this._ref.getStage().getAbsoluteTransform().copy();
|
|
12539
|
+
invert = invert.invert();
|
|
12540
|
+
const positionStart = invert.point(screenPositionStart);
|
|
12541
|
+
const positionEnd = invert.point(screenPositionEnd);
|
|
12542
|
+
this._ref.position({ x: positionStart.x, y: positionStart.y });
|
|
12543
|
+
this._ref.width(Math.abs(positionEnd.x - positionStart.x));
|
|
12544
|
+
this._ref.height(Math.abs(positionEnd.y - positionStart.y));
|
|
12545
|
+
}
|
|
12546
|
+
}
|
|
12547
|
+
|
|
12548
|
+
function getDistanceIn2D(p1, p2) {
|
|
12549
|
+
return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
|
|
12333
12550
|
}
|
|
12334
12551
|
|
|
12552
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
12553
|
+
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
12554
|
+
// All rights reserved.
|
|
12555
|
+
//
|
|
12556
|
+
// This software and its documentation and related materials are owned by
|
|
12557
|
+
// the Alliance. The software may only be incorporated into application
|
|
12558
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
12559
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
12560
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
12561
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
12562
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12563
|
+
// programs incorporating this software must include the following statement
|
|
12564
|
+
// with their copyright notices:
|
|
12565
|
+
//
|
|
12566
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
12567
|
+
// license agreement with Open Design Alliance.
|
|
12568
|
+
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
|
|
12569
|
+
// All rights reserved.
|
|
12570
|
+
//
|
|
12571
|
+
// By use of this software, its documentation or related materials, you
|
|
12572
|
+
// acknowledge and accept the above terms.
|
|
12573
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
12335
12574
|
class KonvaEllipse {
|
|
12336
|
-
constructor(params, ref = null) {
|
|
12575
|
+
constructor(params, ref = null, worldTransformer = new WorldTransform()) {
|
|
12337
12576
|
var _a, _b;
|
|
12577
|
+
this._worldTransformer = worldTransformer;
|
|
12338
12578
|
if (ref) {
|
|
12339
12579
|
this._ref = ref;
|
|
12580
|
+
const wcsPosition = this._ref.getAttr("wcsPosition");
|
|
12581
|
+
const radiusX = this._ref.getAttr("wcsRadiusX");
|
|
12582
|
+
const radiusY = this._ref.getAttr("wcsRadiusY");
|
|
12583
|
+
if (!wcsPosition) {
|
|
12584
|
+
this._ref.setAttr("wcsPosition", this._worldTransformer.screenToWorld({ x: ref.x(), y: ref.y() }));
|
|
12585
|
+
}
|
|
12586
|
+
if (!radiusX) {
|
|
12587
|
+
this._ref.setAttr("wcsRadiusX", this._worldTransformer.screenToWorld({ x: ref.x() + ref.radiusX(), y: ref.y() }));
|
|
12588
|
+
}
|
|
12589
|
+
if (!radiusY) {
|
|
12590
|
+
this._ref.setAttr("wcsRadiusY", this._worldTransformer.screenToWorld({ x: ref.x(), y: ref.y() + ref.radiusY() }));
|
|
12591
|
+
}
|
|
12340
12592
|
return;
|
|
12341
12593
|
}
|
|
12342
12594
|
if (!params)
|
|
12343
12595
|
params = {};
|
|
12344
12596
|
if (!params.position)
|
|
12345
12597
|
params.position = { x: 0, y: 0 };
|
|
12346
|
-
if (
|
|
12347
|
-
params.radius =
|
|
12598
|
+
if (params.position2) {
|
|
12599
|
+
params.radius.x = getDistanceIn2D(params.position, params.position2);
|
|
12600
|
+
if (params.position3)
|
|
12601
|
+
params.radius.y = getDistanceIn2D(params.position, params.position3);
|
|
12602
|
+
else
|
|
12603
|
+
params.radius.x = params.radius.y;
|
|
12604
|
+
}
|
|
12605
|
+
else {
|
|
12606
|
+
if (!params.radius)
|
|
12607
|
+
params.radius = { x: 25, y: 25 };
|
|
12608
|
+
}
|
|
12348
12609
|
this._ref = new Konva.Ellipse({
|
|
12349
12610
|
stroke: (_a = params.color) !== null && _a !== undefined ? _a : "#ff0000",
|
|
12350
12611
|
strokeWidth: (_b = params.lineWidth) !== null && _b !== undefined ? _b : 4,
|
|
@@ -12358,6 +12619,9 @@
|
|
|
12358
12619
|
draggable: true,
|
|
12359
12620
|
strokeScaleEnabled: false,
|
|
12360
12621
|
});
|
|
12622
|
+
this._ref.setAttr("wcsPosition", this._worldTransformer.screenToWorld({ x: params.position.x, y: params.position.y }));
|
|
12623
|
+
this._ref.setAttr("wcsRadiusX", this._worldTransformer.screenToWorld({ x: this._ref.x() + params.radius.x, y: this._ref.y() }));
|
|
12624
|
+
this._ref.setAttr("wcsRadiusY", this._worldTransformer.screenToWorld({ x: this._ref.x(), y: this._ref.y() + params.radius.y }));
|
|
12361
12625
|
this._ref.on("transform", (e) => {
|
|
12362
12626
|
const attrs = e.target.attrs;
|
|
12363
12627
|
if (attrs.rotation !== this._ref.rotation())
|
|
@@ -12389,6 +12653,24 @@
|
|
|
12389
12653
|
}
|
|
12390
12654
|
this._ref.scale({ x: 1, y: 1 });
|
|
12391
12655
|
});
|
|
12656
|
+
this._ref.on("transformend", (e) => {
|
|
12657
|
+
const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
|
|
12658
|
+
const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
|
|
12659
|
+
this._ref.setAttr("wcsPosition", this._worldTransformer.screenToWorld(position));
|
|
12660
|
+
const radiusX = absoluteTransform.point({ x: this._ref.x() + this._ref.radiusX(), y: this._ref.y() });
|
|
12661
|
+
this._ref.setAttr("wcsRadiusX", this._worldTransformer.screenToWorld(radiusX));
|
|
12662
|
+
const radiusY = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() + this._ref.radiusY() });
|
|
12663
|
+
this._ref.setAttr("wcsRadiusY", this._worldTransformer.screenToWorld(radiusY));
|
|
12664
|
+
});
|
|
12665
|
+
this._ref.on("dragend", (e) => {
|
|
12666
|
+
const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
|
|
12667
|
+
const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
|
|
12668
|
+
this._ref.setAttr("wcsPosition", this._worldTransformer.screenToWorld(position));
|
|
12669
|
+
const radiusX = absoluteTransform.point({ x: this._ref.x() + this._ref.radiusX(), y: this._ref.y() });
|
|
12670
|
+
this._ref.setAttr("wcsRadiusX", this._worldTransformer.screenToWorld(radiusX));
|
|
12671
|
+
const radiusY = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() + this._ref.radiusY() });
|
|
12672
|
+
this._ref.setAttr("wcsRadiusY", this._worldTransformer.screenToWorld(radiusY));
|
|
12673
|
+
});
|
|
12392
12674
|
this._ref.id(this._ref._id.toString());
|
|
12393
12675
|
}
|
|
12394
12676
|
getPosition() {
|
|
@@ -12396,18 +12678,21 @@
|
|
|
12396
12678
|
}
|
|
12397
12679
|
setPosition(x, y) {
|
|
12398
12680
|
this._ref.setPosition({ x, y });
|
|
12681
|
+
this._ref.setAttr("wcsPosition", this._worldTransformer.screenToWorld({ x, y }));
|
|
12399
12682
|
}
|
|
12400
12683
|
getRadiusX() {
|
|
12401
12684
|
return this._ref.radiusX();
|
|
12402
12685
|
}
|
|
12403
12686
|
setRadiusX(r) {
|
|
12404
12687
|
this._ref.radiusX(r);
|
|
12688
|
+
this._ref.setAttr("wcsRadiusX", this._worldTransformer.screenToWorld({ x: this._ref.x() + r, y: this._ref.y() }));
|
|
12405
12689
|
}
|
|
12406
12690
|
getRadiusY() {
|
|
12407
12691
|
return this._ref.radiusY();
|
|
12408
12692
|
}
|
|
12409
12693
|
setRadiusY(r) {
|
|
12410
12694
|
this._ref.radiusY(r);
|
|
12695
|
+
this._ref.setAttr("wcsRadiusY", this._worldTransformer.screenToWorld({ x: this._ref.x(), y: this._ref.y() + r }));
|
|
12411
12696
|
}
|
|
12412
12697
|
getLineWidth() {
|
|
12413
12698
|
return this._ref.strokeWidth();
|
|
@@ -12449,6 +12734,19 @@
|
|
|
12449
12734
|
this._ref.destroy();
|
|
12450
12735
|
this._ref = null;
|
|
12451
12736
|
}
|
|
12737
|
+
updateScreenCoordinates() {
|
|
12738
|
+
let screenPosition = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsPosition"));
|
|
12739
|
+
let radiusX = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsRadiusX"));
|
|
12740
|
+
let radiusY = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsRadiusY"));
|
|
12741
|
+
let invert = this._ref.getStage().getAbsoluteTransform().copy();
|
|
12742
|
+
invert = invert.invert();
|
|
12743
|
+
const position = invert.point({ x: screenPosition.x, y: screenPosition.y });
|
|
12744
|
+
this._ref.position({ x: position.x, y: position.y });
|
|
12745
|
+
this._ref.radius({
|
|
12746
|
+
x: Math.abs(invert.point(radiusX).x - position.x),
|
|
12747
|
+
y: Math.abs(invert.point(radiusY).y - position.y),
|
|
12748
|
+
});
|
|
12749
|
+
}
|
|
12452
12750
|
}
|
|
12453
12751
|
|
|
12454
12752
|
///////////////////////////////////////////////////////////////////////////////
|
|
@@ -12474,10 +12772,17 @@
|
|
|
12474
12772
|
// acknowledge and accept the above terms.
|
|
12475
12773
|
///////////////////////////////////////////////////////////////////////////////
|
|
12476
12774
|
class KonvaArrow {
|
|
12477
|
-
constructor(params, ref = null) {
|
|
12775
|
+
constructor(params, ref = null, worldTransformer = new WorldTransform()) {
|
|
12478
12776
|
var _a, _b;
|
|
12777
|
+
this._worldTransformer = worldTransformer;
|
|
12479
12778
|
if (ref) {
|
|
12480
12779
|
this._ref = ref;
|
|
12780
|
+
const wcsStart = this._ref.getAttr("wcsStart");
|
|
12781
|
+
const wcsEnd = this._ref.getAttr("wcsEnd");
|
|
12782
|
+
if (!wcsStart)
|
|
12783
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: ref.points()[0], y: ref.points()[1] }));
|
|
12784
|
+
if (!wcsEnd)
|
|
12785
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: ref.points()[2], y: ref.points()[3] }));
|
|
12481
12786
|
return;
|
|
12482
12787
|
}
|
|
12483
12788
|
if (!params)
|
|
@@ -12497,10 +12802,26 @@
|
|
|
12497
12802
|
draggable: true,
|
|
12498
12803
|
strokeScaleEnabled: false,
|
|
12499
12804
|
});
|
|
12500
|
-
this._ref.
|
|
12805
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: params.start.x, y: params.start.y }));
|
|
12806
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: params.end.x, y: params.end.y }));
|
|
12807
|
+
this._ref.on("transformend", (e) => {
|
|
12501
12808
|
const attrs = e.target.attrs;
|
|
12502
12809
|
if (attrs.rotation !== this._ref.rotation())
|
|
12503
12810
|
this._ref.rotation(attrs.rotation);
|
|
12811
|
+
const points = this._ref.points();
|
|
12812
|
+
const absoluteTransform = this._ref.getAbsoluteTransform();
|
|
12813
|
+
const transformStart = absoluteTransform.point({ x: points[0], y: points[1] });
|
|
12814
|
+
const transformEnd = absoluteTransform.point({ x: points[2], y: points[3] });
|
|
12815
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(transformStart));
|
|
12816
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld(transformEnd));
|
|
12817
|
+
});
|
|
12818
|
+
this._ref.on("dragend", (e) => {
|
|
12819
|
+
const points = this._ref.points();
|
|
12820
|
+
const absoluteTransform = e.target.getAbsoluteTransform();
|
|
12821
|
+
const transformStart = absoluteTransform.point({ x: points[0], y: points[1] });
|
|
12822
|
+
const transformEnd = absoluteTransform.point({ x: points[2], y: points[3] });
|
|
12823
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(transformStart));
|
|
12824
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld(transformEnd));
|
|
12504
12825
|
});
|
|
12505
12826
|
this._ref.id(this._ref._id.toString());
|
|
12506
12827
|
}
|
|
@@ -12548,6 +12869,8 @@
|
|
|
12548
12869
|
}
|
|
12549
12870
|
setPoints(points) {
|
|
12550
12871
|
if (points.length === 2) {
|
|
12872
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: points[0].x, y: points[0].y }));
|
|
12873
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: points[1].x, y: points[1].y }));
|
|
12551
12874
|
this._ref.points([points[0].x, points[0].y, points[1].x, points[1].y]);
|
|
12552
12875
|
}
|
|
12553
12876
|
}
|
|
@@ -12558,6 +12881,7 @@
|
|
|
12558
12881
|
setStartPoint(x, y) {
|
|
12559
12882
|
const points = this._ref.points();
|
|
12560
12883
|
this._ref.points([x, y, points[2], points[3]]);
|
|
12884
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x, y }));
|
|
12561
12885
|
}
|
|
12562
12886
|
getEndPoint() {
|
|
12563
12887
|
const points = this._ref.points();
|
|
@@ -12566,16 +12890,49 @@
|
|
|
12566
12890
|
setEndPoint(x, y) {
|
|
12567
12891
|
const points = this._ref.points();
|
|
12568
12892
|
this._ref.points([points[0], points[1], x, y]);
|
|
12893
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x, y }));
|
|
12894
|
+
}
|
|
12895
|
+
updateScreenCoordinates() {
|
|
12896
|
+
let screenStartPoint = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
|
|
12897
|
+
let screenEndPoint = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
|
|
12898
|
+
let invert = this._ref.getAbsoluteTransform().copy();
|
|
12899
|
+
invert = invert.invert();
|
|
12900
|
+
const startPoint = invert.point({ x: screenStartPoint.x, y: screenStartPoint.y });
|
|
12901
|
+
const endPoint = invert.point({ x: screenEndPoint.x, y: screenEndPoint.y });
|
|
12902
|
+
this._ref.points([startPoint.x, startPoint.y, endPoint.x, endPoint.y]);
|
|
12569
12903
|
}
|
|
12570
12904
|
}
|
|
12571
12905
|
|
|
12906
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
12907
|
+
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
12908
|
+
// All rights reserved.
|
|
12909
|
+
//
|
|
12910
|
+
// This software and its documentation and related materials are owned by
|
|
12911
|
+
// the Alliance. The software may only be incorporated into application
|
|
12912
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
12913
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
12914
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
12915
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
12916
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12917
|
+
// programs incorporating this software must include the following statement
|
|
12918
|
+
// with their copyright notices:
|
|
12919
|
+
//
|
|
12920
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
12921
|
+
// license agreement with Open Design Alliance.
|
|
12922
|
+
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
|
|
12923
|
+
// All rights reserved.
|
|
12924
|
+
//
|
|
12925
|
+
// By use of this software, its documentation or related materials, you
|
|
12926
|
+
// acknowledge and accept the above terms.
|
|
12927
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
12572
12928
|
class KonvaImage {
|
|
12573
|
-
constructor(params, ref = null) {
|
|
12929
|
+
constructor(params, ref = null, worldTransformer = new WorldTransform()) {
|
|
12574
12930
|
var _a, _b;
|
|
12575
12931
|
this._ratio = 1;
|
|
12576
12932
|
this.EPSILON = 10e-6;
|
|
12577
12933
|
this.BASE64_HEADER_START = "data:image/";
|
|
12578
12934
|
this.BASE64_NOT_FOUND = "data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAADsAAAA7AF5KHG9AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAmhJREFUWIXtlr9rVEEQxz+H8RQUJIdeIopYm0vkCg0GBBtbG1NF7Kxt7dR/IGIw/uhTaBNLERURg2kCEUyCYCPi70b0InjGS57FzOZN3r19d+9HJIVfWO52dma/s7Mz8xa2KAaBCWAR+AkECWOmSOIdwC1gtQOpHc+NfQ8wClQ8+1d0vcdH/lQ3bSIRGAZ2pTjAqNovANXIWlXlAXA2zvi2Ln4AjqYgtagYEutENSLvjRoOImFv5iB32Ae8UrLXwFBk3h9ndF0VJnKSO9gTu3yKu5Z1LKnS8YIcABgw5Ks692JZFXcXRJ46Aq6kikCnHNi/mQ50WwVtfaIoBzL3gRk2drSscJ2wrc4VvUoe2wn/41/iBfoVLRnBGnDSY3AAKacy8AmYR+o7K1zCl6wgrgpOAc/MuhvfgMuk+1JGHQgSBcAloKXy78AjYBppJk5/noTulseBMZ23iD/piHFkEdgTQzKk+5wHjmHC3cmBg0BD5xcSTrFXyQPgIWFtDwMvab+2N8DpbhyY1v/3E8gdDgNfVX9SCVZ0/gW4B0wB71S2BpxLcuCM/jaQSHSDEeAX4VMuAG4gTzyHbcAVXXO6GxxwIX+vvxe7JHcYQ07nHqklj96UIW/YhSWzMKcep8VVtf8B1Dw6h4DfhB+sdbgn2R+gnoEc5NR3dZ+3QJ9H74HqXLPCGlJyTfI9y3YCs0owq3OLOpKkLeBI1HhSDT/mdKIPiUCARMTlQx34TMLjtww8IczmO8AJ/N/2JNSQXAiQ671JePePge0+wzJSQq4FFzlaenIvucUAkiQLhC/mLGNZ9xgn5s63BP4CCk0QDtm4BhoAAAAASUVORK5CYII=";
|
|
12935
|
+
this._worldTransformer = worldTransformer;
|
|
12579
12936
|
if (ref) {
|
|
12580
12937
|
if (!ref.src || !ref.src.startsWith(this.BASE64_HEADER_START))
|
|
12581
12938
|
ref.src = this.BASE64_NOT_FOUND;
|
|
@@ -12589,6 +12946,15 @@
|
|
|
12589
12946
|
this._ref.height() <= this.EPSILON || this._ref.width() <= this.EPSILON
|
|
12590
12947
|
? 1
|
|
12591
12948
|
: this._ref.height() / this._ref.width();
|
|
12949
|
+
const wcsStart = this._ref.getAttr("wcsStart");
|
|
12950
|
+
const wcsEnd = this._ref.getAttr("wcsEnd");
|
|
12951
|
+
if (!wcsStart) {
|
|
12952
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: ref.x(), y: ref.y() }));
|
|
12953
|
+
}
|
|
12954
|
+
if (!wcsEnd) {
|
|
12955
|
+
const rightBottomPoint = { x: ref.x() + ref.width(), y: ref.y() + ref.height() };
|
|
12956
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: rightBottomPoint.x, y: rightBottomPoint.y }));
|
|
12957
|
+
}
|
|
12592
12958
|
return;
|
|
12593
12959
|
}
|
|
12594
12960
|
if (!params)
|
|
@@ -12597,6 +12963,10 @@
|
|
|
12597
12963
|
params.position = { x: 0, y: 0 };
|
|
12598
12964
|
if (!params.src || !params.src.startsWith(this.BASE64_HEADER_START))
|
|
12599
12965
|
params.src = this.BASE64_NOT_FOUND;
|
|
12966
|
+
if (params.position2) {
|
|
12967
|
+
params.width = params.position2.x - params.position.x;
|
|
12968
|
+
params.height = params.position2.y - params.position.y;
|
|
12969
|
+
}
|
|
12600
12970
|
this._canvasImage = new Image();
|
|
12601
12971
|
this._canvasImage.onload = () => {
|
|
12602
12972
|
this._ref.image(this._canvasImage);
|
|
@@ -12622,6 +12992,11 @@
|
|
|
12622
12992
|
this._ref.width(params.maxHeight / this._ratio);
|
|
12623
12993
|
this._ref.height(params.maxHeight);
|
|
12624
12994
|
}
|
|
12995
|
+
const wcsEnd = this._worldTransformer.screenToWorld({
|
|
12996
|
+
x: params.position.x + this._ref.width(),
|
|
12997
|
+
y: params.position.y + this._ref.height(),
|
|
12998
|
+
});
|
|
12999
|
+
this._ref.setAttr("wcsEnd", wcsEnd);
|
|
12625
13000
|
}
|
|
12626
13001
|
}
|
|
12627
13002
|
};
|
|
@@ -12638,6 +13013,7 @@
|
|
|
12638
13013
|
height: (_b = params.height) !== null && _b !== undefined ? _b : 0,
|
|
12639
13014
|
draggable: true,
|
|
12640
13015
|
});
|
|
13016
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: params.position.x, y: params.position.y }));
|
|
12641
13017
|
this._ref.on("transform", (e) => {
|
|
12642
13018
|
const attrs = e.target.attrs;
|
|
12643
13019
|
if (attrs.rotation !== this._ref.rotation())
|
|
@@ -12670,6 +13046,18 @@
|
|
|
12670
13046
|
}
|
|
12671
13047
|
this._ref.scale({ x: 1, y: 1 });
|
|
12672
13048
|
});
|
|
13049
|
+
this._ref.on("transformend", (e) => {
|
|
13050
|
+
const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
|
|
13051
|
+
const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
|
|
13052
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
|
|
13053
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: position.x + this._ref.width(), y: position.y + this._ref.height() }));
|
|
13054
|
+
});
|
|
13055
|
+
this._ref.on("dragend", (e) => {
|
|
13056
|
+
const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
|
|
13057
|
+
const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
|
|
13058
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
|
|
13059
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: position.x + this._ref.width(), y: position.y + this._ref.height() }));
|
|
13060
|
+
});
|
|
12673
13061
|
this._ref.id(this._ref._id.toString());
|
|
12674
13062
|
}
|
|
12675
13063
|
getSrc() {
|
|
@@ -12684,6 +13072,9 @@
|
|
|
12684
13072
|
setWidth(w) {
|
|
12685
13073
|
this._ref.width(w);
|
|
12686
13074
|
this._ref.height(w * this._ratio);
|
|
13075
|
+
const rightLowerPoint = { x: this._ref.x() + w, y: this._ref.y() + this._ref.height() };
|
|
13076
|
+
const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
|
|
13077
|
+
this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
|
|
12687
13078
|
}
|
|
12688
13079
|
getHeight() {
|
|
12689
13080
|
return this._ref.height();
|
|
@@ -12691,6 +13082,9 @@
|
|
|
12691
13082
|
setHeight(h) {
|
|
12692
13083
|
this._ref.height(h);
|
|
12693
13084
|
this._ref.width(h / this._ratio);
|
|
13085
|
+
const rightLowerPoint = { x: this._ref.x() + this._ref.width(), y: this._ref.y() + h };
|
|
13086
|
+
const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
|
|
13087
|
+
this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
|
|
12694
13088
|
}
|
|
12695
13089
|
ref() {
|
|
12696
13090
|
return this._ref;
|
|
@@ -12725,21 +13119,82 @@
|
|
|
12725
13119
|
}
|
|
12726
13120
|
setPosition(x, y) {
|
|
12727
13121
|
this._ref.setPosition({ x, y });
|
|
13122
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x, y }));
|
|
13123
|
+
const rightLowerPoint = { x: x + this._ref.width(), y: y + this._ref.y() };
|
|
13124
|
+
const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
|
|
13125
|
+
this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
|
|
13126
|
+
}
|
|
13127
|
+
updateScreenCoordinates() {
|
|
13128
|
+
let screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
|
|
13129
|
+
let screenPositionEnd = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
|
|
13130
|
+
let invert = this._ref.getStage().getAbsoluteTransform().copy();
|
|
13131
|
+
invert = invert.invert();
|
|
13132
|
+
const positionStart = invert.point(screenPositionStart);
|
|
13133
|
+
const positionEnd = invert.point(screenPositionEnd);
|
|
13134
|
+
this._ref.position({ x: positionStart.x, y: positionStart.y });
|
|
13135
|
+
this._ref.width(Math.abs(positionEnd.x - positionStart.x));
|
|
13136
|
+
this._ref.height(Math.abs(positionEnd.y - positionStart.y));
|
|
12728
13137
|
}
|
|
12729
13138
|
}
|
|
12730
13139
|
|
|
13140
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
13141
|
+
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
13142
|
+
// All rights reserved.
|
|
13143
|
+
//
|
|
13144
|
+
// This software and its documentation and related materials are owned by
|
|
13145
|
+
// the Alliance. The software may only be incorporated into application
|
|
13146
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
13147
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
13148
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
13149
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
13150
|
+
// protected by copyright law and international treaty provisions. Application
|
|
13151
|
+
// programs incorporating this software must include the following statement
|
|
13152
|
+
// with their copyright notices:
|
|
13153
|
+
//
|
|
13154
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
13155
|
+
// license agreement with Open Design Alliance.
|
|
13156
|
+
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
|
|
13157
|
+
// All rights reserved.
|
|
13158
|
+
//
|
|
13159
|
+
// By use of this software, its documentation or related materials, you
|
|
13160
|
+
// acknowledge and accept the above terms.
|
|
13161
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
12731
13162
|
class KonvaCloud {
|
|
12732
|
-
constructor(params, ref = null) {
|
|
13163
|
+
constructor(params, ref = null, worldTransformer = new WorldTransform()) {
|
|
12733
13164
|
var _a, _b, _c, _d;
|
|
13165
|
+
this._worldTransformer = worldTransformer;
|
|
12734
13166
|
if (ref) {
|
|
12735
13167
|
this._ref = ref;
|
|
13168
|
+
const wcsStart = this._ref.getAttr("wcsStart");
|
|
13169
|
+
const wcsEnd = this._ref.getAttr("wcsEnd");
|
|
13170
|
+
if (!wcsStart) {
|
|
13171
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: ref.x(), y: ref.y() }));
|
|
13172
|
+
}
|
|
13173
|
+
if (!wcsEnd) {
|
|
13174
|
+
const rightBottomPoint = { x: ref.x() + ref.width(), y: ref.y() + ref.height() };
|
|
13175
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: rightBottomPoint.x, y: rightBottomPoint.y }));
|
|
13176
|
+
}
|
|
12736
13177
|
return;
|
|
12737
13178
|
}
|
|
12738
13179
|
if (!params)
|
|
12739
13180
|
params = {};
|
|
12740
13181
|
if (!params.position)
|
|
12741
13182
|
params.position = { x: 0, y: 0 };
|
|
12742
|
-
|
|
13183
|
+
if (params.position2) {
|
|
13184
|
+
params.width = params.position2.x - params.position.x;
|
|
13185
|
+
params.height = params.position2.y - params.position.y;
|
|
13186
|
+
}
|
|
13187
|
+
else {
|
|
13188
|
+
if (!params.width || !params.height) {
|
|
13189
|
+
params.position2 = { x: 200, y: 200 };
|
|
13190
|
+
params.width = 200;
|
|
13191
|
+
params.height = 200;
|
|
13192
|
+
}
|
|
13193
|
+
else {
|
|
13194
|
+
params.position2 = { x: params.position.x + params.width, y: params.position.y + params.height };
|
|
13195
|
+
}
|
|
13196
|
+
}
|
|
13197
|
+
const ARC_RADIUS = 16;
|
|
12743
13198
|
this._ref = new Konva.Shape({
|
|
12744
13199
|
x: params.position.x,
|
|
12745
13200
|
y: params.position.y,
|
|
@@ -12783,10 +13238,10 @@
|
|
|
12783
13238
|
const counterClockwise = pX > midPoint.x && pY > midPoint.y;
|
|
12784
13239
|
for (let iArc = 0; iArc < arcCount; iArc++) {
|
|
12785
13240
|
if (counterClockwise) {
|
|
12786
|
-
context.arc(pX, pY,
|
|
13241
|
+
context.arc(pX, pY, ARC_RADIUS, endAngle, startAngle);
|
|
12787
13242
|
}
|
|
12788
13243
|
else {
|
|
12789
|
-
context.arc(pX, pY,
|
|
13244
|
+
context.arc(pX, pY, ARC_RADIUS, startAngle, endAngle);
|
|
12790
13245
|
}
|
|
12791
13246
|
pX += dx / arcCount;
|
|
12792
13247
|
pY += dy / arcCount;
|
|
@@ -12799,10 +13254,10 @@
|
|
|
12799
13254
|
},
|
|
12800
13255
|
});
|
|
12801
13256
|
this._ref.className = "Cloud";
|
|
13257
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: params.position.x, y: params.position.y }));
|
|
13258
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: params.position2.x, y: params.position2.y }));
|
|
12802
13259
|
this._ref.on("transform", (e) => {
|
|
12803
13260
|
const attrs = e.target.attrs;
|
|
12804
|
-
if (attrs.rotation !== this._ref.rotation())
|
|
12805
|
-
this._ref.rotation(attrs.rotation);
|
|
12806
13261
|
const scaleByX = Math.abs(attrs.scaleX - 1) > 10e-6;
|
|
12807
13262
|
const scaleByY = Math.abs(attrs.scaleY - 1) > 10e-6;
|
|
12808
13263
|
let newWidth = this._ref.width();
|
|
@@ -12825,12 +13280,27 @@
|
|
|
12825
13280
|
}
|
|
12826
13281
|
this._ref.scale({ x: 1, y: 1 });
|
|
12827
13282
|
});
|
|
13283
|
+
this._ref.on("transformend", (e) => {
|
|
13284
|
+
const attrs = e.target.attrs;
|
|
13285
|
+
if (attrs.rotation !== this._ref.rotation())
|
|
13286
|
+
this._ref.rotation(attrs.rotation);
|
|
13287
|
+
const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
|
|
13288
|
+
const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
|
|
13289
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
|
|
13290
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: position.x + this._ref.width(), y: position.y + this._ref.height() }));
|
|
13291
|
+
});
|
|
13292
|
+
this._ref.on("dragend", (e) => {
|
|
13293
|
+
const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
|
|
13294
|
+
const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
|
|
13295
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
|
|
13296
|
+
this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: position.x + this._ref.width(), y: position.y + this._ref.height() }));
|
|
13297
|
+
});
|
|
12828
13298
|
this._ref.getSelfRect = () => {
|
|
12829
13299
|
return {
|
|
12830
|
-
x: 0 -
|
|
12831
|
-
y: 0 -
|
|
12832
|
-
width: this._ref.width() + 2 *
|
|
12833
|
-
height: this._ref.height() + 2 *
|
|
13300
|
+
x: 0 - ARC_RADIUS,
|
|
13301
|
+
y: 0 - ARC_RADIUS,
|
|
13302
|
+
width: this._ref.width() + 2 * ARC_RADIUS,
|
|
13303
|
+
height: this._ref.height() + 2 * ARC_RADIUS,
|
|
12834
13304
|
};
|
|
12835
13305
|
};
|
|
12836
13306
|
this._ref.id(this._ref._id.toString());
|
|
@@ -12874,18 +13344,28 @@
|
|
|
12874
13344
|
}
|
|
12875
13345
|
setPosition(x, y) {
|
|
12876
13346
|
this._ref.position({ x, y });
|
|
13347
|
+
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x, y }));
|
|
13348
|
+
const rightLowerPoint = { x: x + this._ref.width(), y: y + this._ref.y() };
|
|
13349
|
+
const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
|
|
13350
|
+
this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
|
|
12877
13351
|
}
|
|
12878
13352
|
getWidth() {
|
|
12879
13353
|
return this._ref.width();
|
|
12880
13354
|
}
|
|
12881
13355
|
setWidth(w) {
|
|
12882
13356
|
this._ref.width(w);
|
|
13357
|
+
const rightLowerPoint = { x: this._ref.x() + w, y: this._ref.y() + this._ref.height() };
|
|
13358
|
+
const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
|
|
13359
|
+
this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
|
|
12883
13360
|
}
|
|
12884
13361
|
getHeigth() {
|
|
12885
13362
|
return this._ref.height();
|
|
12886
13363
|
}
|
|
12887
13364
|
setHeight(h) {
|
|
12888
13365
|
this._ref.height(h);
|
|
13366
|
+
const rightLowerPoint = { x: this._ref.x() + this._ref.width(), y: this._ref.y() + h };
|
|
13367
|
+
const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
|
|
13368
|
+
this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
|
|
12889
13369
|
}
|
|
12890
13370
|
getLineWidth() {
|
|
12891
13371
|
return this._ref.strokeWidth();
|
|
@@ -12893,6 +13373,17 @@
|
|
|
12893
13373
|
setLineWidth(size) {
|
|
12894
13374
|
this._ref.strokeWidth(size);
|
|
12895
13375
|
}
|
|
13376
|
+
updateScreenCoordinates() {
|
|
13377
|
+
let screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
|
|
13378
|
+
let screenPositionEnd = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
|
|
13379
|
+
let invert = this._ref.getStage().getAbsoluteTransform().copy();
|
|
13380
|
+
invert = invert.invert();
|
|
13381
|
+
const positionStart = invert.point(screenPositionStart);
|
|
13382
|
+
const positionEnd = invert.point(screenPositionEnd);
|
|
13383
|
+
this._ref.position({ x: positionStart.x, y: positionStart.y });
|
|
13384
|
+
this._ref.width(Math.abs(positionEnd.x - positionStart.x));
|
|
13385
|
+
this._ref.height(Math.abs(positionEnd.y - positionStart.y));
|
|
13386
|
+
}
|
|
12896
13387
|
}
|
|
12897
13388
|
|
|
12898
13389
|
///////////////////////////////////////////////////////////////////////////////
|
|
@@ -12924,39 +13415,50 @@
|
|
|
12924
13415
|
},
|
|
12925
13416
|
Line: {
|
|
12926
13417
|
name: "Line",
|
|
12927
|
-
initializer: (ref, params = null) => new KonvaLine(params, ref),
|
|
13418
|
+
initializer: (ref, params = null, ...attr) => new KonvaLine(params, ref, ...attr),
|
|
12928
13419
|
},
|
|
12929
13420
|
Text: {
|
|
12930
13421
|
name: "Text",
|
|
12931
|
-
initializer: (ref, params = null) => new KonvaText(params, ref),
|
|
13422
|
+
initializer: (ref, params = null, ...attr) => new KonvaText(params, ref, ...attr),
|
|
12932
13423
|
},
|
|
12933
13424
|
Rectangle: {
|
|
12934
13425
|
name: "Rect",
|
|
12935
|
-
initializer: (ref, params = null) => new KonvaRectangle(params, ref),
|
|
13426
|
+
initializer: (ref, params = null, ...attr) => new KonvaRectangle(params, ref, ...attr),
|
|
12936
13427
|
},
|
|
12937
13428
|
Ellipse: {
|
|
12938
13429
|
name: "Ellipse",
|
|
12939
|
-
initializer: (ref, params = null) => new KonvaEllipse(params, ref),
|
|
13430
|
+
initializer: (ref, params = null, ...attr) => new KonvaEllipse(params, ref, ...attr),
|
|
12940
13431
|
},
|
|
12941
13432
|
Arrow: {
|
|
12942
13433
|
name: "Arrow",
|
|
12943
|
-
initializer: (ref, params = null) => new KonvaArrow(params, ref),
|
|
13434
|
+
initializer: (ref, params = null, ...attr) => new KonvaArrow(params, ref, ...attr),
|
|
12944
13435
|
},
|
|
12945
13436
|
Image: {
|
|
12946
13437
|
name: "Image",
|
|
12947
|
-
initializer: (ref, params = null) => new KonvaImage(params, ref),
|
|
13438
|
+
initializer: (ref, params = null, ...attr) => new KonvaImage(params, ref, ...attr),
|
|
12948
13439
|
},
|
|
12949
13440
|
Cloud: {
|
|
12950
13441
|
name: "Cloud",
|
|
12951
|
-
initializer: (ref, params = null) => new KonvaCloud(params, ref),
|
|
13442
|
+
initializer: (ref, params = null, ...attr) => new KonvaCloud(params, ref, ...attr),
|
|
12952
13443
|
},
|
|
12953
13444
|
};
|
|
13445
|
+
function debounce(func, wait) {
|
|
13446
|
+
let timeout = null;
|
|
13447
|
+
return (...args) => {
|
|
13448
|
+
if (timeout) {
|
|
13449
|
+
clearTimeout(timeout);
|
|
13450
|
+
}
|
|
13451
|
+
timeout = setTimeout(() => {
|
|
13452
|
+
timeout = null;
|
|
13453
|
+
func(...args);
|
|
13454
|
+
}, wait);
|
|
13455
|
+
};
|
|
13456
|
+
}
|
|
12954
13457
|
/**
|
|
12955
13458
|
* 2D markup core.
|
|
12956
13459
|
*/
|
|
12957
13460
|
class KonvaMarkup {
|
|
12958
13461
|
constructor() {
|
|
12959
|
-
this._containerEvents = [];
|
|
12960
13462
|
this._markupIsActive = false;
|
|
12961
13463
|
this._markupColor = new MarkupColor(255, 0, 0);
|
|
12962
13464
|
this.lineWidth = 4;
|
|
@@ -12982,22 +13484,31 @@
|
|
|
12982
13484
|
return;
|
|
12983
13485
|
this._konvaStage.width(width);
|
|
12984
13486
|
this._konvaStage.height(height);
|
|
13487
|
+
this.getObjects().forEach((markupObject) => {
|
|
13488
|
+
markupObject.updateScreenCoordinates();
|
|
13489
|
+
});
|
|
13490
|
+
};
|
|
13491
|
+
this.resizeViewer = (event) => {
|
|
13492
|
+
const { width, height } = event;
|
|
13493
|
+
if (!width || !height)
|
|
13494
|
+
return; // <- invisible container, or container with parent removed
|
|
13495
|
+
if (!this._konvaStage)
|
|
13496
|
+
return;
|
|
13497
|
+
this._konvaStage.width(width);
|
|
13498
|
+
this._konvaStage.height(height);
|
|
13499
|
+
this.getObjects().forEach((markupObject) => {
|
|
13500
|
+
markupObject.updateScreenCoordinates();
|
|
13501
|
+
});
|
|
12985
13502
|
};
|
|
12986
13503
|
this.pan = (event) => {
|
|
12987
|
-
|
|
12988
|
-
|
|
12989
|
-
|
|
12990
|
-
};
|
|
12991
|
-
this._konvaStage.position(newPos);
|
|
13504
|
+
this.getObjects().forEach((markupObject) => {
|
|
13505
|
+
markupObject.updateScreenCoordinates();
|
|
13506
|
+
});
|
|
12992
13507
|
};
|
|
12993
13508
|
this.zoomAt = (event) => {
|
|
12994
|
-
|
|
12995
|
-
|
|
12996
|
-
|
|
12997
|
-
x: event.x - (event.x - this._konvaStage.x()) * event.data,
|
|
12998
|
-
y: event.y - (event.y - this._konvaStage.y()) * event.data,
|
|
12999
|
-
};
|
|
13000
|
-
this._konvaStage.position(newPos);
|
|
13509
|
+
this.getObjects().forEach((markupObject) => {
|
|
13510
|
+
markupObject.updateScreenCoordinates();
|
|
13511
|
+
});
|
|
13001
13512
|
};
|
|
13002
13513
|
this.redirectToViewer = (event) => {
|
|
13003
13514
|
if (this._viewer)
|
|
@@ -13022,7 +13533,6 @@
|
|
|
13022
13533
|
this._viewer = viewer;
|
|
13023
13534
|
this._worldTransformer = worldTransformer !== null && worldTransformer !== undefined ? worldTransformer : new WorldTransform();
|
|
13024
13535
|
this._container = container;
|
|
13025
|
-
this._containerEvents = containerEvents !== null && containerEvents !== undefined ? containerEvents : [];
|
|
13026
13536
|
this._markupContainer = document.createElement("div");
|
|
13027
13537
|
this._markupContainer.id = "markup-container";
|
|
13028
13538
|
this._markupContainer.style.position = "absolute";
|
|
@@ -13032,12 +13542,13 @@
|
|
|
13032
13542
|
this._markupContainer.style.pointerEvents = "none";
|
|
13033
13543
|
const parentDiv = this._container.parentElement;
|
|
13034
13544
|
parentDiv.appendChild(this._markupContainer);
|
|
13035
|
-
|
|
13036
|
-
|
|
13545
|
+
if (viewer)
|
|
13546
|
+
this._viewer.addEventListener("resize", this.resizeViewer);
|
|
13547
|
+
else
|
|
13548
|
+
this._resizeObserver = new ResizeObserver(debounce(this.resizeContainer, 100));
|
|
13037
13549
|
this._markupColor.setColor(255, 0, 0);
|
|
13038
13550
|
this.initializeKonva();
|
|
13039
13551
|
if (this._viewer) {
|
|
13040
|
-
// this._containerEvents.forEach((x) => this._markupContainer.addEventListener(x, this.redirectToViewer));
|
|
13041
13552
|
this._viewer.addEventListener("changeactivedragger", this.changeActiveDragger);
|
|
13042
13553
|
this._viewer.addEventListener("pan", this.pan);
|
|
13043
13554
|
this._viewer.addEventListener("zoomat", this.zoomAt);
|
|
@@ -13049,7 +13560,6 @@
|
|
|
13049
13560
|
this._viewer.removeEventListener("zoomat", this.zoomAt);
|
|
13050
13561
|
this._viewer.removeEventListener("pan", this.pan);
|
|
13051
13562
|
this._viewer.removeEventListener("changeactivedragger", this.changeActiveDragger);
|
|
13052
|
-
// this._containerEvents.forEach((x) => this._markupContainer.removeEventListener(x, this.redirectToViewer));
|
|
13053
13563
|
}
|
|
13054
13564
|
this.destroyKonva();
|
|
13055
13565
|
(_a = this._resizeObserver) === null || _a === undefined ? undefined : _a.disconnect();
|
|
@@ -13107,11 +13617,14 @@
|
|
|
13107
13617
|
});
|
|
13108
13618
|
(_d = viewpoint.rectangles) === null || _d === undefined ? undefined : _d.forEach((rect) => {
|
|
13109
13619
|
const screenPoint = this._worldTransformer.worldToScreen(rect.position);
|
|
13110
|
-
|
|
13620
|
+
const screenPoint2 = rect.position2 ? this._worldTransformer.worldToScreen(rect.position2) : null;
|
|
13621
|
+
this.addRectangle(screenPoint, screenPoint2, rect.width, rect.height, rect.line_width, rect.color, rect.id);
|
|
13111
13622
|
});
|
|
13112
13623
|
(_e = viewpoint.ellipses) === null || _e === undefined ? undefined : _e.forEach((ellipse) => {
|
|
13113
13624
|
const screenPoint = this._worldTransformer.worldToScreen(ellipse.position);
|
|
13114
|
-
|
|
13625
|
+
const screenPoint2 = ellipse.position2 ? this._worldTransformer.worldToScreen(ellipse.position2) : null;
|
|
13626
|
+
const screenPoint3 = ellipse.position3 ? this._worldTransformer.worldToScreen(ellipse.position3) : null;
|
|
13627
|
+
this.addEllipse(screenPoint, screenPoint2, screenPoint3, ellipse.radius, ellipse.line_width, ellipse.color, ellipse.id);
|
|
13115
13628
|
});
|
|
13116
13629
|
(_f = viewpoint.arrows) === null || _f === undefined ? undefined : _f.forEach((arrow) => {
|
|
13117
13630
|
const startPoint = this._worldTransformer.worldToScreen(arrow.start);
|
|
@@ -13120,11 +13633,13 @@
|
|
|
13120
13633
|
});
|
|
13121
13634
|
(_g = viewpoint.clouds) === null || _g === undefined ? undefined : _g.forEach((cloud) => {
|
|
13122
13635
|
const screenPoint = this._worldTransformer.worldToScreen(cloud.position);
|
|
13123
|
-
|
|
13636
|
+
const screenPoint2 = cloud.position2 ? this._worldTransformer.worldToScreen(cloud.position2) : null;
|
|
13637
|
+
this.addCloud(screenPoint, screenPoint2, cloud.width, cloud.height, cloud.line_width, cloud.color, cloud.id);
|
|
13124
13638
|
});
|
|
13125
13639
|
(_h = viewpoint.images) === null || _h === undefined ? undefined : _h.forEach((image) => {
|
|
13126
13640
|
const screenPoint = this._worldTransformer.worldToScreen(image.position);
|
|
13127
|
-
|
|
13641
|
+
const screenPoint2 = image.position2 ? this._worldTransformer.worldToScreen(image.position2) : null;
|
|
13642
|
+
this.addImage(screenPoint, screenPoint2, image.src, image.width, image.height, image.id);
|
|
13128
13643
|
});
|
|
13129
13644
|
}
|
|
13130
13645
|
getViewpoint(viewpoint) {
|
|
@@ -13160,7 +13675,7 @@
|
|
|
13160
13675
|
const konvaShape = MarkupMode2Konva[type];
|
|
13161
13676
|
if (!konvaShape || !konvaShape.initializer)
|
|
13162
13677
|
throw new Error(`Markup CreateObject - unsupported markup type ${type}`);
|
|
13163
|
-
const object = konvaShape.initializer(null, params);
|
|
13678
|
+
const object = konvaShape.initializer(null, params, this._worldTransformer);
|
|
13164
13679
|
this.addObject(object);
|
|
13165
13680
|
return object;
|
|
13166
13681
|
}
|
|
@@ -13168,7 +13683,7 @@
|
|
|
13168
13683
|
const objects = [];
|
|
13169
13684
|
Object.keys(MarkupMode2Konva).forEach((type) => {
|
|
13170
13685
|
const konvaShape = MarkupMode2Konva[type];
|
|
13171
|
-
this.konvaLayerFind(type).forEach((ref) => objects.push(konvaShape.initializer(ref)));
|
|
13686
|
+
this.konvaLayerFind(type).forEach((ref) => objects.push(konvaShape.initializer(ref, null, this._worldTransformer)));
|
|
13172
13687
|
});
|
|
13173
13688
|
return objects;
|
|
13174
13689
|
}
|
|
@@ -13180,7 +13695,7 @@
|
|
|
13180
13695
|
.map((ref) => {
|
|
13181
13696
|
const name = ref.className;
|
|
13182
13697
|
const konvaShape = Object.values(MarkupMode2Konva).find((shape) => shape.name === name);
|
|
13183
|
-
return konvaShape ? konvaShape.initializer(ref) : null;
|
|
13698
|
+
return konvaShape ? konvaShape.initializer(ref, null, this._worldTransformer) : null;
|
|
13184
13699
|
})
|
|
13185
13700
|
.filter((x) => x);
|
|
13186
13701
|
}
|
|
@@ -13272,16 +13787,16 @@
|
|
|
13272
13787
|
const dY = defParams ? 200 : Math.abs(mouseDownPos.y - pos.y);
|
|
13273
13788
|
if (defParams) {
|
|
13274
13789
|
if (this._markupMode === "Rectangle") {
|
|
13275
|
-
this.addRectangle({ x: startX, y: startY }, dX, dY);
|
|
13790
|
+
this.addRectangle({ x: startX, y: startY }, null, dX, dY);
|
|
13276
13791
|
}
|
|
13277
13792
|
else if (this._markupMode === "Ellipse") {
|
|
13278
|
-
this.addEllipse({ x: startX, y: startY }, { x: dX / 2, y: dY / 2 });
|
|
13793
|
+
this.addEllipse({ x: startX, y: startY }, null, null, { x: dX / 2, y: dY / 2 });
|
|
13279
13794
|
}
|
|
13280
13795
|
else if (this._markupMode === "Arrow") {
|
|
13281
13796
|
this.addArrow({ x: mouseDownPos.x, y: mouseDownPos.y }, { x: defParams ? mouseDownPos.x + 200 : pos.x, y: defParams ? startY : pos.y });
|
|
13282
13797
|
}
|
|
13283
13798
|
else if (this._markupMode === "Cloud") {
|
|
13284
|
-
this.addCloud({ x: startX, y: startY }, Math.max(100, dX), Math.max(100, dY));
|
|
13799
|
+
this.addCloud({ x: startX, y: startY }, null, Math.max(100, dX), Math.max(100, dY));
|
|
13285
13800
|
}
|
|
13286
13801
|
}
|
|
13287
13802
|
}
|
|
@@ -13318,7 +13833,7 @@
|
|
|
13318
13833
|
lastObj.setHeight(dY);
|
|
13319
13834
|
}
|
|
13320
13835
|
else
|
|
13321
|
-
lastObj = this.addRectangle({ x: startX, y: startY }, dX, dY);
|
|
13836
|
+
lastObj = this.addRectangle({ x: startX, y: startY }, null, dX, dY);
|
|
13322
13837
|
}
|
|
13323
13838
|
else if (this._markupMode === "Ellipse") {
|
|
13324
13839
|
if (lastObj) {
|
|
@@ -13327,7 +13842,7 @@
|
|
|
13327
13842
|
lastObj.setRadiusY(dY);
|
|
13328
13843
|
}
|
|
13329
13844
|
else
|
|
13330
|
-
lastObj = this.addEllipse({ x: startX, y: startY }, { x: dX, y: dY });
|
|
13845
|
+
lastObj = this.addEllipse({ x: startX, y: startY }, null, null, { x: dX, y: dY });
|
|
13331
13846
|
}
|
|
13332
13847
|
else if (this._markupMode === "Cloud") {
|
|
13333
13848
|
if (lastObj) {
|
|
@@ -13336,7 +13851,7 @@
|
|
|
13336
13851
|
lastObj.setHeight(Math.max(100, dY));
|
|
13337
13852
|
}
|
|
13338
13853
|
else
|
|
13339
|
-
lastObj = this.addCloud({ x: startX, y: startY }, dX, dY);
|
|
13854
|
+
lastObj = this.addCloud({ x: startX, y: startY }, null, dX, dY);
|
|
13340
13855
|
}
|
|
13341
13856
|
});
|
|
13342
13857
|
// clicks should select/deselect shapes
|
|
@@ -13355,7 +13870,7 @@
|
|
|
13355
13870
|
}
|
|
13356
13871
|
else if (this._markupMode === "Image") {
|
|
13357
13872
|
if (this._imageInputRef && this._imageInputRef.value)
|
|
13358
|
-
this.addImage({ x: this._imageInputPos.x, y: this._imageInputPos.y }, this._imageInputRef.value, 0, 0, this._imageInputRef.value);
|
|
13873
|
+
this.addImage({ x: this._imageInputPos.x, y: this._imageInputPos.y }, null, this._imageInputRef.value, 0, 0, this._imageInputRef.value);
|
|
13359
13874
|
else if (transformer.nodes().length === 0) {
|
|
13360
13875
|
const pos = this.getRelativePointerPosition(stage);
|
|
13361
13876
|
this.createImageInput(pos);
|
|
@@ -13379,7 +13894,7 @@
|
|
|
13379
13894
|
if (this._markupMode === "Image" || this._markupMode === "SelectMarkup") {
|
|
13380
13895
|
if (e.target.className === "Image" && transformer.nodes().length === 1 && transformer.nodes()[0] === e.target) {
|
|
13381
13896
|
if (this._imageInputRef && this._imageInputRef.value)
|
|
13382
|
-
this.addImage(this._imageInputPos, this._imageInputRef.value, 0, 0);
|
|
13897
|
+
this.addImage(this._imageInputPos, null, this._imageInputRef.value, 0, 0);
|
|
13383
13898
|
else
|
|
13384
13899
|
this.createImageInput({ x: e.target.attrs.x, y: e.target.attrs.y });
|
|
13385
13900
|
return;
|
|
@@ -13450,25 +13965,13 @@
|
|
|
13450
13965
|
getMarkupLines() {
|
|
13451
13966
|
const lines = [];
|
|
13452
13967
|
this.konvaLayerFind("Line").forEach((ref) => {
|
|
13453
|
-
const
|
|
13454
|
-
if (!
|
|
13968
|
+
const wcsPoints = ref.getAttr("wcsPoints");
|
|
13969
|
+
if (!wcsPoints)
|
|
13455
13970
|
return;
|
|
13456
|
-
const
|
|
13457
|
-
const absoluteTransform = ref.getAbsoluteTransform();
|
|
13458
|
-
for (let i = 0; i < linePoints.length; i += 2) {
|
|
13459
|
-
// we need getAbsoluteTransform because inside Konva position starts from {0, 0}
|
|
13460
|
-
// https://stackoverflow.com/a/57641487 - check answer's comments
|
|
13461
|
-
const atPoint = absoluteTransform.point({
|
|
13462
|
-
x: linePoints[i],
|
|
13463
|
-
y: linePoints[i + 1],
|
|
13464
|
-
});
|
|
13465
|
-
const worldPoint = this._worldTransformer.screenToWorld(atPoint);
|
|
13466
|
-
worldPoints.push(worldPoint);
|
|
13467
|
-
}
|
|
13468
|
-
const konvaLine = new KonvaLine(null, ref);
|
|
13971
|
+
const konvaLine = new KonvaLine(null, ref, this._worldTransformer);
|
|
13469
13972
|
const line = {
|
|
13470
13973
|
id: konvaLine.id(),
|
|
13471
|
-
points:
|
|
13974
|
+
points: wcsPoints,
|
|
13472
13975
|
color: konvaLine.getColor() || "#ff0000",
|
|
13473
13976
|
type: konvaLine.getLineType() || this.lineType,
|
|
13474
13977
|
width: konvaLine.getLineWidth() || this.lineWidth,
|
|
@@ -13482,14 +13985,12 @@
|
|
|
13482
13985
|
this.konvaLayerFind("Text").forEach((ref) => {
|
|
13483
13986
|
const textSize = 0.02;
|
|
13484
13987
|
const textScale = this._worldTransformer.getScale();
|
|
13485
|
-
const
|
|
13988
|
+
const wcsPosition = ref.getAttr("wcsStart");
|
|
13486
13989
|
const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
|
|
13487
|
-
const
|
|
13488
|
-
const worldPoint = this._worldTransformer.screenToWorld(atPoint);
|
|
13489
|
-
const shape = new KonvaText(null, ref);
|
|
13990
|
+
const shape = new KonvaText(null, ref, this._worldTransformer);
|
|
13490
13991
|
const text = {
|
|
13491
13992
|
id: shape.id(),
|
|
13492
|
-
position:
|
|
13993
|
+
position: wcsPosition,
|
|
13493
13994
|
text: shape.getText(),
|
|
13494
13995
|
text_size: textSize * textScale.y,
|
|
13495
13996
|
angle: shape.getRotation(),
|
|
@@ -13503,17 +14004,17 @@
|
|
|
13503
14004
|
getMarkupRectangles() {
|
|
13504
14005
|
const rectangles = [];
|
|
13505
14006
|
this.konvaLayerFind("Rectangle").forEach((ref) => {
|
|
13506
|
-
const
|
|
13507
|
-
const
|
|
13508
|
-
const
|
|
13509
|
-
const
|
|
13510
|
-
const
|
|
13511
|
-
const shape = new KonvaRectangle(null, ref);
|
|
14007
|
+
const wcsStart = ref.getAttr("wcsStart");
|
|
14008
|
+
const wcsEnd = ref.getAttr("wcsEnd");
|
|
14009
|
+
const screenStart = this._worldTransformer.worldToScreen(wcsStart);
|
|
14010
|
+
const screenEnd = this._worldTransformer.worldToScreen(wcsEnd);
|
|
14011
|
+
const shape = new KonvaRectangle(null, ref, this._worldTransformer);
|
|
13512
14012
|
const rectangle = {
|
|
13513
14013
|
id: shape.id(),
|
|
13514
|
-
position:
|
|
13515
|
-
|
|
13516
|
-
|
|
14014
|
+
position: wcsStart,
|
|
14015
|
+
position2: wcsEnd,
|
|
14016
|
+
width: Math.abs(screenStart.x - screenEnd.x),
|
|
14017
|
+
height: Math.abs(screenStart.y - screenEnd.y),
|
|
13517
14018
|
line_width: shape.getLineWidth(),
|
|
13518
14019
|
color: shape.getColor(),
|
|
13519
14020
|
};
|
|
@@ -13524,15 +14025,17 @@
|
|
|
13524
14025
|
getMarkupEllipses() {
|
|
13525
14026
|
const ellipses = [];
|
|
13526
14027
|
this.konvaLayerFind("Ellipse").forEach((ref) => {
|
|
13527
|
-
const
|
|
14028
|
+
const wcsPosition = ref.getAttr("wcsPosition");
|
|
14029
|
+
const wcsPosition2 = ref.getAttr("wcsRadiusX");
|
|
14030
|
+
const wcsPosition3 = ref.getAttr("wcsRadiusY");
|
|
13528
14031
|
const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
|
|
13529
|
-
const atPoint = stageAbsoluteTransform.point({ x: position.x, y: position.y });
|
|
13530
|
-
const worldPoint = this._worldTransformer.screenToWorld(atPoint);
|
|
13531
14032
|
const scale = stageAbsoluteTransform.getMatrix()[0];
|
|
13532
|
-
const shape = new KonvaEllipse(null, ref);
|
|
14033
|
+
const shape = new KonvaEllipse(null, ref, this._worldTransformer);
|
|
13533
14034
|
const ellipse = {
|
|
13534
14035
|
id: shape.id(),
|
|
13535
|
-
position:
|
|
14036
|
+
position: wcsPosition,
|
|
14037
|
+
position2: wcsPosition2,
|
|
14038
|
+
position3: wcsPosition3,
|
|
13536
14039
|
radius: {
|
|
13537
14040
|
x: ref.getRadiusX() * scale,
|
|
13538
14041
|
y: ref.getRadiusY() * scale,
|
|
@@ -13548,22 +14051,13 @@
|
|
|
13548
14051
|
const arrows = [];
|
|
13549
14052
|
this.konvaLayerFind("Arrow").forEach((ref) => {
|
|
13550
14053
|
// we need getAbsoluteTransform because inside Konva position starts from {0, 0}
|
|
13551
|
-
const
|
|
13552
|
-
const
|
|
13553
|
-
|
|
13554
|
-
y: ref.points()[1],
|
|
13555
|
-
});
|
|
13556
|
-
const worldStartPoint = this._worldTransformer.screenToWorld(atStartPoint);
|
|
13557
|
-
const atEndPoint = absoluteTransform.point({
|
|
13558
|
-
x: ref.points()[2],
|
|
13559
|
-
y: ref.points()[3],
|
|
13560
|
-
});
|
|
13561
|
-
const worldEndPoint = this._worldTransformer.screenToWorld(atEndPoint);
|
|
13562
|
-
const shape = new KonvaArrow(null, ref);
|
|
14054
|
+
const wcsStart = ref.getAttr("wcsStart");
|
|
14055
|
+
const wcsEnd = ref.getAttr("wcsEnd");
|
|
14056
|
+
const shape = new KonvaArrow(null, ref, this._worldTransformer);
|
|
13563
14057
|
const arrow = {
|
|
13564
14058
|
id: shape.id(),
|
|
13565
|
-
start:
|
|
13566
|
-
end:
|
|
14059
|
+
start: wcsStart,
|
|
14060
|
+
end: wcsEnd,
|
|
13567
14061
|
color: shape.getColor(),
|
|
13568
14062
|
};
|
|
13569
14063
|
arrows.push(arrow);
|
|
@@ -13573,15 +14067,15 @@
|
|
|
13573
14067
|
getMarkupImages() {
|
|
13574
14068
|
const images = [];
|
|
13575
14069
|
this.konvaLayerFind("Image").forEach((ref) => {
|
|
13576
|
-
const
|
|
14070
|
+
const wcsStart = ref.getAttr("wcsStart");
|
|
14071
|
+
const wcsEnd = ref.getAttr("wcsEnd");
|
|
13577
14072
|
const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
|
|
13578
|
-
const atPoint = stageAbsoluteTransform.point({ x: position.x, y: position.y });
|
|
13579
|
-
const worldPoint = this._worldTransformer.screenToWorld(atPoint);
|
|
13580
14073
|
const scale = stageAbsoluteTransform.getMatrix()[0];
|
|
13581
|
-
const shape = new KonvaImage(null, ref);
|
|
14074
|
+
const shape = new KonvaImage(null, ref, this._worldTransformer);
|
|
13582
14075
|
const image = {
|
|
13583
14076
|
id: shape.id(),
|
|
13584
|
-
position:
|
|
14077
|
+
position: wcsStart,
|
|
14078
|
+
position2: wcsEnd,
|
|
13585
14079
|
src: shape.getSrc(),
|
|
13586
14080
|
width: shape.getWidth() * scale,
|
|
13587
14081
|
height: shape.getHeight() * scale,
|
|
@@ -13593,17 +14087,17 @@
|
|
|
13593
14087
|
getMarkupClouds() {
|
|
13594
14088
|
const clouds = [];
|
|
13595
14089
|
this.konvaLayerFind("Cloud").forEach((ref) => {
|
|
13596
|
-
const
|
|
13597
|
-
const
|
|
13598
|
-
const
|
|
13599
|
-
const
|
|
13600
|
-
const
|
|
13601
|
-
const shape = new KonvaCloud(null, ref);
|
|
14090
|
+
const wcsStart = ref.getAttr("wcsStart");
|
|
14091
|
+
const wcsEnd = ref.getAttr("wcsEnd");
|
|
14092
|
+
const screenStart = this._worldTransformer.worldToScreen(wcsStart);
|
|
14093
|
+
const screenEnd = this._worldTransformer.worldToScreen(wcsEnd);
|
|
14094
|
+
const shape = new KonvaCloud(null, ref, this._worldTransformer);
|
|
13602
14095
|
const cloud = {
|
|
13603
14096
|
id: shape.id(),
|
|
13604
|
-
position:
|
|
13605
|
-
|
|
13606
|
-
|
|
14097
|
+
position: wcsStart,
|
|
14098
|
+
position2: wcsEnd,
|
|
14099
|
+
width: Math.abs(screenStart.x - screenEnd.x),
|
|
14100
|
+
height: Math.abs(screenStart.y - screenEnd.y),
|
|
13607
14101
|
line_width: shape.getLineWidth(),
|
|
13608
14102
|
color: shape.getColor(),
|
|
13609
14103
|
};
|
|
@@ -13637,7 +14131,7 @@
|
|
|
13637
14131
|
width: width || this.lineWidth,
|
|
13638
14132
|
color: color || this._markupColor.asHex(),
|
|
13639
14133
|
id,
|
|
13640
|
-
});
|
|
14134
|
+
}, null, this._worldTransformer);
|
|
13641
14135
|
this.addObject(konvaLine);
|
|
13642
14136
|
return konvaLine;
|
|
13643
14137
|
}
|
|
@@ -13704,7 +14198,7 @@
|
|
|
13704
14198
|
this._imageInputRef.onchange = async (event) => {
|
|
13705
14199
|
const file = event.target.files[0];
|
|
13706
14200
|
const base64 = await convertBase64(file);
|
|
13707
|
-
this.addImage({ x: this._imageInputPos.x, y: this._imageInputPos.y }, base64.toString(), 0, 0);
|
|
14201
|
+
this.addImage({ x: this._imageInputPos.x, y: this._imageInputPos.y }, null, base64.toString(), 0, 0);
|
|
13708
14202
|
};
|
|
13709
14203
|
this._imageInputRef.oncancel = (event) => {
|
|
13710
14204
|
this.removeImageInput();
|
|
@@ -13746,34 +14240,37 @@
|
|
|
13746
14240
|
fontSize: fontSize || this.fontSize,
|
|
13747
14241
|
color: color || this._markupColor.asHex(),
|
|
13748
14242
|
id,
|
|
13749
|
-
});
|
|
14243
|
+
}, null, this._worldTransformer);
|
|
13750
14244
|
this.addObject(konvaText);
|
|
13751
14245
|
return konvaText;
|
|
13752
14246
|
}
|
|
13753
|
-
addRectangle(position, width, height, lineWidth, color, id) {
|
|
14247
|
+
addRectangle(position, position2, width, height, lineWidth, color, id) {
|
|
13754
14248
|
if (!position)
|
|
13755
14249
|
return;
|
|
13756
14250
|
const konvaRectangle = new KonvaRectangle({
|
|
13757
14251
|
position,
|
|
14252
|
+
position2,
|
|
13758
14253
|
width,
|
|
13759
14254
|
height,
|
|
13760
14255
|
lineWidth: lineWidth || this.lineWidth,
|
|
13761
14256
|
color: color || this._markupColor.asHex(),
|
|
13762
14257
|
id,
|
|
13763
|
-
});
|
|
14258
|
+
}, null, this._worldTransformer);
|
|
13764
14259
|
this.addObject(konvaRectangle);
|
|
13765
14260
|
return konvaRectangle;
|
|
13766
14261
|
}
|
|
13767
|
-
addEllipse(position, radius, lineWidth, color, id) {
|
|
14262
|
+
addEllipse(position, position2, position3, radius, lineWidth, color, id) {
|
|
13768
14263
|
if (!position)
|
|
13769
14264
|
return;
|
|
13770
14265
|
const konvaEllipse = new KonvaEllipse({
|
|
13771
14266
|
position,
|
|
14267
|
+
position2,
|
|
14268
|
+
position3,
|
|
13772
14269
|
radius,
|
|
13773
14270
|
lineWidth,
|
|
13774
14271
|
color: color || this._markupColor.asHex(),
|
|
13775
14272
|
id,
|
|
13776
|
-
});
|
|
14273
|
+
}, null, this._worldTransformer);
|
|
13777
14274
|
this.addObject(konvaEllipse);
|
|
13778
14275
|
return konvaEllipse;
|
|
13779
14276
|
}
|
|
@@ -13785,25 +14282,26 @@
|
|
|
13785
14282
|
end,
|
|
13786
14283
|
color: color || this._markupColor.asHex(),
|
|
13787
14284
|
id,
|
|
13788
|
-
});
|
|
14285
|
+
}, null, this._worldTransformer);
|
|
13789
14286
|
this.addObject(konvaArrow);
|
|
13790
14287
|
return konvaArrow;
|
|
13791
14288
|
}
|
|
13792
|
-
addCloud(position, width, height, lineWidth, color, id) {
|
|
14289
|
+
addCloud(position, position2, width, height, lineWidth, color, id) {
|
|
13793
14290
|
if (!position || !width || !height)
|
|
13794
14291
|
return;
|
|
13795
14292
|
const konvaCloud = new KonvaCloud({
|
|
13796
14293
|
position,
|
|
14294
|
+
position2,
|
|
13797
14295
|
width,
|
|
13798
14296
|
height,
|
|
13799
14297
|
color: color || this._markupColor.asHex(),
|
|
13800
14298
|
lineWidth: lineWidth || this.lineWidth,
|
|
13801
14299
|
id,
|
|
13802
|
-
});
|
|
14300
|
+
}, null, this._worldTransformer);
|
|
13803
14301
|
this.addObject(konvaCloud);
|
|
13804
14302
|
return konvaCloud;
|
|
13805
14303
|
}
|
|
13806
|
-
addImage(position, src, width, height, id) {
|
|
14304
|
+
addImage(position, position2, src, width, height, id) {
|
|
13807
14305
|
var _a;
|
|
13808
14306
|
if (!position || !src)
|
|
13809
14307
|
return;
|
|
@@ -13813,13 +14311,14 @@
|
|
|
13813
14311
|
this.removeImageInput();
|
|
13814
14312
|
const konvaImage = new KonvaImage({
|
|
13815
14313
|
position,
|
|
14314
|
+
position2,
|
|
13816
14315
|
src,
|
|
13817
14316
|
width,
|
|
13818
14317
|
height,
|
|
13819
14318
|
maxWidth: this._konvaStage.width() - position.x,
|
|
13820
14319
|
maxHeight: this._konvaStage.height() - position.y,
|
|
13821
14320
|
id,
|
|
13822
|
-
});
|
|
14321
|
+
}, null, this._worldTransformer);
|
|
13823
14322
|
this.addObject(konvaImage);
|
|
13824
14323
|
return konvaImage;
|
|
13825
14324
|
}
|