@inweb/markup 25.8.0 → 25.8.1
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 +45 -16
- package/dist/markup.js.map +1 -1
- package/dist/markup.min.js +1 -1
- package/dist/markup.module.js +35 -18
- package/dist/markup.module.js.map +1 -1
- package/lib/markup/Konva/KonvaMarkup.d.ts +0 -1
- package/lib/markup/WorldTransform.d.ts +23 -0
- package/package.json +3 -3
- package/src/markup/Konva/KonvaMarkup.ts +12 -17
- package/src/markup/WorldTransform.ts +36 -0
package/dist/markup.js
CHANGED
|
@@ -11525,6 +11525,40 @@
|
|
|
11525
11525
|
}
|
|
11526
11526
|
}
|
|
11527
11527
|
|
|
11528
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
11529
|
+
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
11530
|
+
// All rights reserved.
|
|
11531
|
+
//
|
|
11532
|
+
// This software and its documentation and related materials are owned by
|
|
11533
|
+
// the Alliance. The software may only be incorporated into application
|
|
11534
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
11535
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
11536
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
11537
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11538
|
+
// protected by copyright law and international treaty provisions. Application
|
|
11539
|
+
// programs incorporating this software must include the following statement
|
|
11540
|
+
// with their copyright notices:
|
|
11541
|
+
//
|
|
11542
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
11543
|
+
// license agreement with Open Design Alliance.
|
|
11544
|
+
// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
|
|
11545
|
+
// All rights reserved.
|
|
11546
|
+
//
|
|
11547
|
+
// By use of this software, its documentation or related materials, you
|
|
11548
|
+
// acknowledge and accept the above terms.
|
|
11549
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
11550
|
+
class WorldTransform {
|
|
11551
|
+
screenToWorld(position) {
|
|
11552
|
+
return { x: position.x, y: position.y, z: 0 };
|
|
11553
|
+
}
|
|
11554
|
+
worldToScreen(position) {
|
|
11555
|
+
return { x: position.x, y: position.y };
|
|
11556
|
+
}
|
|
11557
|
+
getScale() {
|
|
11558
|
+
return { x: 1, y: 1, z: 1 };
|
|
11559
|
+
}
|
|
11560
|
+
}
|
|
11561
|
+
|
|
11528
11562
|
const LineTypeSpecs = new Map([
|
|
11529
11563
|
["solid", []],
|
|
11530
11564
|
["dot", [30, 30, 0.001, 30]],
|
|
@@ -12427,7 +12461,7 @@
|
|
|
12427
12461
|
if (!Konva)
|
|
12428
12462
|
throw new Error('Markup: Error during initialization. Konva is not initialized. Update node_modules or add to your page <script src="https://unpkg.com/konva@9/konva.min.js"></script>');
|
|
12429
12463
|
this._viewer = viewer;
|
|
12430
|
-
this._worldTransformer = worldTransformer;
|
|
12464
|
+
this._worldTransformer = worldTransformer !== null && worldTransformer !== void 0 ? worldTransformer : new WorldTransform();
|
|
12431
12465
|
this._container = container;
|
|
12432
12466
|
this._pointerEvents = pointerEvents !== null && pointerEvents !== void 0 ? pointerEvents : [];
|
|
12433
12467
|
this._markupContainer = document.createElement("div");
|
|
@@ -12573,9 +12607,6 @@
|
|
|
12573
12607
|
clearSelected() {
|
|
12574
12608
|
this._konvaTransformer.nodes([]);
|
|
12575
12609
|
}
|
|
12576
|
-
getPoint3dFromArray(array) {
|
|
12577
|
-
return { x: array[0], y: array[1], z: array[2] };
|
|
12578
|
-
}
|
|
12579
12610
|
fillViewpointShapes(viewpoint) {
|
|
12580
12611
|
const markupLines = this.getMarkupLines();
|
|
12581
12612
|
if (markupLines && markupLines.length > 0) {
|
|
@@ -12870,7 +12901,7 @@
|
|
|
12870
12901
|
const konvaLine = new KonvaLine(null, line);
|
|
12871
12902
|
lines.push({
|
|
12872
12903
|
id: konvaLine.id(),
|
|
12873
|
-
points: worldPoints
|
|
12904
|
+
points: worldPoints,
|
|
12874
12905
|
color: konvaLine.getColor() || "#ff0000",
|
|
12875
12906
|
type: konvaLine.getLineType() || this.lineType,
|
|
12876
12907
|
width: konvaLine.getLineWidth() || this.lineWidth,
|
|
@@ -12885,14 +12916,12 @@
|
|
|
12885
12916
|
this.konvaLayerFind("Text").forEach((text) => {
|
|
12886
12917
|
if (!text)
|
|
12887
12918
|
return;
|
|
12888
|
-
const position =
|
|
12889
|
-
|
|
12890
|
-
y: text.y(),
|
|
12891
|
-
});
|
|
12919
|
+
const position = { x: text.x(), y: text.y() };
|
|
12920
|
+
const worldPoint = this._worldTransformer.screenToWorld(position);
|
|
12892
12921
|
const shape = new KonvaText(null, text);
|
|
12893
12922
|
texts.push({
|
|
12894
12923
|
id: shape.id(),
|
|
12895
|
-
position:
|
|
12924
|
+
position: worldPoint,
|
|
12896
12925
|
text: shape.getText(),
|
|
12897
12926
|
text_size: textSize * textScale.y,
|
|
12898
12927
|
angle: shape.getRotation(),
|
|
@@ -12910,7 +12939,7 @@
|
|
|
12910
12939
|
const shape = new KonvaRectangle(null, rect);
|
|
12911
12940
|
rectangles.push({
|
|
12912
12941
|
id: shape.id(),
|
|
12913
|
-
position:
|
|
12942
|
+
position: worldPoint,
|
|
12914
12943
|
width: shape.getWidth(),
|
|
12915
12944
|
height: shape.getHeigth(),
|
|
12916
12945
|
line_width: shape.getLineWidth(),
|
|
@@ -12927,7 +12956,7 @@
|
|
|
12927
12956
|
const shape = new KonvaEllipse(null, ellipse);
|
|
12928
12957
|
ellipses.push({
|
|
12929
12958
|
id: shape.id(),
|
|
12930
|
-
position:
|
|
12959
|
+
position: worldPoint,
|
|
12931
12960
|
radius: { x: ellipse.getRadiusX(), y: ellipse.getRadiusY() },
|
|
12932
12961
|
line_width: shape.getLineWidth(),
|
|
12933
12962
|
color: shape.getColor(),
|
|
@@ -12947,8 +12976,8 @@
|
|
|
12947
12976
|
const shape = new KonvaArrow(null, arrow);
|
|
12948
12977
|
arrows.push({
|
|
12949
12978
|
id: shape.id(),
|
|
12950
|
-
start:
|
|
12951
|
-
end:
|
|
12979
|
+
start: worldStartPoint,
|
|
12980
|
+
end: worldEndPoint,
|
|
12952
12981
|
color: shape.getColor(),
|
|
12953
12982
|
});
|
|
12954
12983
|
});
|
|
@@ -12962,7 +12991,7 @@
|
|
|
12962
12991
|
const shape = new KonvaImage(null, image);
|
|
12963
12992
|
images.push({
|
|
12964
12993
|
id: shape.id(),
|
|
12965
|
-
position:
|
|
12994
|
+
position: worldPoint,
|
|
12966
12995
|
src: shape.getSrc(),
|
|
12967
12996
|
width: shape.getWidth(),
|
|
12968
12997
|
height: shape.getHeight(),
|
|
@@ -12978,7 +13007,7 @@
|
|
|
12978
13007
|
const shape = new KonvaCloud(null, cloud);
|
|
12979
13008
|
clouds.push({
|
|
12980
13009
|
id: shape.id(),
|
|
12981
|
-
position:
|
|
13010
|
+
position: worldPoint,
|
|
12982
13011
|
width: shape.getWidth(),
|
|
12983
13012
|
height: shape.getHeigth(),
|
|
12984
13013
|
line_width: shape.getLineWidth(),
|