@inweb/markup 25.7.10 → 25.7.12
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 +24 -0
- package/package.json +3 -3
- package/src/markup/Konva/KonvaMarkup.ts +12 -17
- package/src/markup/WorldTransform.ts +38 -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]],
|
|
@@ -12421,7 +12455,7 @@
|
|
|
12421
12455
|
if (!Konva)
|
|
12422
12456
|
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>');
|
|
12423
12457
|
this._viewer = viewer;
|
|
12424
|
-
this._worldTransformer = worldTransformer;
|
|
12458
|
+
this._worldTransformer = worldTransformer !== null && worldTransformer !== void 0 ? worldTransformer : new WorldTransform();
|
|
12425
12459
|
this._container = container;
|
|
12426
12460
|
this._pointerEvents = pointerEvents !== null && pointerEvents !== void 0 ? pointerEvents : [];
|
|
12427
12461
|
this._markupContainer = document.createElement("div");
|
|
@@ -12634,9 +12668,6 @@
|
|
|
12634
12668
|
clearSelected() {
|
|
12635
12669
|
this._konvaTransformer.nodes([]);
|
|
12636
12670
|
}
|
|
12637
|
-
getPoint3dFromArray(array) {
|
|
12638
|
-
return { x: array[0], y: array[1], z: array[2] };
|
|
12639
|
-
}
|
|
12640
12671
|
fillViewpointShapes(viewpoint) {
|
|
12641
12672
|
const markupLines = this.getMarkupLines();
|
|
12642
12673
|
if (markupLines && markupLines.length > 0) {
|
|
@@ -12931,7 +12962,7 @@
|
|
|
12931
12962
|
const konvaLine = new KonvaLine(null, line);
|
|
12932
12963
|
lines.push({
|
|
12933
12964
|
id: konvaLine.id(),
|
|
12934
|
-
points: worldPoints
|
|
12965
|
+
points: worldPoints,
|
|
12935
12966
|
color: konvaLine.getColor() || "#ff0000",
|
|
12936
12967
|
type: konvaLine.getLineType() || this.lineType,
|
|
12937
12968
|
width: konvaLine.getLineWidth() || this.lineWidth,
|
|
@@ -12946,14 +12977,12 @@
|
|
|
12946
12977
|
this.konvaLayerFind("Text").forEach((text) => {
|
|
12947
12978
|
if (!text)
|
|
12948
12979
|
return;
|
|
12949
|
-
const position =
|
|
12950
|
-
|
|
12951
|
-
y: text.y(),
|
|
12952
|
-
});
|
|
12980
|
+
const position = { x: text.x(), y: text.y() };
|
|
12981
|
+
const worldPoint = this._worldTransformer.screenToWorld(position);
|
|
12953
12982
|
const shape = new KonvaText(null, text);
|
|
12954
12983
|
texts.push({
|
|
12955
12984
|
id: shape.id(),
|
|
12956
|
-
position:
|
|
12985
|
+
position: worldPoint,
|
|
12957
12986
|
text: shape.getText(),
|
|
12958
12987
|
text_size: textSize * textScale.y,
|
|
12959
12988
|
angle: shape.getRotation(),
|
|
@@ -12971,7 +13000,7 @@
|
|
|
12971
13000
|
const shape = new KonvaRectangle(null, rect);
|
|
12972
13001
|
rectangles.push({
|
|
12973
13002
|
id: shape.id(),
|
|
12974
|
-
position:
|
|
13003
|
+
position: worldPoint,
|
|
12975
13004
|
width: shape.getWidth(),
|
|
12976
13005
|
height: shape.getHeigth(),
|
|
12977
13006
|
line_width: shape.getLineWidth(),
|
|
@@ -12988,7 +13017,7 @@
|
|
|
12988
13017
|
const shape = new KonvaEllipse(null, ellipse);
|
|
12989
13018
|
ellipses.push({
|
|
12990
13019
|
id: shape.id(),
|
|
12991
|
-
position:
|
|
13020
|
+
position: worldPoint,
|
|
12992
13021
|
radius: { x: ellipse.getRadiusX(), y: ellipse.getRadiusY() },
|
|
12993
13022
|
line_width: shape.getLineWidth(),
|
|
12994
13023
|
color: shape.getColor(),
|
|
@@ -13008,8 +13037,8 @@
|
|
|
13008
13037
|
const shape = new KonvaArrow(null, arrow);
|
|
13009
13038
|
arrows.push({
|
|
13010
13039
|
id: shape.id(),
|
|
13011
|
-
start:
|
|
13012
|
-
end:
|
|
13040
|
+
start: worldStartPoint,
|
|
13041
|
+
end: worldEndPoint,
|
|
13013
13042
|
color: shape.getColor(),
|
|
13014
13043
|
});
|
|
13015
13044
|
});
|
|
@@ -13023,7 +13052,7 @@
|
|
|
13023
13052
|
const shape = new KonvaImage(null, image);
|
|
13024
13053
|
images.push({
|
|
13025
13054
|
id: shape.id(),
|
|
13026
|
-
position:
|
|
13055
|
+
position: worldPoint,
|
|
13027
13056
|
src: shape.getSrc(),
|
|
13028
13057
|
width: shape.getWidth(),
|
|
13029
13058
|
height: shape.getHeight(),
|
|
@@ -13039,7 +13068,7 @@
|
|
|
13039
13068
|
const shape = new KonvaCloud(null, cloud);
|
|
13040
13069
|
clouds.push({
|
|
13041
13070
|
id: shape.id(),
|
|
13042
|
-
position:
|
|
13071
|
+
position: worldPoint,
|
|
13043
13072
|
width: shape.getWidth(),
|
|
13044
13073
|
height: shape.getHeigth(),
|
|
13045
13074
|
line_width: shape.getLineWidth(),
|