@inweb/markup 25.8.22 → 25.9.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 +173 -68
- package/dist/markup.js.map +1 -1
- package/dist/markup.min.js +1 -1
- package/dist/markup.module.js +118 -53
- package/dist/markup.module.js.map +1 -1
- package/lib/markup/Konva/KonvaImage.d.ts +1 -1
- package/lib/markup/Konva/KonvaMarkup.d.ts +4 -1
- package/package.json +5 -5
- package/src/markup/IMarkup.ts +0 -1
- package/src/markup/Konva/KonvaImage.ts +1 -1
- package/src/markup/Konva/KonvaMarkup.ts +93 -26
package/dist/markup.js
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
: {};
|
|
37
37
|
exports.Konva = {
|
|
38
38
|
_global: exports.glob,
|
|
39
|
-
version: '9.3.
|
|
39
|
+
version: '9.3.14',
|
|
40
40
|
isBrowser: detectBrowser(),
|
|
41
41
|
isUnminified: /param/.test(function (param) { }.toString()),
|
|
42
42
|
dblClickWindow: 400,
|
|
@@ -4548,7 +4548,13 @@
|
|
|
4548
4548
|
context.stroke();
|
|
4549
4549
|
}
|
|
4550
4550
|
function _fillFuncHit(context) {
|
|
4551
|
-
|
|
4551
|
+
const fillRule = this.attrs.fillRule;
|
|
4552
|
+
if (fillRule) {
|
|
4553
|
+
context.fill(fillRule);
|
|
4554
|
+
}
|
|
4555
|
+
else {
|
|
4556
|
+
context.fill();
|
|
4557
|
+
}
|
|
4552
4558
|
}
|
|
4553
4559
|
function _strokeFuncHit(context) {
|
|
4554
4560
|
context.stroke();
|
|
@@ -7930,7 +7936,7 @@
|
|
|
7930
7936
|
const Shape_1$a = Shape;
|
|
7931
7937
|
const Global_1$a = Global;
|
|
7932
7938
|
const Validators_1$p = Validators;
|
|
7933
|
-
|
|
7939
|
+
let Image$1 = class Image extends Shape_1$a.Shape {
|
|
7934
7940
|
constructor(attrs) {
|
|
7935
7941
|
super(attrs);
|
|
7936
7942
|
this.on('imageChange.konva', () => {
|
|
@@ -7953,6 +7959,11 @@
|
|
|
7953
7959
|
}
|
|
7954
7960
|
}
|
|
7955
7961
|
_useBufferCanvas() {
|
|
7962
|
+
const hasCornerRadius = !!this.cornerRadius();
|
|
7963
|
+
const hasShadow = this.hasShadow();
|
|
7964
|
+
if (hasCornerRadius && hasShadow) {
|
|
7965
|
+
return true;
|
|
7966
|
+
}
|
|
7956
7967
|
return super._useBufferCanvas(true);
|
|
7957
7968
|
}
|
|
7958
7969
|
_sceneFunc(context) {
|
|
@@ -8019,7 +8030,7 @@
|
|
|
8019
8030
|
static fromURL(url, callback, onError = null) {
|
|
8020
8031
|
var img = Util_1$7.Util.createImageElement();
|
|
8021
8032
|
img.onload = function () {
|
|
8022
|
-
var image = new Image
|
|
8033
|
+
var image = new Image({
|
|
8023
8034
|
image: img,
|
|
8024
8035
|
});
|
|
8025
8036
|
callback(image);
|
|
@@ -8028,7 +8039,7 @@
|
|
|
8028
8039
|
img.crossOrigin = 'Anonymous';
|
|
8029
8040
|
img.src = url;
|
|
8030
8041
|
}
|
|
8031
|
-
}
|
|
8042
|
+
};
|
|
8032
8043
|
Image$2.Image = Image$1;
|
|
8033
8044
|
Image$1.prototype.className = 'Image';
|
|
8034
8045
|
(0, Global_1$a._registerNode)(Image$1);
|
|
@@ -10860,7 +10871,7 @@
|
|
|
10860
10871
|
y = ySize - yMid;
|
|
10861
10872
|
rad = Math.sqrt(x * x + y * y);
|
|
10862
10873
|
rMax = rad > rMax ? rad : rMax;
|
|
10863
|
-
var rSize = ySize, tSize = xSize, radius, theta, phaseShift =
|
|
10874
|
+
var rSize = ySize, tSize = xSize, radius, theta, phaseShift = 0;
|
|
10864
10875
|
var x1, y1;
|
|
10865
10876
|
for (x = 0; x < xSize; x += 1) {
|
|
10866
10877
|
for (y = 0; y < ySize; y += 1) {
|
|
@@ -11455,6 +11466,40 @@
|
|
|
11455
11466
|
var libExports = lib$1.exports;
|
|
11456
11467
|
var Konva = /*@__PURE__*/getDefaultExportFromCjs(libExports);
|
|
11457
11468
|
|
|
11469
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
11470
|
+
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
11471
|
+
// All rights reserved.
|
|
11472
|
+
//
|
|
11473
|
+
// This software and its documentation and related materials are owned by
|
|
11474
|
+
// the Alliance. The software may only be incorporated into application
|
|
11475
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
11476
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
11477
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
11478
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11479
|
+
// protected by copyright law and international treaty provisions. Application
|
|
11480
|
+
// programs incorporating this software must include the following statement
|
|
11481
|
+
// with their copyright notices:
|
|
11482
|
+
//
|
|
11483
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
11484
|
+
// license agreement with Open Design Alliance.
|
|
11485
|
+
// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
|
|
11486
|
+
// All rights reserved.
|
|
11487
|
+
//
|
|
11488
|
+
// By use of this software, its documentation or related materials, you
|
|
11489
|
+
// acknowledge and accept the above terms.
|
|
11490
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
11491
|
+
class WorldTransform {
|
|
11492
|
+
screenToWorld(position) {
|
|
11493
|
+
return { x: position.x, y: position.y, z: 0 };
|
|
11494
|
+
}
|
|
11495
|
+
worldToScreen(position) {
|
|
11496
|
+
return { x: position.x, y: position.y };
|
|
11497
|
+
}
|
|
11498
|
+
getScale() {
|
|
11499
|
+
return { x: 1, y: 1, z: 1 };
|
|
11500
|
+
}
|
|
11501
|
+
}
|
|
11502
|
+
|
|
11458
11503
|
///////////////////////////////////////////////////////////////////////////////
|
|
11459
11504
|
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
11460
11505
|
// All rights reserved.
|
|
@@ -11526,40 +11571,6 @@
|
|
|
11526
11571
|
}
|
|
11527
11572
|
}
|
|
11528
11573
|
|
|
11529
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
11530
|
-
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
11531
|
-
// All rights reserved.
|
|
11532
|
-
//
|
|
11533
|
-
// This software and its documentation and related materials are owned by
|
|
11534
|
-
// the Alliance. The software may only be incorporated into application
|
|
11535
|
-
// programs owned by members of the Alliance, subject to a signed
|
|
11536
|
-
// Membership Agreement and Supplemental Software License Agreement with the
|
|
11537
|
-
// Alliance. The structure and organization of this software are the valuable
|
|
11538
|
-
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11539
|
-
// protected by copyright law and international treaty provisions. Application
|
|
11540
|
-
// programs incorporating this software must include the following statement
|
|
11541
|
-
// with their copyright notices:
|
|
11542
|
-
//
|
|
11543
|
-
// This application incorporates Open Design Alliance software pursuant to a
|
|
11544
|
-
// license agreement with Open Design Alliance.
|
|
11545
|
-
// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
|
|
11546
|
-
// All rights reserved.
|
|
11547
|
-
//
|
|
11548
|
-
// By use of this software, its documentation or related materials, you
|
|
11549
|
-
// acknowledge and accept the above terms.
|
|
11550
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
11551
|
-
class WorldTransform {
|
|
11552
|
-
screenToWorld(position) {
|
|
11553
|
-
return { x: position.x, y: position.y, z: 0 };
|
|
11554
|
-
}
|
|
11555
|
-
worldToScreen(position) {
|
|
11556
|
-
return { x: position.x, y: position.y };
|
|
11557
|
-
}
|
|
11558
|
-
getScale() {
|
|
11559
|
-
return { x: 1, y: 1, z: 1 };
|
|
11560
|
-
}
|
|
11561
|
-
}
|
|
11562
|
-
|
|
11563
11574
|
const LineTypeSpecs = new Map([
|
|
11564
11575
|
["solid", []],
|
|
11565
11576
|
["dot", [30, 30, 0.001, 30]],
|
|
@@ -12010,6 +12021,27 @@
|
|
|
12010
12021
|
}
|
|
12011
12022
|
}
|
|
12012
12023
|
|
|
12024
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
12025
|
+
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
12026
|
+
// All rights reserved.
|
|
12027
|
+
//
|
|
12028
|
+
// This software and its documentation and related materials are owned by
|
|
12029
|
+
// the Alliance. The software may only be incorporated into application
|
|
12030
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
12031
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
12032
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
12033
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
12034
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12035
|
+
// programs incorporating this software must include the following statement
|
|
12036
|
+
// with their copyright notices:
|
|
12037
|
+
//
|
|
12038
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
12039
|
+
// license agreement with Open Design Alliance.
|
|
12040
|
+
// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
|
|
12041
|
+
// All rights reserved.
|
|
12042
|
+
//
|
|
12043
|
+
// By use of this software, its documentation or related materials, you
|
|
12044
|
+
// acknowledge and accept the above terms.
|
|
12013
12045
|
///////////////////////////////////////////////////////////////////////////////
|
|
12014
12046
|
class KonvaArrow {
|
|
12015
12047
|
constructor(params, ref = null) {
|
|
@@ -12112,8 +12144,8 @@
|
|
|
12112
12144
|
var _a, _b;
|
|
12113
12145
|
this._ratio = 1;
|
|
12114
12146
|
this.EPSILON = 10e-6;
|
|
12115
|
-
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=";
|
|
12116
12147
|
this.BASE64_HEADER_START = "data:image/";
|
|
12148
|
+
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=";
|
|
12117
12149
|
if (ref) {
|
|
12118
12150
|
if (!ref.src || !ref.src.startsWith(this.BASE64_HEADER_START))
|
|
12119
12151
|
ref.src = this.BASE64_NOT_FOUND;
|
|
@@ -12433,6 +12465,27 @@
|
|
|
12433
12465
|
}
|
|
12434
12466
|
}
|
|
12435
12467
|
|
|
12468
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
12469
|
+
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
12470
|
+
// All rights reserved.
|
|
12471
|
+
//
|
|
12472
|
+
// This software and its documentation and related materials are owned by
|
|
12473
|
+
// the Alliance. The software may only be incorporated into application
|
|
12474
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
12475
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
12476
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
12477
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
12478
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12479
|
+
// programs incorporating this software must include the following statement
|
|
12480
|
+
// with their copyright notices:
|
|
12481
|
+
//
|
|
12482
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
12483
|
+
// license agreement with Open Design Alliance.
|
|
12484
|
+
// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
|
|
12485
|
+
// All rights reserved.
|
|
12486
|
+
//
|
|
12487
|
+
// By use of this software, its documentation or related materials, you
|
|
12488
|
+
// acknowledge and accept the above terms.
|
|
12436
12489
|
///////////////////////////////////////////////////////////////////////////////
|
|
12437
12490
|
const MarkupMode2Konva = {
|
|
12438
12491
|
SelectMarkup: {
|
|
@@ -12501,14 +12554,50 @@
|
|
|
12501
12554
|
this._konvaStage.height(height);
|
|
12502
12555
|
};
|
|
12503
12556
|
this.pan = (event) => {
|
|
12504
|
-
const
|
|
12505
|
-
const
|
|
12506
|
-
|
|
12557
|
+
const pointer = this._konvaStage.getPointerPosition();
|
|
12558
|
+
const pointTo = {
|
|
12559
|
+
x: (pointer.x - this._konvaStage.x()) / this._konvaStage.scaleX(),
|
|
12560
|
+
y: (pointer.y - this._konvaStage.y()) / this._konvaStage.scaleX(),
|
|
12561
|
+
};
|
|
12562
|
+
const newPos = {
|
|
12563
|
+
x: pointer.x - pointTo.x * this._konvaStage.scale().x + event.dX,
|
|
12564
|
+
y: pointer.y - pointTo.y * this._konvaStage.scale().x + event.dY,
|
|
12565
|
+
};
|
|
12566
|
+
this._konvaStage.position(newPos);
|
|
12567
|
+
};
|
|
12568
|
+
this.zoomAt = (event) => {
|
|
12569
|
+
const oldScale = this._konvaStage.scaleX();
|
|
12570
|
+
const pointer = this._konvaStage.getPointerPosition();
|
|
12571
|
+
const mousePointTo = {
|
|
12572
|
+
x: (pointer.x - this._konvaStage.x()) / oldScale,
|
|
12573
|
+
y: (pointer.y - this._konvaStage.y()) / oldScale,
|
|
12574
|
+
};
|
|
12575
|
+
// how to scale? Zoom in? Or zoom out?
|
|
12576
|
+
let direction = event.data > 0 ? 1 : -1;
|
|
12577
|
+
const newScale = direction > 0 ? oldScale * event.data : oldScale / event.data;
|
|
12578
|
+
this._konvaStage.scale({ x: newScale, y: newScale });
|
|
12579
|
+
const newPos = {
|
|
12580
|
+
x: pointer.x - mousePointTo.x * newScale,
|
|
12581
|
+
y: pointer.y - mousePointTo.y * newScale,
|
|
12582
|
+
};
|
|
12583
|
+
this._konvaStage.position(newPos);
|
|
12507
12584
|
};
|
|
12508
12585
|
this.redirectToViewer = (event) => {
|
|
12509
12586
|
if (this._viewer)
|
|
12510
12587
|
this._viewer.emit(event);
|
|
12511
12588
|
};
|
|
12589
|
+
this.getRelativePointPosition = (point, node) => {
|
|
12590
|
+
// the function will return pointer position relative to the passed node
|
|
12591
|
+
const transform = node.getAbsoluteTransform().copy();
|
|
12592
|
+
// to detect relative position we need to invert transform
|
|
12593
|
+
transform.invert();
|
|
12594
|
+
// get pointer (say mouse or touch) position
|
|
12595
|
+
// now we find relative point
|
|
12596
|
+
return transform.point(point);
|
|
12597
|
+
};
|
|
12598
|
+
this.getRelativePointerPosition = (node) => {
|
|
12599
|
+
return this.getRelativePointPosition(node.getStage().getPointerPosition(), node);
|
|
12600
|
+
};
|
|
12512
12601
|
}
|
|
12513
12602
|
initialize(container, containerEvents, viewer, worldTransformer) {
|
|
12514
12603
|
if (!Konva)
|
|
@@ -12534,11 +12623,13 @@
|
|
|
12534
12623
|
this._containerEvents.forEach((x) => this._markupContainer.addEventListener(x, this.redirectToViewer));
|
|
12535
12624
|
this._viewer.addEventListener("changeactivedragger", this.changeActiveDragger);
|
|
12536
12625
|
this._viewer.addEventListener("pan", this.pan);
|
|
12626
|
+
this._viewer.addEventListener("zoomat", this.zoomAt);
|
|
12537
12627
|
}
|
|
12538
12628
|
}
|
|
12539
12629
|
dispose() {
|
|
12540
12630
|
var _a, _b;
|
|
12541
12631
|
if (this._viewer) {
|
|
12632
|
+
this._viewer.removeEventListener("zoomat", this.zoomAt);
|
|
12542
12633
|
this._viewer.removeEventListener("pan", this.pan);
|
|
12543
12634
|
this._viewer.removeEventListener("changeactivedragger", this.changeActiveDragger);
|
|
12544
12635
|
this._containerEvents.forEach((x) => this._markupContainer.removeEventListener(x, this.redirectToViewer));
|
|
@@ -12579,6 +12670,8 @@
|
|
|
12579
12670
|
this.clearSelected();
|
|
12580
12671
|
this.removeTextInput();
|
|
12581
12672
|
this.removeImageInput();
|
|
12673
|
+
this._konvaStage.scale({ x: 1, y: 1 });
|
|
12674
|
+
this._konvaStage.position({ x: 0, y: 0 });
|
|
12582
12675
|
const markupColor = ((_a = viewpoint.custom_fields) === null || _a === void 0 ? void 0 : _a.markup_color) || { r: 255, g: 0, b: 0 };
|
|
12583
12676
|
this.setMarkupColor(markupColor.r, markupColor.g, markupColor.b);
|
|
12584
12677
|
(_b = viewpoint.lines) === null || _b === void 0 ? void 0 : _b.forEach((line) => {
|
|
@@ -12739,7 +12832,7 @@
|
|
|
12739
12832
|
transformer.nodes([]);
|
|
12740
12833
|
return;
|
|
12741
12834
|
}
|
|
12742
|
-
const pos =
|
|
12835
|
+
const pos = this.getRelativePointerPosition(stage);
|
|
12743
12836
|
mouseDownPos = pos;
|
|
12744
12837
|
isPaint = ["Arrow", "Cloud", "Ellipse", "Line", "Rectangle"].some((m) => m === this._markupMode);
|
|
12745
12838
|
if (this._markupMode === "Line") {
|
|
@@ -12751,7 +12844,7 @@
|
|
|
12751
12844
|
if (!this._markupIsActive)
|
|
12752
12845
|
return;
|
|
12753
12846
|
if (isPaint) {
|
|
12754
|
-
const pos =
|
|
12847
|
+
const pos = this.getRelativePointerPosition(stage);
|
|
12755
12848
|
const defParams = mouseDownPos && pos.x === mouseDownPos.x && pos.y === mouseDownPos.y;
|
|
12756
12849
|
const startX = defParams ? mouseDownPos.x : Math.min(mouseDownPos.x, pos.x);
|
|
12757
12850
|
const startY = defParams ? mouseDownPos.y : Math.min(mouseDownPos.y, pos.y);
|
|
@@ -12783,7 +12876,7 @@
|
|
|
12783
12876
|
}
|
|
12784
12877
|
// prevent scrolling on touch devices
|
|
12785
12878
|
//e.evt.preventDefault();
|
|
12786
|
-
const pos =
|
|
12879
|
+
const pos = this.getRelativePointerPosition(stage);
|
|
12787
12880
|
const defParams = mouseDownPos && pos.x === mouseDownPos.x && pos.y === mouseDownPos.y;
|
|
12788
12881
|
const startX = defParams ? mouseDownPos.x : Math.min(mouseDownPos.x, pos.x);
|
|
12789
12882
|
const startY = defParams ? mouseDownPos.y : Math.min(mouseDownPos.y, pos.y);
|
|
@@ -12836,7 +12929,7 @@
|
|
|
12836
12929
|
if (this._textInputRef && this._textInputRef.value)
|
|
12837
12930
|
this.addText(this._textInputRef.value, this._textInputPos, this._textInputAngle);
|
|
12838
12931
|
else if (transformer.nodes().length === 0) {
|
|
12839
|
-
const pos =
|
|
12932
|
+
const pos = this.getRelativePointerPosition(stage);
|
|
12840
12933
|
this.createTextInput(pos, e.evt.pageX, e.evt.pageY, 0, null);
|
|
12841
12934
|
}
|
|
12842
12935
|
}
|
|
@@ -12844,7 +12937,7 @@
|
|
|
12844
12937
|
if (this._imageInputRef && this._imageInputRef.value)
|
|
12845
12938
|
this.addImage({ x: this._imageInputPos.x, y: this._imageInputPos.y }, this._imageInputRef.value, 0, 0, this._imageInputRef.value);
|
|
12846
12939
|
else if (transformer.nodes().length === 0) {
|
|
12847
|
-
const pos =
|
|
12940
|
+
const pos = this.getRelativePointerPosition(stage);
|
|
12848
12941
|
this.createImageInput(pos);
|
|
12849
12942
|
}
|
|
12850
12943
|
}
|
|
@@ -12969,11 +13062,10 @@
|
|
|
12969
13062
|
this.konvaLayerFind("Text").forEach((ref) => {
|
|
12970
13063
|
const textSize = 0.02;
|
|
12971
13064
|
const textScale = this._worldTransformer.getScale();
|
|
12972
|
-
const position =
|
|
12973
|
-
|
|
12974
|
-
|
|
12975
|
-
|
|
12976
|
-
const worldPoint = this._worldTransformer.screenToWorld(position);
|
|
13065
|
+
const position = ref.position();
|
|
13066
|
+
const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
|
|
13067
|
+
const atPoint = stageAbsoluteTransform.point({ x: position.x, y: position.y });
|
|
13068
|
+
const worldPoint = this._worldTransformer.screenToWorld(atPoint);
|
|
12977
13069
|
const shape = new KonvaText(null, ref);
|
|
12978
13070
|
const text = {
|
|
12979
13071
|
id: shape.id(),
|
|
@@ -12982,7 +13074,7 @@
|
|
|
12982
13074
|
text_size: textSize * textScale.y,
|
|
12983
13075
|
angle: shape.getRotation(),
|
|
12984
13076
|
color: shape.getColor(),
|
|
12985
|
-
font_size: shape.getFontSize(),
|
|
13077
|
+
font_size: shape.getFontSize() * stageAbsoluteTransform.getMatrix()[0],
|
|
12986
13078
|
};
|
|
12987
13079
|
texts.push(text);
|
|
12988
13080
|
});
|
|
@@ -12992,13 +13084,16 @@
|
|
|
12992
13084
|
const rectangles = [];
|
|
12993
13085
|
this.konvaLayerFind("Rectangle").forEach((ref) => {
|
|
12994
13086
|
const position = ref.position();
|
|
12995
|
-
const
|
|
13087
|
+
const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
|
|
13088
|
+
const atPoint = stageAbsoluteTransform.point({ x: position.x, y: position.y });
|
|
13089
|
+
const worldPoint = this._worldTransformer.screenToWorld(atPoint);
|
|
13090
|
+
const scale = stageAbsoluteTransform.getMatrix()[0];
|
|
12996
13091
|
const shape = new KonvaRectangle(null, ref);
|
|
12997
13092
|
const rectangle = {
|
|
12998
13093
|
id: shape.id(),
|
|
12999
13094
|
position: worldPoint,
|
|
13000
|
-
width: shape.getWidth(),
|
|
13001
|
-
height: shape.getHeigth(),
|
|
13095
|
+
width: shape.getWidth() * scale,
|
|
13096
|
+
height: shape.getHeigth() * scale,
|
|
13002
13097
|
line_width: shape.getLineWidth(),
|
|
13003
13098
|
color: shape.getColor(),
|
|
13004
13099
|
};
|
|
@@ -13010,12 +13105,18 @@
|
|
|
13010
13105
|
const ellipses = [];
|
|
13011
13106
|
this.konvaLayerFind("Ellipse").forEach((ref) => {
|
|
13012
13107
|
const position = ref.position();
|
|
13013
|
-
const
|
|
13108
|
+
const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
|
|
13109
|
+
const atPoint = stageAbsoluteTransform.point({ x: position.x, y: position.y });
|
|
13110
|
+
const worldPoint = this._worldTransformer.screenToWorld(atPoint);
|
|
13111
|
+
const scale = stageAbsoluteTransform.getMatrix()[0];
|
|
13014
13112
|
const shape = new KonvaEllipse(null, ref);
|
|
13015
13113
|
const ellipse = {
|
|
13016
13114
|
id: shape.id(),
|
|
13017
13115
|
position: worldPoint,
|
|
13018
|
-
radius: {
|
|
13116
|
+
radius: {
|
|
13117
|
+
x: ref.getRadiusX() * scale,
|
|
13118
|
+
y: ref.getRadiusY() * scale,
|
|
13119
|
+
},
|
|
13019
13120
|
line_width: shape.getLineWidth(),
|
|
13020
13121
|
color: shape.getColor(),
|
|
13021
13122
|
};
|
|
@@ -13053,14 +13154,17 @@
|
|
|
13053
13154
|
const images = [];
|
|
13054
13155
|
this.konvaLayerFind("Image").forEach((ref) => {
|
|
13055
13156
|
const position = ref.position();
|
|
13056
|
-
const
|
|
13157
|
+
const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
|
|
13158
|
+
const atPoint = stageAbsoluteTransform.point({ x: position.x, y: position.y });
|
|
13159
|
+
const worldPoint = this._worldTransformer.screenToWorld(atPoint);
|
|
13160
|
+
const scale = stageAbsoluteTransform.getMatrix()[0];
|
|
13057
13161
|
const shape = new KonvaImage(null, ref);
|
|
13058
13162
|
const image = {
|
|
13059
13163
|
id: shape.id(),
|
|
13060
13164
|
position: worldPoint,
|
|
13061
13165
|
src: shape.getSrc(),
|
|
13062
|
-
width: shape.getWidth(),
|
|
13063
|
-
height: shape.getHeight(),
|
|
13166
|
+
width: shape.getWidth() * scale,
|
|
13167
|
+
height: shape.getHeight() * scale,
|
|
13064
13168
|
};
|
|
13065
13169
|
images.push(image);
|
|
13066
13170
|
});
|
|
@@ -13070,13 +13174,16 @@
|
|
|
13070
13174
|
const clouds = [];
|
|
13071
13175
|
this.konvaLayerFind("Cloud").forEach((ref) => {
|
|
13072
13176
|
const position = ref.position();
|
|
13073
|
-
const
|
|
13177
|
+
const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
|
|
13178
|
+
const atPoint = stageAbsoluteTransform.point({ x: position.x, y: position.y });
|
|
13179
|
+
const worldPoint = this._worldTransformer.screenToWorld(atPoint);
|
|
13180
|
+
const scale = stageAbsoluteTransform.getMatrix()[0];
|
|
13074
13181
|
const shape = new KonvaCloud(null, ref);
|
|
13075
13182
|
const cloud = {
|
|
13076
13183
|
id: shape.id(),
|
|
13077
13184
|
position: worldPoint,
|
|
13078
|
-
width: shape.getWidth(),
|
|
13079
|
-
height: shape.getHeigth(),
|
|
13185
|
+
width: shape.getWidth() * scale,
|
|
13186
|
+
height: shape.getHeigth() * scale,
|
|
13080
13187
|
line_width: shape.getLineWidth(),
|
|
13081
13188
|
color: shape.getColor(),
|
|
13082
13189
|
};
|
|
@@ -13300,7 +13407,5 @@
|
|
|
13300
13407
|
|
|
13301
13408
|
exports.Markup = KonvaMarkup;
|
|
13302
13409
|
|
|
13303
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
13304
|
-
|
|
13305
13410
|
}));
|
|
13306
13411
|
//# sourceMappingURL=markup.js.map
|