@inweb/markup 26.9.2 → 26.9.3
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 +831 -788
- package/dist/markup.js.map +1 -1
- package/dist/markup.min.js +1 -1
- package/dist/markup.module.js +150 -150
- package/dist/markup.module.js.map +1 -1
- package/package.json +3 -3
- package/src/markup/Konva/KonvaMarkup.ts +2 -2
package/dist/markup.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
hasRequiredGlobal = 1;
|
|
26
26
|
(function (exports) {
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports._registerNode = exports.Konva = exports.glob =
|
|
28
|
+
exports._registerNode = exports.Konva = exports.glob = void 0;
|
|
29
29
|
const PI_OVER_180 = Math.PI / 180;
|
|
30
30
|
function detectBrowser() {
|
|
31
31
|
return (typeof window !== 'undefined' &&
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
: {};
|
|
42
42
|
exports.Konva = {
|
|
43
43
|
_global: exports.glob,
|
|
44
|
-
version: '9.3.
|
|
44
|
+
version: '9.3.22',
|
|
45
45
|
isBrowser: detectBrowser(),
|
|
46
46
|
isUnminified: /param/.test(function (param) { }.toString()),
|
|
47
47
|
dblClickWindow: 400,
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
isTransforming() {
|
|
75
75
|
var _a;
|
|
76
|
-
return (_a = exports.Konva['Transformer']) === null || _a ===
|
|
76
|
+
return (_a = exports.Konva['Transformer']) === null || _a === void 0 ? void 0 : _a.isTransforming();
|
|
77
77
|
},
|
|
78
78
|
isDragReady() {
|
|
79
79
|
return !!exports.Konva['DD'].node;
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
hasRequiredUtil = 1;
|
|
103
103
|
(function (exports) {
|
|
104
104
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
105
|
-
exports.Util = exports.Transform =
|
|
105
|
+
exports.Util = exports.Transform = void 0;
|
|
106
106
|
const Global_1 = requireGlobal();
|
|
107
107
|
class Transform {
|
|
108
108
|
constructor(m = [1, 0, 0, 1, 0, 0]) {
|
|
@@ -911,343 +911,6 @@
|
|
|
911
911
|
|
|
912
912
|
var Node = {};
|
|
913
913
|
|
|
914
|
-
var Factory = {};
|
|
915
|
-
|
|
916
|
-
var Validators = {};
|
|
917
|
-
|
|
918
|
-
var hasRequiredValidators;
|
|
919
|
-
|
|
920
|
-
function requireValidators () {
|
|
921
|
-
if (hasRequiredValidators) return Validators;
|
|
922
|
-
hasRequiredValidators = 1;
|
|
923
|
-
Object.defineProperty(Validators, "__esModule", { value: true });
|
|
924
|
-
Validators.RGBComponent = RGBComponent;
|
|
925
|
-
Validators.alphaComponent = alphaComponent;
|
|
926
|
-
Validators.getNumberValidator = getNumberValidator;
|
|
927
|
-
Validators.getNumberOrArrayOfNumbersValidator = getNumberOrArrayOfNumbersValidator;
|
|
928
|
-
Validators.getNumberOrAutoValidator = getNumberOrAutoValidator;
|
|
929
|
-
Validators.getStringValidator = getStringValidator;
|
|
930
|
-
Validators.getStringOrGradientValidator = getStringOrGradientValidator;
|
|
931
|
-
Validators.getFunctionValidator = getFunctionValidator;
|
|
932
|
-
Validators.getNumberArrayValidator = getNumberArrayValidator;
|
|
933
|
-
Validators.getBooleanValidator = getBooleanValidator;
|
|
934
|
-
Validators.getComponentValidator = getComponentValidator;
|
|
935
|
-
const Global_1 = requireGlobal();
|
|
936
|
-
const Util_1 = requireUtil();
|
|
937
|
-
function _formatValue(val) {
|
|
938
|
-
if (Util_1.Util._isString(val)) {
|
|
939
|
-
return '"' + val + '"';
|
|
940
|
-
}
|
|
941
|
-
if (Object.prototype.toString.call(val) === '[object Number]') {
|
|
942
|
-
return val;
|
|
943
|
-
}
|
|
944
|
-
if (Util_1.Util._isBoolean(val)) {
|
|
945
|
-
return val;
|
|
946
|
-
}
|
|
947
|
-
return Object.prototype.toString.call(val);
|
|
948
|
-
}
|
|
949
|
-
function RGBComponent(val) {
|
|
950
|
-
if (val > 255) {
|
|
951
|
-
return 255;
|
|
952
|
-
}
|
|
953
|
-
else if (val < 0) {
|
|
954
|
-
return 0;
|
|
955
|
-
}
|
|
956
|
-
return Math.round(val);
|
|
957
|
-
}
|
|
958
|
-
function alphaComponent(val) {
|
|
959
|
-
if (val > 1) {
|
|
960
|
-
return 1;
|
|
961
|
-
}
|
|
962
|
-
else if (val < 0.0001) {
|
|
963
|
-
return 0.0001;
|
|
964
|
-
}
|
|
965
|
-
return val;
|
|
966
|
-
}
|
|
967
|
-
function getNumberValidator() {
|
|
968
|
-
if (Global_1.Konva.isUnminified) {
|
|
969
|
-
return function (val, attr) {
|
|
970
|
-
if (!Util_1.Util._isNumber(val)) {
|
|
971
|
-
Util_1.Util.warn(_formatValue(val) +
|
|
972
|
-
' is a not valid value for "' +
|
|
973
|
-
attr +
|
|
974
|
-
'" attribute. The value should be a number.');
|
|
975
|
-
}
|
|
976
|
-
return val;
|
|
977
|
-
};
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
function getNumberOrArrayOfNumbersValidator(noOfElements) {
|
|
981
|
-
if (Global_1.Konva.isUnminified) {
|
|
982
|
-
return function (val, attr) {
|
|
983
|
-
let isNumber = Util_1.Util._isNumber(val);
|
|
984
|
-
let isValidArray = Util_1.Util._isArray(val) && val.length == noOfElements;
|
|
985
|
-
if (!isNumber && !isValidArray) {
|
|
986
|
-
Util_1.Util.warn(_formatValue(val) +
|
|
987
|
-
' is a not valid value for "' +
|
|
988
|
-
attr +
|
|
989
|
-
'" attribute. The value should be a number or Array<number>(' +
|
|
990
|
-
noOfElements +
|
|
991
|
-
')');
|
|
992
|
-
}
|
|
993
|
-
return val;
|
|
994
|
-
};
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
function getNumberOrAutoValidator() {
|
|
998
|
-
if (Global_1.Konva.isUnminified) {
|
|
999
|
-
return function (val, attr) {
|
|
1000
|
-
var isNumber = Util_1.Util._isNumber(val);
|
|
1001
|
-
var isAuto = val === 'auto';
|
|
1002
|
-
if (!(isNumber || isAuto)) {
|
|
1003
|
-
Util_1.Util.warn(_formatValue(val) +
|
|
1004
|
-
' is a not valid value for "' +
|
|
1005
|
-
attr +
|
|
1006
|
-
'" attribute. The value should be a number or "auto".');
|
|
1007
|
-
}
|
|
1008
|
-
return val;
|
|
1009
|
-
};
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
function getStringValidator() {
|
|
1013
|
-
if (Global_1.Konva.isUnminified) {
|
|
1014
|
-
return function (val, attr) {
|
|
1015
|
-
if (!Util_1.Util._isString(val)) {
|
|
1016
|
-
Util_1.Util.warn(_formatValue(val) +
|
|
1017
|
-
' is a not valid value for "' +
|
|
1018
|
-
attr +
|
|
1019
|
-
'" attribute. The value should be a string.');
|
|
1020
|
-
}
|
|
1021
|
-
return val;
|
|
1022
|
-
};
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
function getStringOrGradientValidator() {
|
|
1026
|
-
if (Global_1.Konva.isUnminified) {
|
|
1027
|
-
return function (val, attr) {
|
|
1028
|
-
const isString = Util_1.Util._isString(val);
|
|
1029
|
-
const isGradient = Object.prototype.toString.call(val) === '[object CanvasGradient]' ||
|
|
1030
|
-
(val && val['addColorStop']);
|
|
1031
|
-
if (!(isString || isGradient)) {
|
|
1032
|
-
Util_1.Util.warn(_formatValue(val) +
|
|
1033
|
-
' is a not valid value for "' +
|
|
1034
|
-
attr +
|
|
1035
|
-
'" attribute. The value should be a string or a native gradient.');
|
|
1036
|
-
}
|
|
1037
|
-
return val;
|
|
1038
|
-
};
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
function getFunctionValidator() {
|
|
1042
|
-
if (Global_1.Konva.isUnminified) {
|
|
1043
|
-
return function (val, attr) {
|
|
1044
|
-
if (!Util_1.Util._isFunction(val)) {
|
|
1045
|
-
Util_1.Util.warn(_formatValue(val) +
|
|
1046
|
-
' is a not valid value for "' +
|
|
1047
|
-
attr +
|
|
1048
|
-
'" attribute. The value should be a function.');
|
|
1049
|
-
}
|
|
1050
|
-
return val;
|
|
1051
|
-
};
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
function getNumberArrayValidator() {
|
|
1055
|
-
if (Global_1.Konva.isUnminified) {
|
|
1056
|
-
return function (val, attr) {
|
|
1057
|
-
const TypedArray = Int8Array ? Object.getPrototypeOf(Int8Array) : null;
|
|
1058
|
-
if (TypedArray && val instanceof TypedArray) {
|
|
1059
|
-
return val;
|
|
1060
|
-
}
|
|
1061
|
-
if (!Util_1.Util._isArray(val)) {
|
|
1062
|
-
Util_1.Util.warn(_formatValue(val) +
|
|
1063
|
-
' is a not valid value for "' +
|
|
1064
|
-
attr +
|
|
1065
|
-
'" attribute. The value should be a array of numbers.');
|
|
1066
|
-
}
|
|
1067
|
-
else {
|
|
1068
|
-
val.forEach(function (item) {
|
|
1069
|
-
if (!Util_1.Util._isNumber(item)) {
|
|
1070
|
-
Util_1.Util.warn('"' +
|
|
1071
|
-
attr +
|
|
1072
|
-
'" attribute has non numeric element ' +
|
|
1073
|
-
item +
|
|
1074
|
-
'. Make sure that all elements are numbers.');
|
|
1075
|
-
}
|
|
1076
|
-
});
|
|
1077
|
-
}
|
|
1078
|
-
return val;
|
|
1079
|
-
};
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
function getBooleanValidator() {
|
|
1083
|
-
if (Global_1.Konva.isUnminified) {
|
|
1084
|
-
return function (val, attr) {
|
|
1085
|
-
var isBool = val === true || val === false;
|
|
1086
|
-
if (!isBool) {
|
|
1087
|
-
Util_1.Util.warn(_formatValue(val) +
|
|
1088
|
-
' is a not valid value for "' +
|
|
1089
|
-
attr +
|
|
1090
|
-
'" attribute. The value should be a boolean.');
|
|
1091
|
-
}
|
|
1092
|
-
return val;
|
|
1093
|
-
};
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
function getComponentValidator(components) {
|
|
1097
|
-
if (Global_1.Konva.isUnminified) {
|
|
1098
|
-
return function (val, attr) {
|
|
1099
|
-
if (val === undefined || val === null) {
|
|
1100
|
-
return val;
|
|
1101
|
-
}
|
|
1102
|
-
if (!Util_1.Util.isObject(val)) {
|
|
1103
|
-
Util_1.Util.warn(_formatValue(val) +
|
|
1104
|
-
' is a not valid value for "' +
|
|
1105
|
-
attr +
|
|
1106
|
-
'" attribute. The value should be an object with properties ' +
|
|
1107
|
-
components);
|
|
1108
|
-
}
|
|
1109
|
-
return val;
|
|
1110
|
-
};
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
return Validators;
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
var hasRequiredFactory;
|
|
1117
|
-
|
|
1118
|
-
function requireFactory () {
|
|
1119
|
-
if (hasRequiredFactory) return Factory;
|
|
1120
|
-
hasRequiredFactory = 1;
|
|
1121
|
-
(function (exports) {
|
|
1122
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1123
|
-
exports.Factory = undefined;
|
|
1124
|
-
const Util_1 = requireUtil();
|
|
1125
|
-
const Validators_1 = requireValidators();
|
|
1126
|
-
const GET = 'get';
|
|
1127
|
-
const SET = 'set';
|
|
1128
|
-
exports.Factory = {
|
|
1129
|
-
addGetterSetter(constructor, attr, def, validator, after) {
|
|
1130
|
-
exports.Factory.addGetter(constructor, attr, def);
|
|
1131
|
-
exports.Factory.addSetter(constructor, attr, validator, after);
|
|
1132
|
-
exports.Factory.addOverloadedGetterSetter(constructor, attr);
|
|
1133
|
-
},
|
|
1134
|
-
addGetter(constructor, attr, def) {
|
|
1135
|
-
var method = GET + Util_1.Util._capitalize(attr);
|
|
1136
|
-
constructor.prototype[method] =
|
|
1137
|
-
constructor.prototype[method] ||
|
|
1138
|
-
function () {
|
|
1139
|
-
const val = this.attrs[attr];
|
|
1140
|
-
return val === undefined ? def : val;
|
|
1141
|
-
};
|
|
1142
|
-
},
|
|
1143
|
-
addSetter(constructor, attr, validator, after) {
|
|
1144
|
-
var method = SET + Util_1.Util._capitalize(attr);
|
|
1145
|
-
if (!constructor.prototype[method]) {
|
|
1146
|
-
exports.Factory.overWriteSetter(constructor, attr, validator, after);
|
|
1147
|
-
}
|
|
1148
|
-
},
|
|
1149
|
-
overWriteSetter(constructor, attr, validator, after) {
|
|
1150
|
-
var method = SET + Util_1.Util._capitalize(attr);
|
|
1151
|
-
constructor.prototype[method] = function (val) {
|
|
1152
|
-
if (validator && val !== undefined && val !== null) {
|
|
1153
|
-
val = validator.call(this, val, attr);
|
|
1154
|
-
}
|
|
1155
|
-
this._setAttr(attr, val);
|
|
1156
|
-
if (after) {
|
|
1157
|
-
after.call(this);
|
|
1158
|
-
}
|
|
1159
|
-
return this;
|
|
1160
|
-
};
|
|
1161
|
-
},
|
|
1162
|
-
addComponentsGetterSetter(constructor, attr, components, validator, after) {
|
|
1163
|
-
const len = components.length, capitalize = Util_1.Util._capitalize, getter = GET + capitalize(attr), setter = SET + capitalize(attr);
|
|
1164
|
-
constructor.prototype[getter] = function () {
|
|
1165
|
-
const ret = {};
|
|
1166
|
-
for (let n = 0; n < len; n++) {
|
|
1167
|
-
const component = components[n];
|
|
1168
|
-
ret[component] = this.getAttr(attr + capitalize(component));
|
|
1169
|
-
}
|
|
1170
|
-
return ret;
|
|
1171
|
-
};
|
|
1172
|
-
const basicValidator = (0, Validators_1.getComponentValidator)(components);
|
|
1173
|
-
constructor.prototype[setter] = function (val) {
|
|
1174
|
-
const oldVal = this.attrs[attr];
|
|
1175
|
-
if (validator) {
|
|
1176
|
-
val = validator.call(this, val, attr);
|
|
1177
|
-
}
|
|
1178
|
-
if (basicValidator) {
|
|
1179
|
-
basicValidator.call(this, val, attr);
|
|
1180
|
-
}
|
|
1181
|
-
for (const key in val) {
|
|
1182
|
-
if (!val.hasOwnProperty(key)) {
|
|
1183
|
-
continue;
|
|
1184
|
-
}
|
|
1185
|
-
this._setAttr(attr + capitalize(key), val[key]);
|
|
1186
|
-
}
|
|
1187
|
-
if (!val) {
|
|
1188
|
-
components.forEach((component) => {
|
|
1189
|
-
this._setAttr(attr + capitalize(component), undefined);
|
|
1190
|
-
});
|
|
1191
|
-
}
|
|
1192
|
-
this._fireChangeEvent(attr, oldVal, val);
|
|
1193
|
-
if (after) {
|
|
1194
|
-
after.call(this);
|
|
1195
|
-
}
|
|
1196
|
-
return this;
|
|
1197
|
-
};
|
|
1198
|
-
exports.Factory.addOverloadedGetterSetter(constructor, attr);
|
|
1199
|
-
},
|
|
1200
|
-
addOverloadedGetterSetter(constructor, attr) {
|
|
1201
|
-
var capitalizedAttr = Util_1.Util._capitalize(attr), setter = SET + capitalizedAttr, getter = GET + capitalizedAttr;
|
|
1202
|
-
constructor.prototype[attr] = function () {
|
|
1203
|
-
if (arguments.length) {
|
|
1204
|
-
this[setter](arguments[0]);
|
|
1205
|
-
return this;
|
|
1206
|
-
}
|
|
1207
|
-
return this[getter]();
|
|
1208
|
-
};
|
|
1209
|
-
},
|
|
1210
|
-
addDeprecatedGetterSetter(constructor, attr, def, validator) {
|
|
1211
|
-
Util_1.Util.error('Adding deprecated ' + attr);
|
|
1212
|
-
const method = GET + Util_1.Util._capitalize(attr);
|
|
1213
|
-
const message = attr +
|
|
1214
|
-
' property is deprecated and will be removed soon. Look at Konva change log for more information.';
|
|
1215
|
-
constructor.prototype[method] = function () {
|
|
1216
|
-
Util_1.Util.error(message);
|
|
1217
|
-
const val = this.attrs[attr];
|
|
1218
|
-
return val === undefined ? def : val;
|
|
1219
|
-
};
|
|
1220
|
-
exports.Factory.addSetter(constructor, attr, validator, function () {
|
|
1221
|
-
Util_1.Util.error(message);
|
|
1222
|
-
});
|
|
1223
|
-
exports.Factory.addOverloadedGetterSetter(constructor, attr);
|
|
1224
|
-
},
|
|
1225
|
-
backCompat(constructor, methods) {
|
|
1226
|
-
Util_1.Util.each(methods, function (oldMethodName, newMethodName) {
|
|
1227
|
-
const method = constructor.prototype[newMethodName];
|
|
1228
|
-
const oldGetter = GET + Util_1.Util._capitalize(oldMethodName);
|
|
1229
|
-
const oldSetter = SET + Util_1.Util._capitalize(oldMethodName);
|
|
1230
|
-
function deprecated() {
|
|
1231
|
-
method.apply(this, arguments);
|
|
1232
|
-
Util_1.Util.error('"' +
|
|
1233
|
-
oldMethodName +
|
|
1234
|
-
'" method is deprecated and will be removed soon. Use ""' +
|
|
1235
|
-
newMethodName +
|
|
1236
|
-
'" instead.');
|
|
1237
|
-
}
|
|
1238
|
-
constructor.prototype[oldMethodName] = deprecated;
|
|
1239
|
-
constructor.prototype[oldGetter] = deprecated;
|
|
1240
|
-
constructor.prototype[oldSetter] = deprecated;
|
|
1241
|
-
});
|
|
1242
|
-
},
|
|
1243
|
-
afterSetFilter() {
|
|
1244
|
-
this._filterUpToDate = false;
|
|
1245
|
-
},
|
|
1246
|
-
};
|
|
1247
|
-
} (Factory));
|
|
1248
|
-
return Factory;
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
914
|
var Canvas = {};
|
|
1252
915
|
|
|
1253
916
|
var Context = {};
|
|
@@ -1258,7 +921,7 @@
|
|
|
1258
921
|
if (hasRequiredContext) return Context;
|
|
1259
922
|
hasRequiredContext = 1;
|
|
1260
923
|
Object.defineProperty(Context, "__esModule", { value: true });
|
|
1261
|
-
Context.HitContext = Context.SceneContext = Context.Context =
|
|
924
|
+
Context.HitContext = Context.SceneContext = Context.Context = void 0;
|
|
1262
925
|
const Util_1 = requireUtil();
|
|
1263
926
|
const Global_1 = requireGlobal();
|
|
1264
927
|
function simplifyArray(arr) {
|
|
@@ -1747,7 +1410,7 @@
|
|
|
1747
1410
|
}
|
|
1748
1411
|
_applyShadow(shape) {
|
|
1749
1412
|
var _a, _b, _c;
|
|
1750
|
-
const color = (_a = shape.getShadowRGBA()) !== null && _a !==
|
|
1413
|
+
const color = (_a = shape.getShadowRGBA()) !== null && _a !== void 0 ? _a : 'black', blur = (_b = shape.getShadowBlur()) !== null && _b !== void 0 ? _b : 5, offset = (_c = shape.getShadowOffset()) !== null && _c !== void 0 ? _c : {
|
|
1751
1414
|
x: 0,
|
|
1752
1415
|
y: 0,
|
|
1753
1416
|
}, scale = shape.getAbsoluteScale(), ratio = this.canvas.getPixelRatio(), scaleX = scale.x * ratio, scaleY = scale.y * ratio;
|
|
@@ -1806,12 +1469,10 @@
|
|
|
1806
1469
|
if (hasRequiredCanvas) return Canvas;
|
|
1807
1470
|
hasRequiredCanvas = 1;
|
|
1808
1471
|
Object.defineProperty(Canvas, "__esModule", { value: true });
|
|
1809
|
-
Canvas.HitCanvas = Canvas.SceneCanvas = Canvas.Canvas =
|
|
1472
|
+
Canvas.HitCanvas = Canvas.SceneCanvas = Canvas.Canvas = void 0;
|
|
1810
1473
|
const Util_1 = requireUtil();
|
|
1811
1474
|
const Context_1 = requireContext();
|
|
1812
1475
|
const Global_1 = requireGlobal();
|
|
1813
|
-
const Factory_1 = requireFactory();
|
|
1814
|
-
const Validators_1 = requireValidators();
|
|
1815
1476
|
let _pixelRatio;
|
|
1816
1477
|
function getDevicePixelRatio() {
|
|
1817
1478
|
if (_pixelRatio) {
|
|
@@ -1831,220 +1492,556 @@
|
|
|
1831
1492
|
Util_1.Util.releaseCanvas(canvas);
|
|
1832
1493
|
return _pixelRatio;
|
|
1833
1494
|
}
|
|
1834
|
-
let Canvas$1 = class Canvas {
|
|
1835
|
-
constructor(config) {
|
|
1836
|
-
this.pixelRatio = 1;
|
|
1837
|
-
this.width = 0;
|
|
1838
|
-
this.height = 0;
|
|
1839
|
-
this.isCache = false;
|
|
1840
|
-
const conf = config || {};
|
|
1841
|
-
const pixelRatio = conf.pixelRatio || Global_1.Konva.pixelRatio || getDevicePixelRatio();
|
|
1842
|
-
this.pixelRatio = pixelRatio;
|
|
1843
|
-
this._canvas = Util_1.Util.createCanvasElement();
|
|
1844
|
-
this._canvas.style.padding = '0';
|
|
1845
|
-
this._canvas.style.margin = '0';
|
|
1846
|
-
this._canvas.style.border = '0';
|
|
1847
|
-
this._canvas.style.background = 'transparent';
|
|
1848
|
-
this._canvas.style.position = 'absolute';
|
|
1849
|
-
this._canvas.style.top = '0';
|
|
1850
|
-
this._canvas.style.left = '0';
|
|
1495
|
+
let Canvas$1 = class Canvas {
|
|
1496
|
+
constructor(config) {
|
|
1497
|
+
this.pixelRatio = 1;
|
|
1498
|
+
this.width = 0;
|
|
1499
|
+
this.height = 0;
|
|
1500
|
+
this.isCache = false;
|
|
1501
|
+
const conf = config || {};
|
|
1502
|
+
const pixelRatio = conf.pixelRatio || Global_1.Konva.pixelRatio || getDevicePixelRatio();
|
|
1503
|
+
this.pixelRatio = pixelRatio;
|
|
1504
|
+
this._canvas = Util_1.Util.createCanvasElement();
|
|
1505
|
+
this._canvas.style.padding = '0';
|
|
1506
|
+
this._canvas.style.margin = '0';
|
|
1507
|
+
this._canvas.style.border = '0';
|
|
1508
|
+
this._canvas.style.background = 'transparent';
|
|
1509
|
+
this._canvas.style.position = 'absolute';
|
|
1510
|
+
this._canvas.style.top = '0';
|
|
1511
|
+
this._canvas.style.left = '0';
|
|
1512
|
+
}
|
|
1513
|
+
getContext() {
|
|
1514
|
+
return this.context;
|
|
1515
|
+
}
|
|
1516
|
+
getPixelRatio() {
|
|
1517
|
+
return this.pixelRatio;
|
|
1518
|
+
}
|
|
1519
|
+
setPixelRatio(pixelRatio) {
|
|
1520
|
+
const previousRatio = this.pixelRatio;
|
|
1521
|
+
this.pixelRatio = pixelRatio;
|
|
1522
|
+
this.setSize(this.getWidth() / previousRatio, this.getHeight() / previousRatio);
|
|
1523
|
+
}
|
|
1524
|
+
setWidth(width) {
|
|
1525
|
+
this.width = this._canvas.width = width * this.pixelRatio;
|
|
1526
|
+
this._canvas.style.width = width + 'px';
|
|
1527
|
+
const pixelRatio = this.pixelRatio, _context = this.getContext()._context;
|
|
1528
|
+
_context.scale(pixelRatio, pixelRatio);
|
|
1529
|
+
}
|
|
1530
|
+
setHeight(height) {
|
|
1531
|
+
this.height = this._canvas.height = height * this.pixelRatio;
|
|
1532
|
+
this._canvas.style.height = height + 'px';
|
|
1533
|
+
const pixelRatio = this.pixelRatio, _context = this.getContext()._context;
|
|
1534
|
+
_context.scale(pixelRatio, pixelRatio);
|
|
1535
|
+
}
|
|
1536
|
+
getWidth() {
|
|
1537
|
+
return this.width;
|
|
1538
|
+
}
|
|
1539
|
+
getHeight() {
|
|
1540
|
+
return this.height;
|
|
1541
|
+
}
|
|
1542
|
+
setSize(width, height) {
|
|
1543
|
+
this.setWidth(width || 0);
|
|
1544
|
+
this.setHeight(height || 0);
|
|
1545
|
+
}
|
|
1546
|
+
toDataURL(mimeType, quality) {
|
|
1547
|
+
try {
|
|
1548
|
+
return this._canvas.toDataURL(mimeType, quality);
|
|
1549
|
+
}
|
|
1550
|
+
catch (e) {
|
|
1551
|
+
try {
|
|
1552
|
+
return this._canvas.toDataURL();
|
|
1553
|
+
}
|
|
1554
|
+
catch (err) {
|
|
1555
|
+
Util_1.Util.error('Unable to get data URL. ' +
|
|
1556
|
+
err.message +
|
|
1557
|
+
' For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html.');
|
|
1558
|
+
return '';
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
};
|
|
1563
|
+
Canvas.Canvas = Canvas$1;
|
|
1564
|
+
class SceneCanvas extends Canvas$1 {
|
|
1565
|
+
constructor(config = { width: 0, height: 0, willReadFrequently: false }) {
|
|
1566
|
+
super(config);
|
|
1567
|
+
this.context = new Context_1.SceneContext(this, {
|
|
1568
|
+
willReadFrequently: config.willReadFrequently,
|
|
1569
|
+
});
|
|
1570
|
+
this.setSize(config.width, config.height);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
Canvas.SceneCanvas = SceneCanvas;
|
|
1574
|
+
class HitCanvas extends Canvas$1 {
|
|
1575
|
+
constructor(config = { width: 0, height: 0 }) {
|
|
1576
|
+
super(config);
|
|
1577
|
+
this.hitCanvas = true;
|
|
1578
|
+
this.context = new Context_1.HitContext(this);
|
|
1579
|
+
this.setSize(config.width, config.height);
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
Canvas.HitCanvas = HitCanvas;
|
|
1583
|
+
return Canvas;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
var DragAndDrop = {};
|
|
1587
|
+
|
|
1588
|
+
var hasRequiredDragAndDrop;
|
|
1589
|
+
|
|
1590
|
+
function requireDragAndDrop () {
|
|
1591
|
+
if (hasRequiredDragAndDrop) return DragAndDrop;
|
|
1592
|
+
hasRequiredDragAndDrop = 1;
|
|
1593
|
+
(function (exports) {
|
|
1594
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1595
|
+
exports.DD = void 0;
|
|
1596
|
+
const Global_1 = requireGlobal();
|
|
1597
|
+
const Util_1 = requireUtil();
|
|
1598
|
+
exports.DD = {
|
|
1599
|
+
get isDragging() {
|
|
1600
|
+
let flag = false;
|
|
1601
|
+
exports.DD._dragElements.forEach((elem) => {
|
|
1602
|
+
if (elem.dragStatus === 'dragging') {
|
|
1603
|
+
flag = true;
|
|
1604
|
+
}
|
|
1605
|
+
});
|
|
1606
|
+
return flag;
|
|
1607
|
+
},
|
|
1608
|
+
justDragged: false,
|
|
1609
|
+
get node() {
|
|
1610
|
+
let node;
|
|
1611
|
+
exports.DD._dragElements.forEach((elem) => {
|
|
1612
|
+
node = elem.node;
|
|
1613
|
+
});
|
|
1614
|
+
return node;
|
|
1615
|
+
},
|
|
1616
|
+
_dragElements: new Map(),
|
|
1617
|
+
_drag(evt) {
|
|
1618
|
+
const nodesToFireEvents = [];
|
|
1619
|
+
exports.DD._dragElements.forEach((elem, key) => {
|
|
1620
|
+
const { node } = elem;
|
|
1621
|
+
const stage = node.getStage();
|
|
1622
|
+
stage.setPointersPositions(evt);
|
|
1623
|
+
if (elem.pointerId === undefined) {
|
|
1624
|
+
elem.pointerId = Util_1.Util._getFirstPointerId(evt);
|
|
1625
|
+
}
|
|
1626
|
+
const pos = stage._changedPointerPositions.find((pos) => pos.id === elem.pointerId);
|
|
1627
|
+
if (!pos) {
|
|
1628
|
+
return;
|
|
1629
|
+
}
|
|
1630
|
+
if (elem.dragStatus !== 'dragging') {
|
|
1631
|
+
const dragDistance = node.dragDistance();
|
|
1632
|
+
const distance = Math.max(Math.abs(pos.x - elem.startPointerPos.x), Math.abs(pos.y - elem.startPointerPos.y));
|
|
1633
|
+
if (distance < dragDistance) {
|
|
1634
|
+
return;
|
|
1635
|
+
}
|
|
1636
|
+
node.startDrag({ evt });
|
|
1637
|
+
if (!node.isDragging()) {
|
|
1638
|
+
return;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
node._setDragPosition(evt, elem);
|
|
1642
|
+
nodesToFireEvents.push(node);
|
|
1643
|
+
});
|
|
1644
|
+
nodesToFireEvents.forEach((node) => {
|
|
1645
|
+
node.fire('dragmove', {
|
|
1646
|
+
type: 'dragmove',
|
|
1647
|
+
target: node,
|
|
1648
|
+
evt: evt,
|
|
1649
|
+
}, true);
|
|
1650
|
+
});
|
|
1651
|
+
},
|
|
1652
|
+
_endDragBefore(evt) {
|
|
1653
|
+
const drawNodes = [];
|
|
1654
|
+
exports.DD._dragElements.forEach((elem) => {
|
|
1655
|
+
const { node } = elem;
|
|
1656
|
+
const stage = node.getStage();
|
|
1657
|
+
if (evt) {
|
|
1658
|
+
stage.setPointersPositions(evt);
|
|
1659
|
+
}
|
|
1660
|
+
const pos = stage._changedPointerPositions.find((pos) => pos.id === elem.pointerId);
|
|
1661
|
+
if (!pos) {
|
|
1662
|
+
return;
|
|
1663
|
+
}
|
|
1664
|
+
if (elem.dragStatus === 'dragging' || elem.dragStatus === 'stopped') {
|
|
1665
|
+
exports.DD.justDragged = true;
|
|
1666
|
+
Global_1.Konva._mouseListenClick = false;
|
|
1667
|
+
Global_1.Konva._touchListenClick = false;
|
|
1668
|
+
Global_1.Konva._pointerListenClick = false;
|
|
1669
|
+
elem.dragStatus = 'stopped';
|
|
1670
|
+
}
|
|
1671
|
+
const drawNode = elem.node.getLayer() ||
|
|
1672
|
+
(elem.node instanceof Global_1.Konva['Stage'] && elem.node);
|
|
1673
|
+
if (drawNode && drawNodes.indexOf(drawNode) === -1) {
|
|
1674
|
+
drawNodes.push(drawNode);
|
|
1675
|
+
}
|
|
1676
|
+
});
|
|
1677
|
+
drawNodes.forEach((drawNode) => {
|
|
1678
|
+
drawNode.draw();
|
|
1679
|
+
});
|
|
1680
|
+
},
|
|
1681
|
+
_endDragAfter(evt) {
|
|
1682
|
+
exports.DD._dragElements.forEach((elem, key) => {
|
|
1683
|
+
if (elem.dragStatus === 'stopped') {
|
|
1684
|
+
elem.node.fire('dragend', {
|
|
1685
|
+
type: 'dragend',
|
|
1686
|
+
target: elem.node,
|
|
1687
|
+
evt: evt,
|
|
1688
|
+
}, true);
|
|
1689
|
+
}
|
|
1690
|
+
if (elem.dragStatus !== 'dragging') {
|
|
1691
|
+
exports.DD._dragElements.delete(key);
|
|
1692
|
+
}
|
|
1693
|
+
});
|
|
1694
|
+
},
|
|
1695
|
+
};
|
|
1696
|
+
if (Global_1.Konva.isBrowser) {
|
|
1697
|
+
window.addEventListener('mouseup', exports.DD._endDragBefore, true);
|
|
1698
|
+
window.addEventListener('touchend', exports.DD._endDragBefore, true);
|
|
1699
|
+
window.addEventListener('touchcancel', exports.DD._endDragBefore, true);
|
|
1700
|
+
window.addEventListener('mousemove', exports.DD._drag);
|
|
1701
|
+
window.addEventListener('touchmove', exports.DD._drag);
|
|
1702
|
+
window.addEventListener('mouseup', exports.DD._endDragAfter, false);
|
|
1703
|
+
window.addEventListener('touchend', exports.DD._endDragAfter, false);
|
|
1704
|
+
window.addEventListener('touchcancel', exports.DD._endDragAfter, false);
|
|
1705
|
+
}
|
|
1706
|
+
} (DragAndDrop));
|
|
1707
|
+
return DragAndDrop;
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
var Factory = {};
|
|
1711
|
+
|
|
1712
|
+
var Validators = {};
|
|
1713
|
+
|
|
1714
|
+
var hasRequiredValidators;
|
|
1715
|
+
|
|
1716
|
+
function requireValidators () {
|
|
1717
|
+
if (hasRequiredValidators) return Validators;
|
|
1718
|
+
hasRequiredValidators = 1;
|
|
1719
|
+
Object.defineProperty(Validators, "__esModule", { value: true });
|
|
1720
|
+
Validators.RGBComponent = RGBComponent;
|
|
1721
|
+
Validators.alphaComponent = alphaComponent;
|
|
1722
|
+
Validators.getNumberValidator = getNumberValidator;
|
|
1723
|
+
Validators.getNumberOrArrayOfNumbersValidator = getNumberOrArrayOfNumbersValidator;
|
|
1724
|
+
Validators.getNumberOrAutoValidator = getNumberOrAutoValidator;
|
|
1725
|
+
Validators.getStringValidator = getStringValidator;
|
|
1726
|
+
Validators.getStringOrGradientValidator = getStringOrGradientValidator;
|
|
1727
|
+
Validators.getFunctionValidator = getFunctionValidator;
|
|
1728
|
+
Validators.getNumberArrayValidator = getNumberArrayValidator;
|
|
1729
|
+
Validators.getBooleanValidator = getBooleanValidator;
|
|
1730
|
+
Validators.getComponentValidator = getComponentValidator;
|
|
1731
|
+
const Global_1 = requireGlobal();
|
|
1732
|
+
const Util_1 = requireUtil();
|
|
1733
|
+
function _formatValue(val) {
|
|
1734
|
+
if (Util_1.Util._isString(val)) {
|
|
1735
|
+
return '"' + val + '"';
|
|
1736
|
+
}
|
|
1737
|
+
if (Object.prototype.toString.call(val) === '[object Number]') {
|
|
1738
|
+
return val;
|
|
1739
|
+
}
|
|
1740
|
+
if (Util_1.Util._isBoolean(val)) {
|
|
1741
|
+
return val;
|
|
1742
|
+
}
|
|
1743
|
+
return Object.prototype.toString.call(val);
|
|
1744
|
+
}
|
|
1745
|
+
function RGBComponent(val) {
|
|
1746
|
+
if (val > 255) {
|
|
1747
|
+
return 255;
|
|
1851
1748
|
}
|
|
1852
|
-
|
|
1853
|
-
return
|
|
1749
|
+
else if (val < 0) {
|
|
1750
|
+
return 0;
|
|
1854
1751
|
}
|
|
1855
|
-
|
|
1856
|
-
|
|
1752
|
+
return Math.round(val);
|
|
1753
|
+
}
|
|
1754
|
+
function alphaComponent(val) {
|
|
1755
|
+
if (val > 1) {
|
|
1756
|
+
return 1;
|
|
1857
1757
|
}
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
this.pixelRatio = pixelRatio;
|
|
1861
|
-
this.setSize(this.getWidth() / previousRatio, this.getHeight() / previousRatio);
|
|
1758
|
+
else if (val < 0.0001) {
|
|
1759
|
+
return 0.0001;
|
|
1862
1760
|
}
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1761
|
+
return val;
|
|
1762
|
+
}
|
|
1763
|
+
function getNumberValidator() {
|
|
1764
|
+
if (Global_1.Konva.isUnminified) {
|
|
1765
|
+
return function (val, attr) {
|
|
1766
|
+
if (!Util_1.Util._isNumber(val)) {
|
|
1767
|
+
Util_1.Util.warn(_formatValue(val) +
|
|
1768
|
+
' is a not valid value for "' +
|
|
1769
|
+
attr +
|
|
1770
|
+
'" attribute. The value should be a number.');
|
|
1771
|
+
}
|
|
1772
|
+
return val;
|
|
1773
|
+
};
|
|
1868
1774
|
}
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1775
|
+
}
|
|
1776
|
+
function getNumberOrArrayOfNumbersValidator(noOfElements) {
|
|
1777
|
+
if (Global_1.Konva.isUnminified) {
|
|
1778
|
+
return function (val, attr) {
|
|
1779
|
+
let isNumber = Util_1.Util._isNumber(val);
|
|
1780
|
+
let isValidArray = Util_1.Util._isArray(val) && val.length == noOfElements;
|
|
1781
|
+
if (!isNumber && !isValidArray) {
|
|
1782
|
+
Util_1.Util.warn(_formatValue(val) +
|
|
1783
|
+
' is a not valid value for "' +
|
|
1784
|
+
attr +
|
|
1785
|
+
'" attribute. The value should be a number or Array<number>(' +
|
|
1786
|
+
noOfElements +
|
|
1787
|
+
')');
|
|
1788
|
+
}
|
|
1789
|
+
return val;
|
|
1790
|
+
};
|
|
1874
1791
|
}
|
|
1875
|
-
|
|
1876
|
-
|
|
1792
|
+
}
|
|
1793
|
+
function getNumberOrAutoValidator() {
|
|
1794
|
+
if (Global_1.Konva.isUnminified) {
|
|
1795
|
+
return function (val, attr) {
|
|
1796
|
+
const isNumber = Util_1.Util._isNumber(val);
|
|
1797
|
+
const isAuto = val === 'auto';
|
|
1798
|
+
if (!(isNumber || isAuto)) {
|
|
1799
|
+
Util_1.Util.warn(_formatValue(val) +
|
|
1800
|
+
' is a not valid value for "' +
|
|
1801
|
+
attr +
|
|
1802
|
+
'" attribute. The value should be a number or "auto".');
|
|
1803
|
+
}
|
|
1804
|
+
return val;
|
|
1805
|
+
};
|
|
1877
1806
|
}
|
|
1878
|
-
|
|
1879
|
-
|
|
1807
|
+
}
|
|
1808
|
+
function getStringValidator() {
|
|
1809
|
+
if (Global_1.Konva.isUnminified) {
|
|
1810
|
+
return function (val, attr) {
|
|
1811
|
+
if (!Util_1.Util._isString(val)) {
|
|
1812
|
+
Util_1.Util.warn(_formatValue(val) +
|
|
1813
|
+
' is a not valid value for "' +
|
|
1814
|
+
attr +
|
|
1815
|
+
'" attribute. The value should be a string.');
|
|
1816
|
+
}
|
|
1817
|
+
return val;
|
|
1818
|
+
};
|
|
1880
1819
|
}
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1820
|
+
}
|
|
1821
|
+
function getStringOrGradientValidator() {
|
|
1822
|
+
if (Global_1.Konva.isUnminified) {
|
|
1823
|
+
return function (val, attr) {
|
|
1824
|
+
const isString = Util_1.Util._isString(val);
|
|
1825
|
+
const isGradient = Object.prototype.toString.call(val) === '[object CanvasGradient]' ||
|
|
1826
|
+
(val && val['addColorStop']);
|
|
1827
|
+
if (!(isString || isGradient)) {
|
|
1828
|
+
Util_1.Util.warn(_formatValue(val) +
|
|
1829
|
+
' is a not valid value for "' +
|
|
1830
|
+
attr +
|
|
1831
|
+
'" attribute. The value should be a string or a native gradient.');
|
|
1832
|
+
}
|
|
1833
|
+
return val;
|
|
1834
|
+
};
|
|
1884
1835
|
}
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1836
|
+
}
|
|
1837
|
+
function getFunctionValidator() {
|
|
1838
|
+
if (Global_1.Konva.isUnminified) {
|
|
1839
|
+
return function (val, attr) {
|
|
1840
|
+
if (!Util_1.Util._isFunction(val)) {
|
|
1841
|
+
Util_1.Util.warn(_formatValue(val) +
|
|
1842
|
+
' is a not valid value for "' +
|
|
1843
|
+
attr +
|
|
1844
|
+
'" attribute. The value should be a function.');
|
|
1892
1845
|
}
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1846
|
+
return val;
|
|
1847
|
+
};
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
function getNumberArrayValidator() {
|
|
1851
|
+
if (Global_1.Konva.isUnminified) {
|
|
1852
|
+
return function (val, attr) {
|
|
1853
|
+
const TypedArray = Int8Array ? Object.getPrototypeOf(Int8Array) : null;
|
|
1854
|
+
if (TypedArray && val instanceof TypedArray) {
|
|
1855
|
+
return val;
|
|
1898
1856
|
}
|
|
1899
|
-
|
|
1857
|
+
if (!Util_1.Util._isArray(val)) {
|
|
1858
|
+
Util_1.Util.warn(_formatValue(val) +
|
|
1859
|
+
' is a not valid value for "' +
|
|
1860
|
+
attr +
|
|
1861
|
+
'" attribute. The value should be a array of numbers.');
|
|
1862
|
+
}
|
|
1863
|
+
else {
|
|
1864
|
+
val.forEach(function (item) {
|
|
1865
|
+
if (!Util_1.Util._isNumber(item)) {
|
|
1866
|
+
Util_1.Util.warn('"' +
|
|
1867
|
+
attr +
|
|
1868
|
+
'" attribute has non numeric element ' +
|
|
1869
|
+
item +
|
|
1870
|
+
'. Make sure that all elements are numbers.');
|
|
1871
|
+
}
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
return val;
|
|
1875
|
+
};
|
|
1900
1876
|
}
|
|
1901
|
-
}
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1877
|
+
}
|
|
1878
|
+
function getBooleanValidator() {
|
|
1879
|
+
if (Global_1.Konva.isUnminified) {
|
|
1880
|
+
return function (val, attr) {
|
|
1881
|
+
const isBool = val === true || val === false;
|
|
1882
|
+
if (!isBool) {
|
|
1883
|
+
Util_1.Util.warn(_formatValue(val) +
|
|
1884
|
+
' is a not valid value for "' +
|
|
1885
|
+
attr +
|
|
1886
|
+
'" attribute. The value should be a boolean.');
|
|
1887
|
+
}
|
|
1888
|
+
return val;
|
|
1889
|
+
};
|
|
1911
1890
|
}
|
|
1912
1891
|
}
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1892
|
+
function getComponentValidator(components) {
|
|
1893
|
+
if (Global_1.Konva.isUnminified) {
|
|
1894
|
+
return function (val, attr) {
|
|
1895
|
+
if (val === undefined || val === null) {
|
|
1896
|
+
return val;
|
|
1897
|
+
}
|
|
1898
|
+
if (!Util_1.Util.isObject(val)) {
|
|
1899
|
+
Util_1.Util.warn(_formatValue(val) +
|
|
1900
|
+
' is a not valid value for "' +
|
|
1901
|
+
attr +
|
|
1902
|
+
'" attribute. The value should be an object with properties ' +
|
|
1903
|
+
components);
|
|
1904
|
+
}
|
|
1905
|
+
return val;
|
|
1906
|
+
};
|
|
1920
1907
|
}
|
|
1921
1908
|
}
|
|
1922
|
-
|
|
1923
|
-
return Canvas;
|
|
1909
|
+
return Validators;
|
|
1924
1910
|
}
|
|
1925
1911
|
|
|
1926
|
-
var
|
|
1927
|
-
|
|
1928
|
-
var hasRequiredDragAndDrop;
|
|
1912
|
+
var hasRequiredFactory;
|
|
1929
1913
|
|
|
1930
|
-
function
|
|
1931
|
-
if (
|
|
1932
|
-
|
|
1914
|
+
function requireFactory () {
|
|
1915
|
+
if (hasRequiredFactory) return Factory;
|
|
1916
|
+
hasRequiredFactory = 1;
|
|
1933
1917
|
(function (exports) {
|
|
1934
1918
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1935
|
-
exports.
|
|
1936
|
-
const Global_1 = requireGlobal();
|
|
1919
|
+
exports.Factory = void 0;
|
|
1937
1920
|
const Util_1 = requireUtil();
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
return flag;
|
|
1921
|
+
const Validators_1 = requireValidators();
|
|
1922
|
+
const GET = 'get';
|
|
1923
|
+
const SET = 'set';
|
|
1924
|
+
exports.Factory = {
|
|
1925
|
+
addGetterSetter(constructor, attr, def, validator, after) {
|
|
1926
|
+
exports.Factory.addGetter(constructor, attr, def);
|
|
1927
|
+
exports.Factory.addSetter(constructor, attr, validator, after);
|
|
1928
|
+
exports.Factory.addOverloadedGetterSetter(constructor, attr);
|
|
1947
1929
|
},
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1930
|
+
addGetter(constructor, attr, def) {
|
|
1931
|
+
const method = GET + Util_1.Util._capitalize(attr);
|
|
1932
|
+
constructor.prototype[method] =
|
|
1933
|
+
constructor.prototype[method] ||
|
|
1934
|
+
function () {
|
|
1935
|
+
const val = this.attrs[attr];
|
|
1936
|
+
return val === undefined ? def : val;
|
|
1937
|
+
};
|
|
1955
1938
|
},
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
if (!pos) {
|
|
1968
|
-
return;
|
|
1939
|
+
addSetter(constructor, attr, validator, after) {
|
|
1940
|
+
const method = SET + Util_1.Util._capitalize(attr);
|
|
1941
|
+
if (!constructor.prototype[method]) {
|
|
1942
|
+
exports.Factory.overWriteSetter(constructor, attr, validator, after);
|
|
1943
|
+
}
|
|
1944
|
+
},
|
|
1945
|
+
overWriteSetter(constructor, attr, validator, after) {
|
|
1946
|
+
const method = SET + Util_1.Util._capitalize(attr);
|
|
1947
|
+
constructor.prototype[method] = function (val) {
|
|
1948
|
+
if (validator && val !== undefined && val !== null) {
|
|
1949
|
+
val = validator.call(this, val, attr);
|
|
1969
1950
|
}
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
if (distance < dragDistance) {
|
|
1974
|
-
return;
|
|
1975
|
-
}
|
|
1976
|
-
node.startDrag({ evt });
|
|
1977
|
-
if (!node.isDragging()) {
|
|
1978
|
-
return;
|
|
1979
|
-
}
|
|
1951
|
+
this._setAttr(attr, val);
|
|
1952
|
+
if (after) {
|
|
1953
|
+
after.call(this);
|
|
1980
1954
|
}
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
});
|
|
1984
|
-
nodesToFireEvents.forEach((node) => {
|
|
1985
|
-
node.fire('dragmove', {
|
|
1986
|
-
type: 'dragmove',
|
|
1987
|
-
target: node,
|
|
1988
|
-
evt: evt,
|
|
1989
|
-
}, true);
|
|
1990
|
-
});
|
|
1955
|
+
return this;
|
|
1956
|
+
};
|
|
1991
1957
|
},
|
|
1992
|
-
|
|
1993
|
-
const
|
|
1994
|
-
|
|
1995
|
-
const
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1958
|
+
addComponentsGetterSetter(constructor, attr, components, validator, after) {
|
|
1959
|
+
const len = components.length, capitalize = Util_1.Util._capitalize, getter = GET + capitalize(attr), setter = SET + capitalize(attr);
|
|
1960
|
+
constructor.prototype[getter] = function () {
|
|
1961
|
+
const ret = {};
|
|
1962
|
+
for (let n = 0; n < len; n++) {
|
|
1963
|
+
const component = components[n];
|
|
1964
|
+
ret[component] = this.getAttr(attr + capitalize(component));
|
|
1999
1965
|
}
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
1966
|
+
return ret;
|
|
1967
|
+
};
|
|
1968
|
+
const basicValidator = (0, Validators_1.getComponentValidator)(components);
|
|
1969
|
+
constructor.prototype[setter] = function (val) {
|
|
1970
|
+
const oldVal = this.attrs[attr];
|
|
1971
|
+
if (validator) {
|
|
1972
|
+
val = validator.call(this, val, attr);
|
|
2003
1973
|
}
|
|
2004
|
-
if (
|
|
2005
|
-
|
|
2006
|
-
Global_1.Konva._mouseListenClick = false;
|
|
2007
|
-
Global_1.Konva._touchListenClick = false;
|
|
2008
|
-
Global_1.Konva._pointerListenClick = false;
|
|
2009
|
-
elem.dragStatus = 'stopped';
|
|
1974
|
+
if (basicValidator) {
|
|
1975
|
+
basicValidator.call(this, val, attr);
|
|
2010
1976
|
}
|
|
2011
|
-
const
|
|
2012
|
-
(
|
|
2013
|
-
|
|
2014
|
-
|
|
1977
|
+
for (const key in val) {
|
|
1978
|
+
if (!val.hasOwnProperty(key)) {
|
|
1979
|
+
continue;
|
|
1980
|
+
}
|
|
1981
|
+
this._setAttr(attr + capitalize(key), val[key]);
|
|
2015
1982
|
}
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
1983
|
+
if (!val) {
|
|
1984
|
+
components.forEach((component) => {
|
|
1985
|
+
this._setAttr(attr + capitalize(component), undefined);
|
|
1986
|
+
});
|
|
1987
|
+
}
|
|
1988
|
+
this._fireChangeEvent(attr, oldVal, val);
|
|
1989
|
+
if (after) {
|
|
1990
|
+
after.call(this);
|
|
1991
|
+
}
|
|
1992
|
+
return this;
|
|
1993
|
+
};
|
|
1994
|
+
exports.Factory.addOverloadedGetterSetter(constructor, attr);
|
|
2020
1995
|
},
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
evt: evt,
|
|
2028
|
-
}, true);
|
|
1996
|
+
addOverloadedGetterSetter(constructor, attr) {
|
|
1997
|
+
const capitalizedAttr = Util_1.Util._capitalize(attr), setter = SET + capitalizedAttr, getter = GET + capitalizedAttr;
|
|
1998
|
+
constructor.prototype[attr] = function () {
|
|
1999
|
+
if (arguments.length) {
|
|
2000
|
+
this[setter](arguments[0]);
|
|
2001
|
+
return this;
|
|
2029
2002
|
}
|
|
2030
|
-
|
|
2031
|
-
|
|
2003
|
+
return this[getter]();
|
|
2004
|
+
};
|
|
2005
|
+
},
|
|
2006
|
+
addDeprecatedGetterSetter(constructor, attr, def, validator) {
|
|
2007
|
+
Util_1.Util.error('Adding deprecated ' + attr);
|
|
2008
|
+
const method = GET + Util_1.Util._capitalize(attr);
|
|
2009
|
+
const message = attr +
|
|
2010
|
+
' property is deprecated and will be removed soon. Look at Konva change log for more information.';
|
|
2011
|
+
constructor.prototype[method] = function () {
|
|
2012
|
+
Util_1.Util.error(message);
|
|
2013
|
+
const val = this.attrs[attr];
|
|
2014
|
+
return val === undefined ? def : val;
|
|
2015
|
+
};
|
|
2016
|
+
exports.Factory.addSetter(constructor, attr, validator, function () {
|
|
2017
|
+
Util_1.Util.error(message);
|
|
2018
|
+
});
|
|
2019
|
+
exports.Factory.addOverloadedGetterSetter(constructor, attr);
|
|
2020
|
+
},
|
|
2021
|
+
backCompat(constructor, methods) {
|
|
2022
|
+
Util_1.Util.each(methods, function (oldMethodName, newMethodName) {
|
|
2023
|
+
const method = constructor.prototype[newMethodName];
|
|
2024
|
+
const oldGetter = GET + Util_1.Util._capitalize(oldMethodName);
|
|
2025
|
+
const oldSetter = SET + Util_1.Util._capitalize(oldMethodName);
|
|
2026
|
+
function deprecated() {
|
|
2027
|
+
method.apply(this, arguments);
|
|
2028
|
+
Util_1.Util.error('"' +
|
|
2029
|
+
oldMethodName +
|
|
2030
|
+
'" method is deprecated and will be removed soon. Use ""' +
|
|
2031
|
+
newMethodName +
|
|
2032
|
+
'" instead.');
|
|
2032
2033
|
}
|
|
2034
|
+
constructor.prototype[oldMethodName] = deprecated;
|
|
2035
|
+
constructor.prototype[oldGetter] = deprecated;
|
|
2036
|
+
constructor.prototype[oldSetter] = deprecated;
|
|
2033
2037
|
});
|
|
2034
2038
|
},
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
window.addEventListener('touchmove', exports.DD._drag);
|
|
2042
|
-
window.addEventListener('mouseup', exports.DD._endDragAfter, false);
|
|
2043
|
-
window.addEventListener('touchend', exports.DD._endDragAfter, false);
|
|
2044
|
-
window.addEventListener('touchcancel', exports.DD._endDragAfter, false);
|
|
2045
|
-
}
|
|
2046
|
-
} (DragAndDrop));
|
|
2047
|
-
return DragAndDrop;
|
|
2039
|
+
afterSetFilter() {
|
|
2040
|
+
this._filterUpToDate = false;
|
|
2041
|
+
},
|
|
2042
|
+
};
|
|
2043
|
+
} (Factory));
|
|
2044
|
+
return Factory;
|
|
2048
2045
|
}
|
|
2049
2046
|
|
|
2050
2047
|
var hasRequiredNode;
|
|
@@ -2053,14 +2050,14 @@
|
|
|
2053
2050
|
if (hasRequiredNode) return Node;
|
|
2054
2051
|
hasRequiredNode = 1;
|
|
2055
2052
|
Object.defineProperty(Node, "__esModule", { value: true });
|
|
2056
|
-
Node.Node =
|
|
2057
|
-
const Util_1 = requireUtil();
|
|
2058
|
-
const Factory_1 = requireFactory();
|
|
2053
|
+
Node.Node = void 0;
|
|
2059
2054
|
const Canvas_1 = requireCanvas();
|
|
2060
|
-
const Global_1 = requireGlobal();
|
|
2061
2055
|
const DragAndDrop_1 = requireDragAndDrop();
|
|
2056
|
+
const Factory_1 = requireFactory();
|
|
2057
|
+
const Global_1 = requireGlobal();
|
|
2058
|
+
const Util_1 = requireUtil();
|
|
2062
2059
|
const Validators_1 = requireValidators();
|
|
2063
|
-
const ABSOLUTE_OPACITY = 'absoluteOpacity', ALL_LISTENERS = 'allEventListeners', ABSOLUTE_TRANSFORM = 'absoluteTransform', ABSOLUTE_SCALE = 'absoluteScale', CANVAS = 'canvas', CHANGE = 'Change', CHILDREN = 'children', KONVA = 'konva', LISTENING = 'listening', MOUSEENTER = 'mouseenter', MOUSELEAVE = 'mouseleave', SET = 'set', SHAPE = 'Shape', SPACE = ' ', STAGE = 'stage', TRANSFORM = 'transform', UPPER_STAGE = 'Stage', VISIBLE = 'visible', TRANSFORM_CHANGE_STR = [
|
|
2060
|
+
const ABSOLUTE_OPACITY = 'absoluteOpacity', ALL_LISTENERS = 'allEventListeners', ABSOLUTE_TRANSFORM = 'absoluteTransform', ABSOLUTE_SCALE = 'absoluteScale', CANVAS = 'canvas', CHANGE = 'Change', CHILDREN = 'children', KONVA = 'konva', LISTENING = 'listening', MOUSEENTER = 'mouseenter', MOUSELEAVE = 'mouseleave', POINTERENTER = 'pointerenter', POINTERLEAVE = 'pointerleave', TOUCHENTER = 'touchenter', TOUCHLEAVE = 'touchleave', SET = 'set', SHAPE = 'Shape', SPACE = ' ', STAGE = 'stage', TRANSFORM = 'transform', UPPER_STAGE = 'Stage', VISIBLE = 'visible', TRANSFORM_CHANGE_STR = [
|
|
2064
2061
|
'xChange.konva',
|
|
2065
2062
|
'yChange.konva',
|
|
2066
2063
|
'scaleXChange.konva',
|
|
@@ -2139,8 +2136,8 @@
|
|
|
2139
2136
|
}
|
|
2140
2137
|
clearCache() {
|
|
2141
2138
|
if (this._cache.has(CANVAS)) {
|
|
2142
|
-
const { scene, filter, hit } = this._cache.get(CANVAS);
|
|
2143
|
-
Util_1.Util.releaseCanvas(scene, filter, hit);
|
|
2139
|
+
const { scene, filter, hit, buffer } = this._cache.get(CANVAS);
|
|
2140
|
+
Util_1.Util.releaseCanvas(scene, filter, hit, buffer);
|
|
2144
2141
|
this._cache.delete(CANVAS);
|
|
2145
2142
|
}
|
|
2146
2143
|
this._clearSelfAndDescendantCache();
|
|
@@ -2184,6 +2181,11 @@
|
|
|
2184
2181
|
width: width,
|
|
2185
2182
|
height: height,
|
|
2186
2183
|
}), sceneContext = cachedSceneCanvas.getContext(), hitContext = cachedHitCanvas.getContext();
|
|
2184
|
+
const bufferCanvas = new Canvas_1.SceneCanvas({
|
|
2185
|
+
width: cachedSceneCanvas.width / cachedSceneCanvas.pixelRatio + Math.abs(x),
|
|
2186
|
+
height: cachedSceneCanvas.height / cachedSceneCanvas.pixelRatio + Math.abs(y),
|
|
2187
|
+
pixelRatio: cachedSceneCanvas.pixelRatio,
|
|
2188
|
+
}), bufferContext = bufferCanvas.getContext();
|
|
2187
2189
|
cachedHitCanvas.isCache = true;
|
|
2188
2190
|
cachedSceneCanvas.isCache = true;
|
|
2189
2191
|
this._cache.delete(CANVAS);
|
|
@@ -2194,12 +2196,16 @@
|
|
|
2194
2196
|
}
|
|
2195
2197
|
sceneContext.save();
|
|
2196
2198
|
hitContext.save();
|
|
2199
|
+
bufferContext.save();
|
|
2197
2200
|
sceneContext.translate(-x, -y);
|
|
2198
2201
|
hitContext.translate(-x, -y);
|
|
2202
|
+
bufferContext.translate(-x, -y);
|
|
2203
|
+
bufferCanvas.x = x;
|
|
2204
|
+
bufferCanvas.y = y;
|
|
2199
2205
|
this._isUnderCache = true;
|
|
2200
2206
|
this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY);
|
|
2201
2207
|
this._clearSelfAndDescendantCache(ABSOLUTE_SCALE);
|
|
2202
|
-
this.drawScene(cachedSceneCanvas, this);
|
|
2208
|
+
this.drawScene(cachedSceneCanvas, this, bufferCanvas);
|
|
2203
2209
|
this.drawHit(cachedHitCanvas, this);
|
|
2204
2210
|
this._isUnderCache = false;
|
|
2205
2211
|
sceneContext.restore();
|
|
@@ -2218,6 +2224,7 @@
|
|
|
2218
2224
|
scene: cachedSceneCanvas,
|
|
2219
2225
|
filter: cachedFilterCanvas,
|
|
2220
2226
|
hit: cachedHitCanvas,
|
|
2227
|
+
buffer: bufferCanvas,
|
|
2221
2228
|
x: x,
|
|
2222
2229
|
y: y,
|
|
2223
2230
|
});
|
|
@@ -2310,23 +2317,22 @@
|
|
|
2310
2317
|
return sceneCanvas;
|
|
2311
2318
|
}
|
|
2312
2319
|
on(evtStr, handler) {
|
|
2313
|
-
|
|
2320
|
+
if (this._cache) {
|
|
2321
|
+
this._cache.delete(ALL_LISTENERS);
|
|
2322
|
+
}
|
|
2314
2323
|
if (arguments.length === 3) {
|
|
2315
2324
|
return this._delegate.apply(this, arguments);
|
|
2316
2325
|
}
|
|
2317
|
-
|
|
2318
|
-
for (n = 0; n <
|
|
2319
|
-
event = events[n];
|
|
2320
|
-
parts = event.split('.');
|
|
2321
|
-
baseEvent = parts[0];
|
|
2322
|
-
name = parts[1] || '';
|
|
2326
|
+
const events = evtStr.split(SPACE);
|
|
2327
|
+
for (let n = 0; n < events.length; n++) {
|
|
2328
|
+
const event = events[n];
|
|
2329
|
+
const parts = event.split('.');
|
|
2330
|
+
const baseEvent = parts[0];
|
|
2331
|
+
const name = parts[1] || '';
|
|
2323
2332
|
if (!this.eventListeners[baseEvent]) {
|
|
2324
2333
|
this.eventListeners[baseEvent] = [];
|
|
2325
2334
|
}
|
|
2326
|
-
this.eventListeners[baseEvent].push({
|
|
2327
|
-
name: name,
|
|
2328
|
-
handler: handler,
|
|
2329
|
-
});
|
|
2335
|
+
this.eventListeners[baseEvent].push({ name, handler });
|
|
2330
2336
|
}
|
|
2331
2337
|
return this;
|
|
2332
2338
|
}
|
|
@@ -2958,7 +2964,7 @@
|
|
|
2958
2964
|
var _a, _b;
|
|
2959
2965
|
const m = this._cache.get(TRANSFORM) || new Util_1.Transform();
|
|
2960
2966
|
m.reset();
|
|
2961
|
-
const x = this.x(), y = this.y(), rotation = Global_1.Konva.getAngle(this.rotation()), scaleX = (_a = this.attrs.scaleX) !== null && _a !==
|
|
2967
|
+
const x = this.x(), y = this.y(), rotation = Global_1.Konva.getAngle(this.rotation()), scaleX = (_a = this.attrs.scaleX) !== null && _a !== void 0 ? _a : 1, scaleY = (_b = this.attrs.scaleY) !== null && _b !== void 0 ? _b : 1, skewX = this.attrs.skewX || 0, skewY = this.attrs.skewY || 0, offsetX = this.attrs.offsetX || 0, offsetY = this.attrs.offsetY || 0;
|
|
2962
2968
|
if (x !== 0 || y !== 0) {
|
|
2963
2969
|
m.translate(x, y);
|
|
2964
2970
|
}
|
|
@@ -3160,7 +3166,7 @@
|
|
|
3160
3166
|
_requestDraw() {
|
|
3161
3167
|
if (Global_1.Konva.autoDrawEnabled) {
|
|
3162
3168
|
const drawNode = this.getLayer() || this.getStage();
|
|
3163
|
-
drawNode === null || drawNode ===
|
|
3169
|
+
drawNode === null || drawNode === void 0 ? void 0 : drawNode.batchDraw();
|
|
3164
3170
|
}
|
|
3165
3171
|
}
|
|
3166
3172
|
_setAttr(key, val) {
|
|
@@ -3194,14 +3200,22 @@
|
|
|
3194
3200
|
if (evt && this.nodeType === SHAPE) {
|
|
3195
3201
|
evt.target = this;
|
|
3196
3202
|
}
|
|
3197
|
-
const
|
|
3203
|
+
const nonBubbling = [
|
|
3204
|
+
MOUSEENTER,
|
|
3205
|
+
MOUSELEAVE,
|
|
3206
|
+
POINTERENTER,
|
|
3207
|
+
POINTERLEAVE,
|
|
3208
|
+
TOUCHENTER,
|
|
3209
|
+
TOUCHLEAVE,
|
|
3210
|
+
];
|
|
3211
|
+
const shouldStop = nonBubbling.indexOf(eventType) !== -1 &&
|
|
3198
3212
|
((compareShape &&
|
|
3199
3213
|
(this === compareShape ||
|
|
3200
3214
|
(this.isAncestorOf && this.isAncestorOf(compareShape)))) ||
|
|
3201
3215
|
(this.nodeType === 'Stage' && !compareShape));
|
|
3202
3216
|
if (!shouldStop) {
|
|
3203
3217
|
this._fire(eventType, evt);
|
|
3204
|
-
const stopBubble = (eventType
|
|
3218
|
+
const stopBubble = nonBubbling.indexOf(eventType) !== -1 &&
|
|
3205
3219
|
compareShape &&
|
|
3206
3220
|
compareShape.isAncestorOf &&
|
|
3207
3221
|
compareShape.isAncestorOf(this) &&
|
|
@@ -3221,13 +3235,13 @@
|
|
|
3221
3235
|
}
|
|
3222
3236
|
_getProtoListeners(eventType) {
|
|
3223
3237
|
var _a, _b, _c;
|
|
3224
|
-
const allListeners = (_a = this._cache.get(ALL_LISTENERS)) !== null && _a !==
|
|
3225
|
-
let events = allListeners === null || allListeners ===
|
|
3238
|
+
const allListeners = (_a = this._cache.get(ALL_LISTENERS)) !== null && _a !== void 0 ? _a : {};
|
|
3239
|
+
let events = allListeners === null || allListeners === void 0 ? void 0 : allListeners[eventType];
|
|
3226
3240
|
if (events === undefined) {
|
|
3227
3241
|
events = [];
|
|
3228
3242
|
let obj = Object.getPrototypeOf(this);
|
|
3229
3243
|
while (obj) {
|
|
3230
|
-
const hierarchyEvents = (_c = (_b = obj.eventListeners) === null || _b ===
|
|
3244
|
+
const hierarchyEvents = (_c = (_b = obj.eventListeners) === null || _b === void 0 ? void 0 : _b[eventType]) !== null && _c !== void 0 ? _c : [];
|
|
3231
3245
|
events.push(...hierarchyEvents);
|
|
3232
3246
|
obj = Object.getPrototypeOf(obj);
|
|
3233
3247
|
}
|
|
@@ -3242,13 +3256,13 @@
|
|
|
3242
3256
|
evt.type = eventType;
|
|
3243
3257
|
const topListeners = this._getProtoListeners(eventType);
|
|
3244
3258
|
if (topListeners) {
|
|
3245
|
-
for (
|
|
3259
|
+
for (let i = 0; i < topListeners.length; i++) {
|
|
3246
3260
|
topListeners[i].handler.call(this, evt);
|
|
3247
3261
|
}
|
|
3248
3262
|
}
|
|
3249
3263
|
const selfListeners = this.eventListeners[eventType];
|
|
3250
3264
|
if (selfListeners) {
|
|
3251
|
-
for (
|
|
3265
|
+
for (let i = 0; i < selfListeners.length; i++) {
|
|
3252
3266
|
selfListeners[i].handler.call(this, evt);
|
|
3253
3267
|
}
|
|
3254
3268
|
}
|
|
@@ -3493,7 +3507,7 @@
|
|
|
3493
3507
|
if (hasRequiredContainer) return Container;
|
|
3494
3508
|
hasRequiredContainer = 1;
|
|
3495
3509
|
Object.defineProperty(Container, "__esModule", { value: true });
|
|
3496
|
-
Container.Container =
|
|
3510
|
+
Container.Container = void 0;
|
|
3497
3511
|
const Factory_1 = requireFactory();
|
|
3498
3512
|
const Node_1 = requireNode();
|
|
3499
3513
|
const Validators_1 = requireValidators();
|
|
@@ -3503,17 +3517,11 @@
|
|
|
3503
3517
|
this.children = [];
|
|
3504
3518
|
}
|
|
3505
3519
|
getChildren(filterFunc) {
|
|
3506
|
-
if (!filterFunc) {
|
|
3507
|
-
return this.children || [];
|
|
3508
|
-
}
|
|
3509
3520
|
const children = this.children || [];
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
}
|
|
3515
|
-
});
|
|
3516
|
-
return results;
|
|
3521
|
+
if (filterFunc) {
|
|
3522
|
+
return children.filter(filterFunc);
|
|
3523
|
+
}
|
|
3524
|
+
return children;
|
|
3517
3525
|
}
|
|
3518
3526
|
hasChildren() {
|
|
3519
3527
|
return this.getChildren().length > 0;
|
|
@@ -3650,13 +3658,13 @@
|
|
|
3650
3658
|
if (this.isCached()) {
|
|
3651
3659
|
return;
|
|
3652
3660
|
}
|
|
3653
|
-
(_a = this.children) === null || _a ===
|
|
3661
|
+
(_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (node) {
|
|
3654
3662
|
node._clearSelfAndDescendantCache(attr);
|
|
3655
3663
|
});
|
|
3656
3664
|
}
|
|
3657
3665
|
_setChildrenIndices() {
|
|
3658
3666
|
var _a;
|
|
3659
|
-
(_a = this.children) === null || _a ===
|
|
3667
|
+
(_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child, n) {
|
|
3660
3668
|
child.index = n;
|
|
3661
3669
|
});
|
|
3662
3670
|
this._requestDraw();
|
|
@@ -3727,7 +3735,7 @@
|
|
|
3727
3735
|
context.save();
|
|
3728
3736
|
context._applyGlobalCompositeOperation(this);
|
|
3729
3737
|
}
|
|
3730
|
-
(_a = this.children) === null || _a ===
|
|
3738
|
+
(_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {
|
|
3731
3739
|
child[drawMethod](canvas, top, bufferCanvas);
|
|
3732
3740
|
});
|
|
3733
3741
|
if (hasComposition) {
|
|
@@ -3749,7 +3757,7 @@
|
|
|
3749
3757
|
height: 0,
|
|
3750
3758
|
};
|
|
3751
3759
|
const that = this;
|
|
3752
|
-
(_a = this.children) === null || _a ===
|
|
3760
|
+
(_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {
|
|
3753
3761
|
if (!child.visible()) {
|
|
3754
3762
|
return;
|
|
3755
3763
|
}
|
|
@@ -3881,7 +3889,7 @@
|
|
|
3881
3889
|
hasRequiredStage = 1;
|
|
3882
3890
|
(function (exports) {
|
|
3883
3891
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3884
|
-
exports.Stage = exports.stages =
|
|
3892
|
+
exports.Stage = exports.stages = void 0;
|
|
3885
3893
|
const Util_1 = requireUtil();
|
|
3886
3894
|
const Factory_1 = requireFactory();
|
|
3887
3895
|
const Container_1 = requireContainer();
|
|
@@ -3907,6 +3915,7 @@
|
|
|
3907
3915
|
[POINTERMOVE, '_pointermove'],
|
|
3908
3916
|
[POINTERUP, '_pointerup'],
|
|
3909
3917
|
[POINTERCANCEL, '_pointercancel'],
|
|
3918
|
+
[POINTERLEAVE, '_pointerleave'],
|
|
3910
3919
|
[LOSTPOINTERCAPTURE, '_lostpointercapture'],
|
|
3911
3920
|
];
|
|
3912
3921
|
const EVENTS_MAP = {
|
|
@@ -4008,12 +4017,12 @@
|
|
|
4008
4017
|
}
|
|
4009
4018
|
setContainer(container) {
|
|
4010
4019
|
if (typeof container === STRING) {
|
|
4020
|
+
let id;
|
|
4011
4021
|
if (container.charAt(0) === '.') {
|
|
4012
4022
|
const className = container.slice(1);
|
|
4013
4023
|
container = document.getElementsByClassName(className)[0];
|
|
4014
4024
|
}
|
|
4015
4025
|
else {
|
|
4016
|
-
var id;
|
|
4017
4026
|
if (container.charAt(0) !== '#') {
|
|
4018
4027
|
id = container;
|
|
4019
4028
|
}
|
|
@@ -4598,7 +4607,7 @@
|
|
|
4598
4607
|
hasRequiredShape = 1;
|
|
4599
4608
|
(function (exports) {
|
|
4600
4609
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4601
|
-
exports.Shape = exports.shapes =
|
|
4610
|
+
exports.Shape = exports.shapes = void 0;
|
|
4602
4611
|
const Global_1 = requireGlobal();
|
|
4603
4612
|
const Util_1 = requireUtil();
|
|
4604
4613
|
const Factory_1 = requireFactory();
|
|
@@ -4831,7 +4840,7 @@
|
|
|
4831
4840
|
}
|
|
4832
4841
|
_useBufferCanvas(forceFill) {
|
|
4833
4842
|
var _a;
|
|
4834
|
-
const perfectDrawEnabled = (_a = this.attrs.perfectDrawEnabled) !== null && _a !==
|
|
4843
|
+
const perfectDrawEnabled = (_a = this.attrs.perfectDrawEnabled) !== null && _a !== void 0 ? _a : true;
|
|
4835
4844
|
if (!perfectDrawEnabled) {
|
|
4836
4845
|
return false;
|
|
4837
4846
|
}
|
|
@@ -4916,8 +4925,8 @@
|
|
|
4916
4925
|
}
|
|
4917
4926
|
drawScene(can, top, bufferCanvas) {
|
|
4918
4927
|
const layer = this.getLayer();
|
|
4919
|
-
|
|
4920
|
-
|
|
4928
|
+
const canvas = can || layer.getCanvas(), context = canvas.getContext(), cachedCanvas = this._getCanvasCache(), drawFunc = this.getSceneFunc(), hasShadow = this.hasShadow();
|
|
4929
|
+
let stage;
|
|
4921
4930
|
const cachingSelf = top === this;
|
|
4922
4931
|
if (!this.isVisible() && !cachingSelf) {
|
|
4923
4932
|
return this;
|
|
@@ -4934,14 +4943,14 @@
|
|
|
4934
4943
|
return this;
|
|
4935
4944
|
}
|
|
4936
4945
|
context.save();
|
|
4937
|
-
if (this._useBufferCanvas() &&
|
|
4946
|
+
if (this._useBufferCanvas() && true) {
|
|
4938
4947
|
stage = this.getStage();
|
|
4939
4948
|
const bc = bufferCanvas || stage.bufferCanvas;
|
|
4940
|
-
bufferContext = bc.getContext();
|
|
4949
|
+
const bufferContext = bc.getContext();
|
|
4941
4950
|
bufferContext.clear();
|
|
4942
4951
|
bufferContext.save();
|
|
4943
4952
|
bufferContext._applyLineJoin(this);
|
|
4944
|
-
|
|
4953
|
+
const o = this.getAbsoluteTransform(top).getMatrix();
|
|
4945
4954
|
bufferContext.transform(o[0], o[1], o[2], o[3], o[4], o[5]);
|
|
4946
4955
|
drawFunc.call(this, bufferContext, this);
|
|
4947
4956
|
bufferContext.restore();
|
|
@@ -4951,12 +4960,12 @@
|
|
|
4951
4960
|
}
|
|
4952
4961
|
context._applyOpacity(this);
|
|
4953
4962
|
context._applyGlobalCompositeOperation(this);
|
|
4954
|
-
context.drawImage(bc._canvas, 0, 0, bc.width / ratio, bc.height / ratio);
|
|
4963
|
+
context.drawImage(bc._canvas, bc.x || 0, bc.y || 0, bc.width / ratio, bc.height / ratio);
|
|
4955
4964
|
}
|
|
4956
4965
|
else {
|
|
4957
4966
|
context._applyLineJoin(this);
|
|
4958
4967
|
if (!cachingSelf) {
|
|
4959
|
-
|
|
4968
|
+
const o = this.getAbsoluteTransform(top).getMatrix();
|
|
4960
4969
|
context.transform(o[0], o[1], o[2], o[3], o[4], o[5]);
|
|
4961
4970
|
context._applyOpacity(this);
|
|
4962
4971
|
context._applyGlobalCompositeOperation(this);
|
|
@@ -5151,7 +5160,7 @@
|
|
|
5151
5160
|
if (hasRequiredLayer) return Layer;
|
|
5152
5161
|
hasRequiredLayer = 1;
|
|
5153
5162
|
Object.defineProperty(Layer, "__esModule", { value: true });
|
|
5154
|
-
Layer.Layer =
|
|
5163
|
+
Layer.Layer = void 0;
|
|
5155
5164
|
const Util_1 = requireUtil();
|
|
5156
5165
|
const Container_1 = requireContainer();
|
|
5157
5166
|
const Node_1 = requireNode();
|
|
@@ -5396,7 +5405,7 @@
|
|
|
5396
5405
|
}
|
|
5397
5406
|
return {};
|
|
5398
5407
|
}
|
|
5399
|
-
drawScene(can, top) {
|
|
5408
|
+
drawScene(can, top, bufferCanvas) {
|
|
5400
5409
|
const layer = this.getLayer(), canvas = can || (layer && layer.getCanvas());
|
|
5401
5410
|
this._fire(BEFORE_DRAW, {
|
|
5402
5411
|
node: this,
|
|
@@ -5404,7 +5413,7 @@
|
|
|
5404
5413
|
if (this.clearBeforeDraw()) {
|
|
5405
5414
|
canvas.getContext().clear();
|
|
5406
5415
|
}
|
|
5407
|
-
Container_1.Container.prototype.drawScene.call(this, canvas, top);
|
|
5416
|
+
Container_1.Container.prototype.drawScene.call(this, canvas, top, bufferCanvas);
|
|
5408
5417
|
this._fire(DRAW, {
|
|
5409
5418
|
node: this,
|
|
5410
5419
|
});
|
|
@@ -5469,7 +5478,7 @@
|
|
|
5469
5478
|
if (hasRequiredFastLayer) return FastLayer;
|
|
5470
5479
|
hasRequiredFastLayer = 1;
|
|
5471
5480
|
Object.defineProperty(FastLayer, "__esModule", { value: true });
|
|
5472
|
-
FastLayer.FastLayer =
|
|
5481
|
+
FastLayer.FastLayer = void 0;
|
|
5473
5482
|
const Util_1 = requireUtil();
|
|
5474
5483
|
const Layer_1 = requireLayer();
|
|
5475
5484
|
const Global_1 = requireGlobal();
|
|
@@ -5494,7 +5503,7 @@
|
|
|
5494
5503
|
if (hasRequiredGroup) return Group;
|
|
5495
5504
|
hasRequiredGroup = 1;
|
|
5496
5505
|
Object.defineProperty(Group, "__esModule", { value: true });
|
|
5497
|
-
Group.Group =
|
|
5506
|
+
Group.Group = void 0;
|
|
5498
5507
|
const Util_1 = requireUtil();
|
|
5499
5508
|
const Container_1 = requireContainer();
|
|
5500
5509
|
const Global_1 = requireGlobal();
|
|
@@ -5520,7 +5529,7 @@
|
|
|
5520
5529
|
if (hasRequiredAnimation) return Animation;
|
|
5521
5530
|
hasRequiredAnimation = 1;
|
|
5522
5531
|
Object.defineProperty(Animation, "__esModule", { value: true });
|
|
5523
|
-
Animation.Animation =
|
|
5532
|
+
Animation.Animation = void 0;
|
|
5524
5533
|
const Global_1 = requireGlobal();
|
|
5525
5534
|
const Util_1 = requireUtil();
|
|
5526
5535
|
const now = (function () {
|
|
@@ -5676,7 +5685,7 @@
|
|
|
5676
5685
|
hasRequiredTween = 1;
|
|
5677
5686
|
(function (exports) {
|
|
5678
5687
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5679
|
-
exports.Easings = exports.Tween =
|
|
5688
|
+
exports.Easings = exports.Tween = void 0;
|
|
5680
5689
|
const Util_1 = requireUtil();
|
|
5681
5690
|
const Animation_1 = requireAnimation();
|
|
5682
5691
|
const Node_1 = requireNode();
|
|
@@ -6032,10 +6041,21 @@
|
|
|
6032
6041
|
destroy() {
|
|
6033
6042
|
const nodeId = this.node._id, thisId = this._id, attrs = Tween.tweens[nodeId];
|
|
6034
6043
|
this.pause();
|
|
6044
|
+
if (this.anim) {
|
|
6045
|
+
this.anim.stop();
|
|
6046
|
+
}
|
|
6035
6047
|
for (const key in attrs) {
|
|
6036
6048
|
delete Tween.tweens[nodeId][key];
|
|
6037
6049
|
}
|
|
6038
6050
|
delete Tween.attrs[nodeId][thisId];
|
|
6051
|
+
if (Tween.tweens[nodeId]) {
|
|
6052
|
+
if (Object.keys(Tween.tweens[nodeId]).length === 0) {
|
|
6053
|
+
delete Tween.tweens[nodeId];
|
|
6054
|
+
}
|
|
6055
|
+
if (Object.keys(Tween.attrs[nodeId]).length === 0) {
|
|
6056
|
+
delete Tween.attrs[nodeId];
|
|
6057
|
+
}
|
|
6058
|
+
}
|
|
6039
6059
|
}
|
|
6040
6060
|
}
|
|
6041
6061
|
exports.Tween = Tween;
|
|
@@ -6209,7 +6229,7 @@
|
|
|
6209
6229
|
hasRequired_CoreInternals = 1;
|
|
6210
6230
|
(function (exports) {
|
|
6211
6231
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6212
|
-
exports.Konva =
|
|
6232
|
+
exports.Konva = void 0;
|
|
6213
6233
|
const Global_1 = requireGlobal();
|
|
6214
6234
|
const Util_1 = requireUtil();
|
|
6215
6235
|
const Node_1 = requireNode();
|
|
@@ -6256,7 +6276,7 @@
|
|
|
6256
6276
|
if (hasRequiredArc) return Arc;
|
|
6257
6277
|
hasRequiredArc = 1;
|
|
6258
6278
|
Object.defineProperty(Arc, "__esModule", { value: true });
|
|
6259
|
-
Arc.Arc =
|
|
6279
|
+
Arc.Arc = void 0;
|
|
6260
6280
|
const Factory_1 = requireFactory();
|
|
6261
6281
|
const Shape_1 = requireShape();
|
|
6262
6282
|
const Global_1 = requireGlobal();
|
|
@@ -6307,7 +6327,12 @@
|
|
|
6307
6327
|
Arc.Arc = Arc$1;
|
|
6308
6328
|
Arc$1.prototype._centroid = true;
|
|
6309
6329
|
Arc$1.prototype.className = 'Arc';
|
|
6310
|
-
Arc$1.prototype._attrsAffectingSize = [
|
|
6330
|
+
Arc$1.prototype._attrsAffectingSize = [
|
|
6331
|
+
'innerRadius',
|
|
6332
|
+
'outerRadius',
|
|
6333
|
+
'angle',
|
|
6334
|
+
'clockwise',
|
|
6335
|
+
];
|
|
6311
6336
|
(0, Global_2._registerNode)(Arc$1);
|
|
6312
6337
|
Factory_1.Factory.addGetterSetter(Arc$1, 'innerRadius', 0, (0, Validators_1.getNumberValidator)());
|
|
6313
6338
|
Factory_1.Factory.addGetterSetter(Arc$1, 'outerRadius', 0, (0, Validators_1.getNumberValidator)());
|
|
@@ -6326,7 +6351,7 @@
|
|
|
6326
6351
|
if (hasRequiredLine) return Line;
|
|
6327
6352
|
hasRequiredLine = 1;
|
|
6328
6353
|
Object.defineProperty(Line, "__esModule", { value: true });
|
|
6329
|
-
Line.Line =
|
|
6354
|
+
Line.Line = void 0;
|
|
6330
6355
|
const Factory_1 = requireFactory();
|
|
6331
6356
|
const Global_1 = requireGlobal();
|
|
6332
6357
|
const Shape_1 = requireShape();
|
|
@@ -6359,15 +6384,16 @@
|
|
|
6359
6384
|
});
|
|
6360
6385
|
}
|
|
6361
6386
|
_sceneFunc(context) {
|
|
6362
|
-
|
|
6387
|
+
const points = this.points(), length = points.length, tension = this.tension(), closed = this.closed(), bezier = this.bezier();
|
|
6363
6388
|
if (!length) {
|
|
6364
6389
|
return;
|
|
6365
6390
|
}
|
|
6391
|
+
let n = 0;
|
|
6366
6392
|
context.beginPath();
|
|
6367
6393
|
context.moveTo(points[0], points[1]);
|
|
6368
6394
|
if (tension !== 0 && length > 4) {
|
|
6369
|
-
tp = this.getTensionPoints();
|
|
6370
|
-
len = tp.length;
|
|
6395
|
+
const tp = this.getTensionPoints();
|
|
6396
|
+
const len = tp.length;
|
|
6371
6397
|
n = closed ? 0 : 4;
|
|
6372
6398
|
if (!closed) {
|
|
6373
6399
|
context.quadraticCurveTo(tp[0], tp[1], tp[2], tp[3]);
|
|
@@ -6497,7 +6523,7 @@
|
|
|
6497
6523
|
hasRequiredBezierFunctions = 1;
|
|
6498
6524
|
(function (exports) {
|
|
6499
6525
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6500
|
-
exports.t2length = exports.getQuadraticArcLength = exports.getCubicArcLength = exports.binomialCoefficients = exports.cValues = exports.tValues =
|
|
6526
|
+
exports.t2length = exports.getQuadraticArcLength = exports.getCubicArcLength = exports.binomialCoefficients = exports.cValues = exports.tValues = void 0;
|
|
6501
6527
|
exports.tValues = [
|
|
6502
6528
|
[],
|
|
6503
6529
|
[],
|
|
@@ -7295,10 +7321,10 @@
|
|
|
7295
7321
|
if (hasRequiredPath) return Path;
|
|
7296
7322
|
hasRequiredPath = 1;
|
|
7297
7323
|
Object.defineProperty(Path, "__esModule", { value: true });
|
|
7298
|
-
Path.Path =
|
|
7324
|
+
Path.Path = void 0;
|
|
7299
7325
|
const Factory_1 = requireFactory();
|
|
7300
|
-
const Shape_1 = requireShape();
|
|
7301
7326
|
const Global_1 = requireGlobal();
|
|
7327
|
+
const Shape_1 = requireShape();
|
|
7302
7328
|
const BezierFunctions_1 = requireBezierFunctions();
|
|
7303
7329
|
let Path$1 = class Path extends Shape_1.Shape {
|
|
7304
7330
|
constructor(config) {
|
|
@@ -7335,10 +7361,10 @@
|
|
|
7335
7361
|
context.quadraticCurveTo(p[0], p[1], p[2], p[3]);
|
|
7336
7362
|
break;
|
|
7337
7363
|
case 'A':
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7364
|
+
const cx = p[0], cy = p[1], rx = p[2], ry = p[3], theta = p[4], dTheta = p[5], psi = p[6], fs = p[7];
|
|
7365
|
+
const r = rx > ry ? rx : ry;
|
|
7366
|
+
const scaleX = rx > ry ? 1 : rx / ry;
|
|
7367
|
+
const scaleY = rx > ry ? ry / rx : 1;
|
|
7342
7368
|
context.translate(cx, cy);
|
|
7343
7369
|
context.rotate(psi);
|
|
7344
7370
|
context.scale(scaleX, scaleY);
|
|
@@ -7451,11 +7477,20 @@
|
|
|
7451
7477
|
};
|
|
7452
7478
|
}
|
|
7453
7479
|
if (length < 0.01) {
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7480
|
+
const cmd = dataArray[i].command;
|
|
7481
|
+
if (cmd === 'M') {
|
|
7482
|
+
points = dataArray[i].points.slice(0, 2);
|
|
7483
|
+
return {
|
|
7484
|
+
x: points[0],
|
|
7485
|
+
y: points[1],
|
|
7486
|
+
};
|
|
7487
|
+
}
|
|
7488
|
+
else {
|
|
7489
|
+
return {
|
|
7490
|
+
x: dataArray[i].start.x,
|
|
7491
|
+
y: dataArray[i].start.y,
|
|
7492
|
+
};
|
|
7493
|
+
}
|
|
7459
7494
|
}
|
|
7460
7495
|
const cp = dataArray[i];
|
|
7461
7496
|
const p = cp.points;
|
|
@@ -7471,15 +7506,16 @@
|
|
|
7471
7506
|
return (0, BezierFunctions_1.getQuadraticArcLength)([cp.start.x, p[0], p[2]], [cp.start.y, p[1], p[3]], i);
|
|
7472
7507
|
}), cp.start.x, cp.start.y, p[0], p[1], p[2], p[3]);
|
|
7473
7508
|
case 'A':
|
|
7474
|
-
|
|
7509
|
+
const cx = p[0], cy = p[1], rx = p[2], ry = p[3], dTheta = p[5], psi = p[6];
|
|
7510
|
+
let theta = p[4];
|
|
7475
7511
|
theta += (dTheta * length) / cp.pathLength;
|
|
7476
7512
|
return Path.getPointOnEllipticalArc(cx, cy, rx, ry, theta, psi);
|
|
7477
7513
|
}
|
|
7478
7514
|
return null;
|
|
7479
7515
|
}
|
|
7480
7516
|
static getPointOnLine(dist, P1x, P1y, P2x, P2y, fromX, fromY) {
|
|
7481
|
-
fromX = fromX !== null && fromX !==
|
|
7482
|
-
fromY = fromY !== null && fromY !==
|
|
7517
|
+
fromX = fromX !== null && fromX !== void 0 ? fromX : P1x;
|
|
7518
|
+
fromY = fromY !== null && fromY !== void 0 ? fromY : P1y;
|
|
7483
7519
|
const len = this.getLineLength(P1x, P1y, P2x, P2y);
|
|
7484
7520
|
if (len < 1e-10) {
|
|
7485
7521
|
return { x: P1x, y: P1y };
|
|
@@ -7517,10 +7553,7 @@
|
|
|
7517
7553
|
}
|
|
7518
7554
|
const x = P4x * CB1(pct) + P3x * CB2(pct) + P2x * CB3(pct) + P1x * CB4(pct);
|
|
7519
7555
|
const y = P4y * CB1(pct) + P3y * CB2(pct) + P2y * CB3(pct) + P1y * CB4(pct);
|
|
7520
|
-
return {
|
|
7521
|
-
x: x,
|
|
7522
|
-
y: y,
|
|
7523
|
-
};
|
|
7556
|
+
return { x, y };
|
|
7524
7557
|
}
|
|
7525
7558
|
static getPointOnQuadraticBezier(pct, P1x, P1y, P2x, P2y, P3x, P3y) {
|
|
7526
7559
|
function QB1(t) {
|
|
@@ -7534,10 +7567,7 @@
|
|
|
7534
7567
|
}
|
|
7535
7568
|
const x = P3x * QB1(pct) + P2x * QB2(pct) + P1x * QB3(pct);
|
|
7536
7569
|
const y = P3y * QB1(pct) + P2y * QB2(pct) + P1y * QB3(pct);
|
|
7537
|
-
return {
|
|
7538
|
-
x: x,
|
|
7539
|
-
y: y,
|
|
7540
|
-
};
|
|
7570
|
+
return { x, y };
|
|
7541
7571
|
}
|
|
7542
7572
|
static getPointOnEllipticalArc(cx, cy, rx, ry, theta, psi) {
|
|
7543
7573
|
const cosPsi = Math.cos(psi), sinPsi = Math.sin(psi);
|
|
@@ -7578,7 +7608,7 @@
|
|
|
7578
7608
|
'A',
|
|
7579
7609
|
];
|
|
7580
7610
|
cs = cs.replace(new RegExp(' ', 'g'), ',');
|
|
7581
|
-
for (
|
|
7611
|
+
for (let n = 0; n < cc.length; n++) {
|
|
7582
7612
|
cs = cs.replace(new RegExp(cc[n], 'g'), '|' + cc[n]);
|
|
7583
7613
|
}
|
|
7584
7614
|
const arr = cs.split('|');
|
|
@@ -7588,7 +7618,7 @@
|
|
|
7588
7618
|
let cpy = 0;
|
|
7589
7619
|
const re = /([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;
|
|
7590
7620
|
let match;
|
|
7591
|
-
for (n = 1; n < arr.length; n++) {
|
|
7621
|
+
for (let n = 1; n < arr.length; n++) {
|
|
7592
7622
|
let str = arr[n];
|
|
7593
7623
|
let c = str.charAt(0);
|
|
7594
7624
|
str = str.slice(1);
|
|
@@ -7617,8 +7647,8 @@
|
|
|
7617
7647
|
let cmd = '';
|
|
7618
7648
|
let points = [];
|
|
7619
7649
|
const startX = cpx, startY = cpy;
|
|
7620
|
-
|
|
7621
|
-
|
|
7650
|
+
let prevCmd, ctlPtx, ctlPty;
|
|
7651
|
+
let rx, ry, psi, fa, fs, x1, y1;
|
|
7622
7652
|
switch (c) {
|
|
7623
7653
|
case 'l':
|
|
7624
7654
|
cpx += p.shift();
|
|
@@ -7632,8 +7662,8 @@
|
|
|
7632
7662
|
points.push(cpx, cpy);
|
|
7633
7663
|
break;
|
|
7634
7664
|
case 'm':
|
|
7635
|
-
|
|
7636
|
-
|
|
7665
|
+
const dx = p.shift();
|
|
7666
|
+
const dy = p.shift();
|
|
7637
7667
|
cpx += dx;
|
|
7638
7668
|
cpy += dy;
|
|
7639
7669
|
cmd = 'M';
|
|
@@ -7816,10 +7846,10 @@
|
|
|
7816
7846
|
return (0, BezierFunctions_1.getQuadraticArcLength)([x, points[0], points[2]], [y, points[1], points[3]], 1);
|
|
7817
7847
|
case 'A':
|
|
7818
7848
|
len = 0.0;
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7849
|
+
const start = points[4];
|
|
7850
|
+
const dTheta = points[5];
|
|
7851
|
+
const end = points[4] + dTheta;
|
|
7852
|
+
let inc = Math.PI / 180.0;
|
|
7823
7853
|
if (Math.abs(start - end) < inc) {
|
|
7824
7854
|
inc = Math.abs(start - end);
|
|
7825
7855
|
}
|
|
@@ -7908,7 +7938,7 @@
|
|
|
7908
7938
|
if (hasRequiredArrow) return Arrow;
|
|
7909
7939
|
hasRequiredArrow = 1;
|
|
7910
7940
|
Object.defineProperty(Arrow, "__esModule", { value: true });
|
|
7911
|
-
Arrow.Arrow =
|
|
7941
|
+
Arrow.Arrow = void 0;
|
|
7912
7942
|
const Factory_1 = requireFactory();
|
|
7913
7943
|
const Line_1 = requireLine();
|
|
7914
7944
|
const Validators_1 = requireValidators();
|
|
@@ -8020,7 +8050,7 @@
|
|
|
8020
8050
|
if (hasRequiredCircle) return Circle;
|
|
8021
8051
|
hasRequiredCircle = 1;
|
|
8022
8052
|
Object.defineProperty(Circle, "__esModule", { value: true });
|
|
8023
|
-
Circle.Circle =
|
|
8053
|
+
Circle.Circle = void 0;
|
|
8024
8054
|
const Factory_1 = requireFactory();
|
|
8025
8055
|
const Shape_1 = requireShape();
|
|
8026
8056
|
const Validators_1 = requireValidators();
|
|
@@ -8066,7 +8096,7 @@
|
|
|
8066
8096
|
if (hasRequiredEllipse) return Ellipse;
|
|
8067
8097
|
hasRequiredEllipse = 1;
|
|
8068
8098
|
Object.defineProperty(Ellipse, "__esModule", { value: true });
|
|
8069
|
-
Ellipse.Ellipse =
|
|
8099
|
+
Ellipse.Ellipse = void 0;
|
|
8070
8100
|
const Factory_1 = requireFactory();
|
|
8071
8101
|
const Shape_1 = requireShape();
|
|
8072
8102
|
const Validators_1 = requireValidators();
|
|
@@ -8116,7 +8146,7 @@
|
|
|
8116
8146
|
if (hasRequiredImage) return Image$1;
|
|
8117
8147
|
hasRequiredImage = 1;
|
|
8118
8148
|
Object.defineProperty(Image$1, "__esModule", { value: true });
|
|
8119
|
-
Image$1.Image =
|
|
8149
|
+
Image$1.Image = void 0;
|
|
8120
8150
|
const Util_1 = requireUtil();
|
|
8121
8151
|
const Factory_1 = requireFactory();
|
|
8122
8152
|
const Shape_1 = requireShape();
|
|
@@ -8125,7 +8155,11 @@
|
|
|
8125
8155
|
class Image extends Shape_1.Shape {
|
|
8126
8156
|
constructor(attrs) {
|
|
8127
8157
|
super(attrs);
|
|
8128
|
-
this.
|
|
8158
|
+
this._loadListener = () => {
|
|
8159
|
+
this._requestDraw();
|
|
8160
|
+
};
|
|
8161
|
+
this.on('imageChange.konva', (props) => {
|
|
8162
|
+
this._removeImageLoad(props.oldVal);
|
|
8129
8163
|
this._setImageLoad();
|
|
8130
8164
|
});
|
|
8131
8165
|
this._setImageLoad();
|
|
@@ -8139,11 +8173,19 @@
|
|
|
8139
8173
|
return;
|
|
8140
8174
|
}
|
|
8141
8175
|
if (image && image['addEventListener']) {
|
|
8142
|
-
image['addEventListener']('load',
|
|
8143
|
-
|
|
8144
|
-
|
|
8176
|
+
image['addEventListener']('load', this._loadListener);
|
|
8177
|
+
}
|
|
8178
|
+
}
|
|
8179
|
+
_removeImageLoad(image) {
|
|
8180
|
+
if (image && image['removeEventListener']) {
|
|
8181
|
+
image['removeEventListener']('load', this._loadListener);
|
|
8145
8182
|
}
|
|
8146
8183
|
}
|
|
8184
|
+
destroy() {
|
|
8185
|
+
this._removeImageLoad(this.image());
|
|
8186
|
+
super.destroy();
|
|
8187
|
+
return this;
|
|
8188
|
+
}
|
|
8147
8189
|
_useBufferCanvas() {
|
|
8148
8190
|
const hasCornerRadius = !!this.cornerRadius();
|
|
8149
8191
|
const hasShadow = this.hasShadow();
|
|
@@ -8207,11 +8249,11 @@
|
|
|
8207
8249
|
}
|
|
8208
8250
|
getWidth() {
|
|
8209
8251
|
var _a, _b;
|
|
8210
|
-
return (_a = this.attrs.width) !== null && _a !==
|
|
8252
|
+
return (_a = this.attrs.width) !== null && _a !== void 0 ? _a : (_b = this.image()) === null || _b === void 0 ? void 0 : _b.width;
|
|
8211
8253
|
}
|
|
8212
8254
|
getHeight() {
|
|
8213
8255
|
var _a, _b;
|
|
8214
|
-
return (_a = this.attrs.height) !== null && _a !==
|
|
8256
|
+
return (_a = this.attrs.height) !== null && _a !== void 0 ? _a : (_b = this.image()) === null || _b === void 0 ? void 0 : _b.height;
|
|
8215
8257
|
}
|
|
8216
8258
|
static fromURL(url, callback, onError = null) {
|
|
8217
8259
|
const img = Util_1.Util.createImageElement();
|
|
@@ -8247,7 +8289,7 @@
|
|
|
8247
8289
|
if (hasRequiredLabel) return Label;
|
|
8248
8290
|
hasRequiredLabel = 1;
|
|
8249
8291
|
Object.defineProperty(Label, "__esModule", { value: true });
|
|
8250
|
-
Label.Tag = Label.Label =
|
|
8292
|
+
Label.Tag = Label.Label = void 0;
|
|
8251
8293
|
const Factory_1 = requireFactory();
|
|
8252
8294
|
const Shape_1 = requireShape();
|
|
8253
8295
|
const Group_1 = requireGroup();
|
|
@@ -8434,7 +8476,7 @@
|
|
|
8434
8476
|
if (hasRequiredRect) return Rect;
|
|
8435
8477
|
hasRequiredRect = 1;
|
|
8436
8478
|
Object.defineProperty(Rect, "__esModule", { value: true });
|
|
8437
|
-
Rect.Rect =
|
|
8479
|
+
Rect.Rect = void 0;
|
|
8438
8480
|
const Factory_1 = requireFactory();
|
|
8439
8481
|
const Shape_1 = requireShape();
|
|
8440
8482
|
const Global_1 = requireGlobal();
|
|
@@ -8469,7 +8511,7 @@
|
|
|
8469
8511
|
if (hasRequiredRegularPolygon) return RegularPolygon;
|
|
8470
8512
|
hasRequiredRegularPolygon = 1;
|
|
8471
8513
|
Object.defineProperty(RegularPolygon, "__esModule", { value: true });
|
|
8472
|
-
RegularPolygon.RegularPolygon =
|
|
8514
|
+
RegularPolygon.RegularPolygon = void 0;
|
|
8473
8515
|
const Factory_1 = requireFactory();
|
|
8474
8516
|
const Shape_1 = requireShape();
|
|
8475
8517
|
const Validators_1 = requireValidators();
|
|
@@ -8547,7 +8589,7 @@
|
|
|
8547
8589
|
if (hasRequiredRing) return Ring;
|
|
8548
8590
|
hasRequiredRing = 1;
|
|
8549
8591
|
Object.defineProperty(Ring, "__esModule", { value: true });
|
|
8550
|
-
Ring.Ring =
|
|
8592
|
+
Ring.Ring = void 0;
|
|
8551
8593
|
const Factory_1 = requireFactory();
|
|
8552
8594
|
const Shape_1 = requireShape();
|
|
8553
8595
|
const Validators_1 = requireValidators();
|
|
@@ -8593,7 +8635,7 @@
|
|
|
8593
8635
|
if (hasRequiredSprite) return Sprite;
|
|
8594
8636
|
hasRequiredSprite = 1;
|
|
8595
8637
|
Object.defineProperty(Sprite, "__esModule", { value: true });
|
|
8596
|
-
Sprite.Sprite =
|
|
8638
|
+
Sprite.Sprite = void 0;
|
|
8597
8639
|
const Factory_1 = requireFactory();
|
|
8598
8640
|
const Shape_1 = requireShape();
|
|
8599
8641
|
const Animation_1 = requireAnimation();
|
|
@@ -8714,7 +8756,7 @@
|
|
|
8714
8756
|
if (hasRequiredStar) return Star;
|
|
8715
8757
|
hasRequiredStar = 1;
|
|
8716
8758
|
Object.defineProperty(Star, "__esModule", { value: true });
|
|
8717
|
-
Star.Star =
|
|
8759
|
+
Star.Star = void 0;
|
|
8718
8760
|
const Factory_1 = requireFactory();
|
|
8719
8761
|
const Shape_1 = requireShape();
|
|
8720
8762
|
const Validators_1 = requireValidators();
|
|
@@ -8765,7 +8807,7 @@
|
|
|
8765
8807
|
if (hasRequiredText) return Text;
|
|
8766
8808
|
hasRequiredText = 1;
|
|
8767
8809
|
Object.defineProperty(Text, "__esModule", { value: true });
|
|
8768
|
-
Text.Text =
|
|
8810
|
+
Text.Text = void 0;
|
|
8769
8811
|
Text.stringToArray = stringToArray;
|
|
8770
8812
|
const Util_1 = requireUtil();
|
|
8771
8813
|
const Factory_1 = requireFactory();
|
|
@@ -8878,8 +8920,6 @@
|
|
|
8878
8920
|
(metrics.fontBoundingBoxAscent - metrics.fontBoundingBoxDescent) / 2 +
|
|
8879
8921
|
lineHeightPx / 2;
|
|
8880
8922
|
}
|
|
8881
|
-
var lineTranslateX = 0;
|
|
8882
|
-
var lineTranslateY = 0;
|
|
8883
8923
|
if (direction === RTL) {
|
|
8884
8924
|
context.setAttr('direction', direction);
|
|
8885
8925
|
}
|
|
@@ -8894,9 +8934,9 @@
|
|
|
8894
8934
|
}
|
|
8895
8935
|
context.translate(padding, alignY + padding);
|
|
8896
8936
|
for (n = 0; n < textArrLen; n++) {
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8937
|
+
let lineTranslateX = 0;
|
|
8938
|
+
let lineTranslateY = 0;
|
|
8939
|
+
const obj = textArr[n], text = obj.text, width = obj.width, lastLine = obj.lastInParagraph;
|
|
8900
8940
|
context.save();
|
|
8901
8941
|
if (align === RIGHT) {
|
|
8902
8942
|
lineTranslateX += totalWidth - width - padding * 2;
|
|
@@ -8913,9 +8953,7 @@
|
|
|
8913
8953
|
const x = lineTranslateX;
|
|
8914
8954
|
const y = translateY + lineTranslateY + yOffset;
|
|
8915
8955
|
context.moveTo(x, y);
|
|
8916
|
-
|
|
8917
|
-
lineWidth =
|
|
8918
|
-
align === JUSTIFY && !lastLine ? totalWidth - padding * 2 : width;
|
|
8956
|
+
const lineWidth = align === JUSTIFY && !lastLine ? totalWidth - padding * 2 : width;
|
|
8919
8957
|
context.lineTo(x + Math.round(lineWidth), y);
|
|
8920
8958
|
context.lineWidth = fontSize / 15;
|
|
8921
8959
|
const gradient = this._getLinearGradient();
|
|
@@ -8928,9 +8966,7 @@
|
|
|
8928
8966
|
context.beginPath();
|
|
8929
8967
|
const yOffset = Global_1.Konva._fixTextRendering ? -Math.round(fontSize / 4) : 0;
|
|
8930
8968
|
context.moveTo(lineTranslateX, translateY + lineTranslateY + yOffset);
|
|
8931
|
-
|
|
8932
|
-
lineWidth =
|
|
8933
|
-
align === JUSTIFY && !lastLine ? totalWidth - padding * 2 : width;
|
|
8969
|
+
const lineWidth = align === JUSTIFY && !lastLine ? totalWidth - padding * 2 : width;
|
|
8934
8970
|
context.lineTo(lineTranslateX + Math.round(lineWidth), translateY + lineTranslateY + yOffset);
|
|
8935
8971
|
context.lineWidth = fontSize / 15;
|
|
8936
8972
|
const gradient = this._getLinearGradient();
|
|
@@ -8939,7 +8975,7 @@
|
|
|
8939
8975
|
context.restore();
|
|
8940
8976
|
}
|
|
8941
8977
|
if (direction !== RTL && (letterSpacing !== 0 || align === JUSTIFY)) {
|
|
8942
|
-
spacesNumber = text.split(' ').length - 1;
|
|
8978
|
+
const spacesNumber = text.split(' ').length - 1;
|
|
8943
8979
|
const array = stringToArray(text);
|
|
8944
8980
|
for (let li = 0; li < array.length; li++) {
|
|
8945
8981
|
const letter = array[li];
|
|
@@ -9011,17 +9047,17 @@
|
|
|
9011
9047
|
_context.restore();
|
|
9012
9048
|
const scaleFactor = fontSize / 100;
|
|
9013
9049
|
return {
|
|
9014
|
-
actualBoundingBoxAscent: (_a = metrics.actualBoundingBoxAscent) !== null && _a !==
|
|
9015
|
-
actualBoundingBoxDescent: (_b = metrics.actualBoundingBoxDescent) !== null && _b !==
|
|
9016
|
-
actualBoundingBoxLeft: (_c = metrics.actualBoundingBoxLeft) !== null && _c !==
|
|
9017
|
-
actualBoundingBoxRight: (_d = metrics.actualBoundingBoxRight) !== null && _d !==
|
|
9018
|
-
alphabeticBaseline: (_e = metrics.alphabeticBaseline) !== null && _e !==
|
|
9019
|
-
emHeightAscent: (_f = metrics.emHeightAscent) !== null && _f !==
|
|
9020
|
-
emHeightDescent: (_g = metrics.emHeightDescent) !== null && _g !==
|
|
9021
|
-
fontBoundingBoxAscent: (_h = metrics.fontBoundingBoxAscent) !== null && _h !==
|
|
9022
|
-
fontBoundingBoxDescent: (_j = metrics.fontBoundingBoxDescent) !== null && _j !==
|
|
9023
|
-
hangingBaseline: (_k = metrics.hangingBaseline) !== null && _k !==
|
|
9024
|
-
ideographicBaseline: (_l = metrics.ideographicBaseline) !== null && _l !==
|
|
9050
|
+
actualBoundingBoxAscent: (_a = metrics.actualBoundingBoxAscent) !== null && _a !== void 0 ? _a : 71.58203125 * scaleFactor,
|
|
9051
|
+
actualBoundingBoxDescent: (_b = metrics.actualBoundingBoxDescent) !== null && _b !== void 0 ? _b : 0,
|
|
9052
|
+
actualBoundingBoxLeft: (_c = metrics.actualBoundingBoxLeft) !== null && _c !== void 0 ? _c : -7.421875 * scaleFactor,
|
|
9053
|
+
actualBoundingBoxRight: (_d = metrics.actualBoundingBoxRight) !== null && _d !== void 0 ? _d : 75.732421875 * scaleFactor,
|
|
9054
|
+
alphabeticBaseline: (_e = metrics.alphabeticBaseline) !== null && _e !== void 0 ? _e : 0,
|
|
9055
|
+
emHeightAscent: (_f = metrics.emHeightAscent) !== null && _f !== void 0 ? _f : 100 * scaleFactor,
|
|
9056
|
+
emHeightDescent: (_g = metrics.emHeightDescent) !== null && _g !== void 0 ? _g : -20 * scaleFactor,
|
|
9057
|
+
fontBoundingBoxAscent: (_h = metrics.fontBoundingBoxAscent) !== null && _h !== void 0 ? _h : 91 * scaleFactor,
|
|
9058
|
+
fontBoundingBoxDescent: (_j = metrics.fontBoundingBoxDescent) !== null && _j !== void 0 ? _j : 21 * scaleFactor,
|
|
9059
|
+
hangingBaseline: (_k = metrics.hangingBaseline) !== null && _k !== void 0 ? _k : 72.80000305175781 * scaleFactor,
|
|
9060
|
+
ideographicBaseline: (_l = metrics.ideographicBaseline) !== null && _l !== void 0 ? _l : -21 * scaleFactor,
|
|
9025
9061
|
width: metrics.width,
|
|
9026
9062
|
height: fontSize,
|
|
9027
9063
|
};
|
|
@@ -9065,8 +9101,14 @@
|
|
|
9065
9101
|
while (line.length > 0) {
|
|
9066
9102
|
let low = 0, high = stringToArray(line).length, match = '', matchWidth = 0;
|
|
9067
9103
|
while (low < high) {
|
|
9068
|
-
const mid = (low + high) >>> 1, lineArray = stringToArray(line), substr = lineArray.slice(0, mid + 1).join(''), substrWidth = this._getTextWidth(substr)
|
|
9069
|
-
|
|
9104
|
+
const mid = (low + high) >>> 1, lineArray = stringToArray(line), substr = lineArray.slice(0, mid + 1).join(''), substrWidth = this._getTextWidth(substr);
|
|
9105
|
+
const shouldConsiderEllipsis = shouldAddEllipsis &&
|
|
9106
|
+
fixedHeight &&
|
|
9107
|
+
currentHeightPx + lineHeightPx > maxHeightPx;
|
|
9108
|
+
const effectiveWidth = shouldConsiderEllipsis
|
|
9109
|
+
? substrWidth + additionalWidth
|
|
9110
|
+
: substrWidth;
|
|
9111
|
+
if (effectiveWidth <= maxWidth) {
|
|
9070
9112
|
low = mid + 1;
|
|
9071
9113
|
match = substr;
|
|
9072
9114
|
matchWidth = substrWidth;
|
|
@@ -9213,7 +9255,7 @@
|
|
|
9213
9255
|
if (hasRequiredTextPath) return TextPath;
|
|
9214
9256
|
hasRequiredTextPath = 1;
|
|
9215
9257
|
Object.defineProperty(TextPath, "__esModule", { value: true });
|
|
9216
|
-
TextPath.TextPath =
|
|
9258
|
+
TextPath.TextPath = void 0;
|
|
9217
9259
|
const Util_1 = requireUtil();
|
|
9218
9260
|
const Factory_1 = requireFactory();
|
|
9219
9261
|
const Shape_1 = requireShape();
|
|
@@ -9463,7 +9505,7 @@
|
|
|
9463
9505
|
if (hasRequiredTransformer) return Transformer;
|
|
9464
9506
|
hasRequiredTransformer = 1;
|
|
9465
9507
|
Object.defineProperty(Transformer, "__esModule", { value: true });
|
|
9466
|
-
Transformer.Transformer =
|
|
9508
|
+
Transformer.Transformer = void 0;
|
|
9467
9509
|
const Util_1 = requireUtil();
|
|
9468
9510
|
const Factory_1 = requireFactory();
|
|
9469
9511
|
const Node_1 = requireNode();
|
|
@@ -9660,10 +9702,12 @@
|
|
|
9660
9702
|
this.update();
|
|
9661
9703
|
}
|
|
9662
9704
|
};
|
|
9663
|
-
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
|
|
9705
|
+
if (node._attrsAffectingSize.length) {
|
|
9706
|
+
const additionalEvents = node._attrsAffectingSize
|
|
9707
|
+
.map((prop) => prop + 'Change.' + this._getEventNamespace())
|
|
9708
|
+
.join(' ');
|
|
9709
|
+
node.on(additionalEvents, onChange);
|
|
9710
|
+
}
|
|
9667
9711
|
node.on(TRANSFORM_CHANGE_STR.map((e) => e + `.${this._getEventNamespace()}`).join(' '), onChange);
|
|
9668
9712
|
node.on(`absoluteTransformChange.${this._getEventNamespace()}`, onChange);
|
|
9669
9713
|
this._proxyDrag(node);
|
|
@@ -9982,10 +10026,10 @@
|
|
|
9982
10026
|
else {
|
|
9983
10027
|
keepProportion = this.keepRatio() || e.shiftKey;
|
|
9984
10028
|
}
|
|
9985
|
-
|
|
10029
|
+
let centeredScaling = this.centeredScaling() || e.altKey;
|
|
9986
10030
|
if (this._movingAnchorName === 'top-left') {
|
|
9987
10031
|
if (keepProportion) {
|
|
9988
|
-
|
|
10032
|
+
const comparePoint = centeredScaling
|
|
9989
10033
|
? {
|
|
9990
10034
|
x: this.width() / 2,
|
|
9991
10035
|
y: this.height() / 2,
|
|
@@ -9996,8 +10040,8 @@
|
|
|
9996
10040
|
};
|
|
9997
10041
|
newHypotenuse = Math.sqrt(Math.pow(comparePoint.x - anchorNode.x(), 2) +
|
|
9998
10042
|
Math.pow(comparePoint.y - anchorNode.y(), 2));
|
|
9999
|
-
|
|
10000
|
-
|
|
10043
|
+
const reverseX = this.findOne('.top-left').x() > comparePoint.x ? -1 : 1;
|
|
10044
|
+
const reverseY = this.findOne('.top-left').y() > comparePoint.y ? -1 : 1;
|
|
10001
10045
|
x = newHypotenuse * this.cos * reverseX;
|
|
10002
10046
|
y = newHypotenuse * this.sin * reverseY;
|
|
10003
10047
|
this.findOne('.top-left').x(comparePoint.x - x);
|
|
@@ -10009,7 +10053,7 @@
|
|
|
10009
10053
|
}
|
|
10010
10054
|
else if (this._movingAnchorName === 'top-right') {
|
|
10011
10055
|
if (keepProportion) {
|
|
10012
|
-
|
|
10056
|
+
const comparePoint = centeredScaling
|
|
10013
10057
|
? {
|
|
10014
10058
|
x: this.width() / 2,
|
|
10015
10059
|
y: this.height() / 2,
|
|
@@ -10020,8 +10064,8 @@
|
|
|
10020
10064
|
};
|
|
10021
10065
|
newHypotenuse = Math.sqrt(Math.pow(anchorNode.x() - comparePoint.x, 2) +
|
|
10022
10066
|
Math.pow(comparePoint.y - anchorNode.y(), 2));
|
|
10023
|
-
|
|
10024
|
-
|
|
10067
|
+
const reverseX = this.findOne('.top-right').x() < comparePoint.x ? -1 : 1;
|
|
10068
|
+
const reverseY = this.findOne('.top-right').y() > comparePoint.y ? -1 : 1;
|
|
10025
10069
|
x = newHypotenuse * this.cos * reverseX;
|
|
10026
10070
|
y = newHypotenuse * this.sin * reverseY;
|
|
10027
10071
|
this.findOne('.top-right').x(comparePoint.x + x);
|
|
@@ -10039,7 +10083,7 @@
|
|
|
10039
10083
|
}
|
|
10040
10084
|
else if (this._movingAnchorName === 'bottom-left') {
|
|
10041
10085
|
if (keepProportion) {
|
|
10042
|
-
|
|
10086
|
+
const comparePoint = centeredScaling
|
|
10043
10087
|
? {
|
|
10044
10088
|
x: this.width() / 2,
|
|
10045
10089
|
y: this.height() / 2,
|
|
@@ -10050,8 +10094,8 @@
|
|
|
10050
10094
|
};
|
|
10051
10095
|
newHypotenuse = Math.sqrt(Math.pow(comparePoint.x - anchorNode.x(), 2) +
|
|
10052
10096
|
Math.pow(anchorNode.y() - comparePoint.y, 2));
|
|
10053
|
-
|
|
10054
|
-
|
|
10097
|
+
const reverseX = comparePoint.x < anchorNode.x() ? -1 : 1;
|
|
10098
|
+
const reverseY = anchorNode.y() < comparePoint.y ? -1 : 1;
|
|
10055
10099
|
x = newHypotenuse * this.cos * reverseX;
|
|
10056
10100
|
y = newHypotenuse * this.sin * reverseY;
|
|
10057
10101
|
anchorNode.x(comparePoint.x - x);
|
|
@@ -10066,7 +10110,7 @@
|
|
|
10066
10110
|
}
|
|
10067
10111
|
else if (this._movingAnchorName === 'bottom-right') {
|
|
10068
10112
|
if (keepProportion) {
|
|
10069
|
-
|
|
10113
|
+
const comparePoint = centeredScaling
|
|
10070
10114
|
? {
|
|
10071
10115
|
x: this.width() / 2,
|
|
10072
10116
|
y: this.height() / 2,
|
|
@@ -10077,8 +10121,8 @@
|
|
|
10077
10121
|
};
|
|
10078
10122
|
newHypotenuse = Math.sqrt(Math.pow(anchorNode.x() - comparePoint.x, 2) +
|
|
10079
10123
|
Math.pow(anchorNode.y() - comparePoint.y, 2));
|
|
10080
|
-
|
|
10081
|
-
|
|
10124
|
+
const reverseX = this.findOne('.bottom-right').x() < comparePoint.x ? -1 : 1;
|
|
10125
|
+
const reverseY = this.findOne('.bottom-right').y() < comparePoint.y ? -1 : 1;
|
|
10082
10126
|
x = newHypotenuse * this.cos * reverseX;
|
|
10083
10127
|
y = newHypotenuse * this.sin * reverseY;
|
|
10084
10128
|
this.findOne('.bottom-right').x(comparePoint.x + x);
|
|
@@ -10089,7 +10133,7 @@
|
|
|
10089
10133
|
console.error(new Error('Wrong position argument of selection resizer: ' +
|
|
10090
10134
|
this._movingAnchorName));
|
|
10091
10135
|
}
|
|
10092
|
-
|
|
10136
|
+
centeredScaling = this.centeredScaling() || e.altKey;
|
|
10093
10137
|
if (centeredScaling) {
|
|
10094
10138
|
const topLeft = this.findOne('.top-left');
|
|
10095
10139
|
const bottomRight = this.findOne('.bottom-right');
|
|
@@ -10138,12 +10182,12 @@
|
|
|
10138
10182
|
const node = this.getNode();
|
|
10139
10183
|
activeTransformersCount--;
|
|
10140
10184
|
this._fire('transformend', { evt: e, target: node });
|
|
10141
|
-
(_a = this.getLayer()) === null || _a ===
|
|
10185
|
+
(_a = this.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw();
|
|
10142
10186
|
if (node) {
|
|
10143
10187
|
this._nodes.forEach((target) => {
|
|
10144
10188
|
var _a;
|
|
10145
10189
|
target._fire('transformend', { evt: e, target });
|
|
10146
|
-
(_a = target.getLayer()) === null || _a ===
|
|
10190
|
+
(_a = target.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw();
|
|
10147
10191
|
});
|
|
10148
10192
|
}
|
|
10149
10193
|
this._movingAnchorName = null;
|
|
@@ -10256,7 +10300,7 @@
|
|
|
10256
10300
|
.multiply(localTransform);
|
|
10257
10301
|
const attrs = newLocalTransform.decompose();
|
|
10258
10302
|
node.setAttrs(attrs);
|
|
10259
|
-
(_a = node.getLayer()) === null || _a ===
|
|
10303
|
+
(_a = node.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw();
|
|
10260
10304
|
});
|
|
10261
10305
|
this.rotation(Util_1.Util._getRotation(newAttrs.rotation));
|
|
10262
10306
|
this._nodes.forEach((node) => {
|
|
@@ -10371,7 +10415,7 @@
|
|
|
10371
10415
|
styleFunc(node);
|
|
10372
10416
|
});
|
|
10373
10417
|
}
|
|
10374
|
-
(_a = this.getLayer()) === null || _a ===
|
|
10418
|
+
(_a = this.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw();
|
|
10375
10419
|
}
|
|
10376
10420
|
isTransforming() {
|
|
10377
10421
|
return this._transforming;
|
|
@@ -10478,7 +10522,7 @@
|
|
|
10478
10522
|
if (hasRequiredWedge) return Wedge;
|
|
10479
10523
|
hasRequiredWedge = 1;
|
|
10480
10524
|
Object.defineProperty(Wedge, "__esModule", { value: true });
|
|
10481
|
-
Wedge.Wedge =
|
|
10525
|
+
Wedge.Wedge = void 0;
|
|
10482
10526
|
const Factory_1 = requireFactory();
|
|
10483
10527
|
const Shape_1 = requireShape();
|
|
10484
10528
|
const Global_1 = requireGlobal();
|
|
@@ -10529,7 +10573,7 @@
|
|
|
10529
10573
|
if (hasRequiredBlur) return Blur;
|
|
10530
10574
|
hasRequiredBlur = 1;
|
|
10531
10575
|
Object.defineProperty(Blur, "__esModule", { value: true });
|
|
10532
|
-
Blur.Blur =
|
|
10576
|
+
Blur.Blur = void 0;
|
|
10533
10577
|
const Factory_1 = requireFactory();
|
|
10534
10578
|
const Node_1 = requireNode();
|
|
10535
10579
|
const Validators_1 = requireValidators();
|
|
@@ -10577,10 +10621,10 @@
|
|
|
10577
10621
|
];
|
|
10578
10622
|
function filterGaussBlurRGBA(imageData, radius) {
|
|
10579
10623
|
const pixels = imageData.data, width = imageData.width, height = imageData.height;
|
|
10580
|
-
let
|
|
10624
|
+
let p, yi, yw, r_sum, g_sum, b_sum, a_sum, r_out_sum, g_out_sum, b_out_sum, a_out_sum, r_in_sum, g_in_sum, b_in_sum, a_in_sum, pr, pg, pb, pa, rbs;
|
|
10581
10625
|
const div = radius + radius + 1, widthMinus1 = width - 1, heightMinus1 = height - 1, radiusPlus1 = radius + 1, sumFactor = (radiusPlus1 * (radiusPlus1 + 1)) / 2, stackStart = new BlurStack(), mul_sum = mul_table[radius], shg_sum = shg_table[radius];
|
|
10582
10626
|
let stackEnd = null, stack = stackStart, stackIn = null, stackOut = null;
|
|
10583
|
-
for (i = 1; i < div; i++) {
|
|
10627
|
+
for (let i = 1; i < div; i++) {
|
|
10584
10628
|
stack = stack.next = new BlurStack();
|
|
10585
10629
|
if (i === radiusPlus1) {
|
|
10586
10630
|
stackEnd = stack;
|
|
@@ -10588,7 +10632,7 @@
|
|
|
10588
10632
|
}
|
|
10589
10633
|
stack.next = stackStart;
|
|
10590
10634
|
yw = yi = 0;
|
|
10591
|
-
for (y = 0; y < height; y++) {
|
|
10635
|
+
for (let y = 0; y < height; y++) {
|
|
10592
10636
|
r_in_sum =
|
|
10593
10637
|
g_in_sum =
|
|
10594
10638
|
b_in_sum =
|
|
@@ -10607,14 +10651,14 @@
|
|
|
10607
10651
|
b_sum += sumFactor * pb;
|
|
10608
10652
|
a_sum += sumFactor * pa;
|
|
10609
10653
|
stack = stackStart;
|
|
10610
|
-
for (i = 0; i < radiusPlus1; i++) {
|
|
10654
|
+
for (let i = 0; i < radiusPlus1; i++) {
|
|
10611
10655
|
stack.r = pr;
|
|
10612
10656
|
stack.g = pg;
|
|
10613
10657
|
stack.b = pb;
|
|
10614
10658
|
stack.a = pa;
|
|
10615
10659
|
stack = stack.next;
|
|
10616
10660
|
}
|
|
10617
|
-
for (i = 1; i < radiusPlus1; i++) {
|
|
10661
|
+
for (let i = 1; i < radiusPlus1; i++) {
|
|
10618
10662
|
p = yi + ((widthMinus1 < i ? widthMinus1 : i) << 2);
|
|
10619
10663
|
r_sum += (stack.r = pr = pixels[p]) * (rbs = radiusPlus1 - i);
|
|
10620
10664
|
g_sum += (stack.g = pg = pixels[p + 1]) * rbs;
|
|
@@ -10628,7 +10672,7 @@
|
|
|
10628
10672
|
}
|
|
10629
10673
|
stackIn = stackStart;
|
|
10630
10674
|
stackOut = stackEnd;
|
|
10631
|
-
for (x = 0; x < width; x++) {
|
|
10675
|
+
for (let x = 0; x < width; x++) {
|
|
10632
10676
|
pixels[yi + 3] = pa = (a_sum * mul_sum) >> shg_sum;
|
|
10633
10677
|
if (pa !== 0) {
|
|
10634
10678
|
pa = 255 / pa;
|
|
@@ -10670,7 +10714,7 @@
|
|
|
10670
10714
|
}
|
|
10671
10715
|
yw += width;
|
|
10672
10716
|
}
|
|
10673
|
-
for (x = 0; x < width; x++) {
|
|
10717
|
+
for (let x = 0; x < width; x++) {
|
|
10674
10718
|
g_in_sum =
|
|
10675
10719
|
b_in_sum =
|
|
10676
10720
|
a_in_sum =
|
|
@@ -10690,15 +10734,15 @@
|
|
|
10690
10734
|
b_sum += sumFactor * pb;
|
|
10691
10735
|
a_sum += sumFactor * pa;
|
|
10692
10736
|
stack = stackStart;
|
|
10693
|
-
for (i = 0; i < radiusPlus1; i++) {
|
|
10737
|
+
for (let i = 0; i < radiusPlus1; i++) {
|
|
10694
10738
|
stack.r = pr;
|
|
10695
10739
|
stack.g = pg;
|
|
10696
10740
|
stack.b = pb;
|
|
10697
10741
|
stack.a = pa;
|
|
10698
10742
|
stack = stack.next;
|
|
10699
10743
|
}
|
|
10700
|
-
yp = width;
|
|
10701
|
-
for (i = 1; i <= radius; i++) {
|
|
10744
|
+
let yp = width;
|
|
10745
|
+
for (let i = 1; i <= radius; i++) {
|
|
10702
10746
|
yi = (yp + x) << 2;
|
|
10703
10747
|
r_sum += (stack.r = pr = pixels[yi]) * (rbs = radiusPlus1 - i);
|
|
10704
10748
|
g_sum += (stack.g = pg = pixels[yi + 1]) * rbs;
|
|
@@ -10716,7 +10760,7 @@
|
|
|
10716
10760
|
yi = x;
|
|
10717
10761
|
stackIn = stackStart;
|
|
10718
10762
|
stackOut = stackEnd;
|
|
10719
|
-
for (y = 0; y < height; y++) {
|
|
10763
|
+
for (let y = 0; y < height; y++) {
|
|
10720
10764
|
p = yi << 2;
|
|
10721
10765
|
pixels[p + 3] = pa = (a_sum * mul_sum) >> shg_sum;
|
|
10722
10766
|
if (pa > 0) {
|
|
@@ -10777,7 +10821,7 @@
|
|
|
10777
10821
|
if (hasRequiredBrighten) return Brighten;
|
|
10778
10822
|
hasRequiredBrighten = 1;
|
|
10779
10823
|
Object.defineProperty(Brighten, "__esModule", { value: true });
|
|
10780
|
-
Brighten.Brighten =
|
|
10824
|
+
Brighten.Brighten = void 0;
|
|
10781
10825
|
const Factory_1 = requireFactory();
|
|
10782
10826
|
const Node_1 = requireNode();
|
|
10783
10827
|
const Validators_1 = requireValidators();
|
|
@@ -10802,7 +10846,7 @@
|
|
|
10802
10846
|
if (hasRequiredContrast) return Contrast;
|
|
10803
10847
|
hasRequiredContrast = 1;
|
|
10804
10848
|
Object.defineProperty(Contrast, "__esModule", { value: true });
|
|
10805
|
-
Contrast.Contrast =
|
|
10849
|
+
Contrast.Contrast = void 0;
|
|
10806
10850
|
const Factory_1 = requireFactory();
|
|
10807
10851
|
const Node_1 = requireNode();
|
|
10808
10852
|
const Validators_1 = requireValidators();
|
|
@@ -10850,7 +10894,7 @@
|
|
|
10850
10894
|
if (hasRequiredEmboss) return Emboss;
|
|
10851
10895
|
hasRequiredEmboss = 1;
|
|
10852
10896
|
Object.defineProperty(Emboss, "__esModule", { value: true });
|
|
10853
|
-
Emboss.Emboss =
|
|
10897
|
+
Emboss.Emboss = void 0;
|
|
10854
10898
|
const Factory_1 = requireFactory();
|
|
10855
10899
|
const Node_1 = requireNode();
|
|
10856
10900
|
const Util_1 = requireUtil();
|
|
@@ -10966,7 +11010,7 @@
|
|
|
10966
11010
|
if (hasRequiredEnhance) return Enhance;
|
|
10967
11011
|
hasRequiredEnhance = 1;
|
|
10968
11012
|
Object.defineProperty(Enhance, "__esModule", { value: true });
|
|
10969
|
-
Enhance.Enhance =
|
|
11013
|
+
Enhance.Enhance = void 0;
|
|
10970
11014
|
const Factory_1 = requireFactory();
|
|
10971
11015
|
const Node_1 = requireNode();
|
|
10972
11016
|
const Validators_1 = requireValidators();
|
|
@@ -11024,7 +11068,7 @@
|
|
|
11024
11068
|
bMax = 255;
|
|
11025
11069
|
bMin = 0;
|
|
11026
11070
|
}
|
|
11027
|
-
let
|
|
11071
|
+
let rGoalMax, rGoalMin, gGoalMax, gGoalMin, bGoalMax, bGoalMin;
|
|
11028
11072
|
if (enhanceAmount > 0) {
|
|
11029
11073
|
rGoalMax = rMax + enhanceAmount * (255 - rMax);
|
|
11030
11074
|
rGoalMin = rMin - enhanceAmount * (rMin - 0);
|
|
@@ -11034,13 +11078,13 @@
|
|
|
11034
11078
|
bGoalMin = bMin - enhanceAmount * (bMin - 0);
|
|
11035
11079
|
}
|
|
11036
11080
|
else {
|
|
11037
|
-
rMid = (rMax + rMin) * 0.5;
|
|
11081
|
+
const rMid = (rMax + rMin) * 0.5;
|
|
11038
11082
|
rGoalMax = rMax + enhanceAmount * (rMax - rMid);
|
|
11039
11083
|
rGoalMin = rMin + enhanceAmount * (rMin - rMid);
|
|
11040
|
-
gMid = (gMax + gMin) * 0.5;
|
|
11084
|
+
const gMid = (gMax + gMin) * 0.5;
|
|
11041
11085
|
gGoalMax = gMax + enhanceAmount * (gMax - gMid);
|
|
11042
11086
|
gGoalMin = gMin + enhanceAmount * (gMin - gMid);
|
|
11043
|
-
bMid = (bMax + bMin) * 0.5;
|
|
11087
|
+
const bMid = (bMax + bMin) * 0.5;
|
|
11044
11088
|
bGoalMax = bMax + enhanceAmount * (bMax - bMid);
|
|
11045
11089
|
bGoalMin = bMin + enhanceAmount * (bMin - bMid);
|
|
11046
11090
|
}
|
|
@@ -11063,7 +11107,7 @@
|
|
|
11063
11107
|
if (hasRequiredGrayscale) return Grayscale;
|
|
11064
11108
|
hasRequiredGrayscale = 1;
|
|
11065
11109
|
Object.defineProperty(Grayscale, "__esModule", { value: true });
|
|
11066
|
-
Grayscale.Grayscale =
|
|
11110
|
+
Grayscale.Grayscale = void 0;
|
|
11067
11111
|
const Grayscale$1 = function (imageData) {
|
|
11068
11112
|
const data = imageData.data, len = data.length;
|
|
11069
11113
|
for (let i = 0; i < len; i += 4) {
|
|
@@ -11085,7 +11129,7 @@
|
|
|
11085
11129
|
if (hasRequiredHSL) return HSL;
|
|
11086
11130
|
hasRequiredHSL = 1;
|
|
11087
11131
|
Object.defineProperty(HSL, "__esModule", { value: true });
|
|
11088
|
-
HSL.HSL =
|
|
11132
|
+
HSL.HSL = void 0;
|
|
11089
11133
|
const Factory_1 = requireFactory();
|
|
11090
11134
|
const Node_1 = requireNode();
|
|
11091
11135
|
const Validators_1 = requireValidators();
|
|
@@ -11122,7 +11166,7 @@
|
|
|
11122
11166
|
if (hasRequiredHSV) return HSV;
|
|
11123
11167
|
hasRequiredHSV = 1;
|
|
11124
11168
|
Object.defineProperty(HSV, "__esModule", { value: true });
|
|
11125
|
-
HSV.HSV =
|
|
11169
|
+
HSV.HSV = void 0;
|
|
11126
11170
|
const Factory_1 = requireFactory();
|
|
11127
11171
|
const Node_1 = requireNode();
|
|
11128
11172
|
const Validators_1 = requireValidators();
|
|
@@ -11132,12 +11176,11 @@
|
|
|
11132
11176
|
const rr = 0.299 * v + 0.701 * vsu + 0.167 * vsw, rg = 0.587 * v - 0.587 * vsu + 0.33 * vsw, rb = 0.114 * v - 0.114 * vsu - 0.497 * vsw;
|
|
11133
11177
|
const gr = 0.299 * v - 0.299 * vsu - 0.328 * vsw, gg = 0.587 * v + 0.413 * vsu + 0.035 * vsw, gb = 0.114 * v - 0.114 * vsu + 0.293 * vsw;
|
|
11134
11178
|
const br = 0.299 * v - 0.3 * vsu + 1.25 * vsw, bg = 0.587 * v - 0.586 * vsu - 1.05 * vsw, bb = 0.114 * v + 0.886 * vsu - 0.2 * vsw;
|
|
11135
|
-
let r, g, b, a;
|
|
11136
11179
|
for (let i = 0; i < nPixels; i += 4) {
|
|
11137
|
-
r = data[i + 0];
|
|
11138
|
-
g = data[i + 1];
|
|
11139
|
-
b = data[i + 2];
|
|
11140
|
-
a = data[i + 3];
|
|
11180
|
+
const r = data[i + 0];
|
|
11181
|
+
const g = data[i + 1];
|
|
11182
|
+
const b = data[i + 2];
|
|
11183
|
+
const a = data[i + 3];
|
|
11141
11184
|
data[i + 0] = rr * r + rg * g + rb * b;
|
|
11142
11185
|
data[i + 1] = gr * r + gg * g + gb * b;
|
|
11143
11186
|
data[i + 2] = br * r + bg * g + bb * b;
|
|
@@ -11159,7 +11202,7 @@
|
|
|
11159
11202
|
if (hasRequiredInvert) return Invert;
|
|
11160
11203
|
hasRequiredInvert = 1;
|
|
11161
11204
|
Object.defineProperty(Invert, "__esModule", { value: true });
|
|
11162
|
-
Invert.Invert =
|
|
11205
|
+
Invert.Invert = void 0;
|
|
11163
11206
|
const Invert$1 = function (imageData) {
|
|
11164
11207
|
const data = imageData.data, len = data.length;
|
|
11165
11208
|
for (let i = 0; i < len; i += 4) {
|
|
@@ -11180,7 +11223,7 @@
|
|
|
11180
11223
|
if (hasRequiredKaleidoscope) return Kaleidoscope;
|
|
11181
11224
|
hasRequiredKaleidoscope = 1;
|
|
11182
11225
|
Object.defineProperty(Kaleidoscope, "__esModule", { value: true });
|
|
11183
|
-
Kaleidoscope.Kaleidoscope =
|
|
11226
|
+
Kaleidoscope.Kaleidoscope = void 0;
|
|
11184
11227
|
const Factory_1 = requireFactory();
|
|
11185
11228
|
const Node_1 = requireNode();
|
|
11186
11229
|
const Util_1 = requireUtil();
|
|
@@ -11326,7 +11369,7 @@
|
|
|
11326
11369
|
if (hasRequiredMask) return Mask;
|
|
11327
11370
|
hasRequiredMask = 1;
|
|
11328
11371
|
Object.defineProperty(Mask, "__esModule", { value: true });
|
|
11329
|
-
Mask.Mask =
|
|
11372
|
+
Mask.Mask = void 0;
|
|
11330
11373
|
const Factory_1 = requireFactory();
|
|
11331
11374
|
const Node_1 = requireNode();
|
|
11332
11375
|
const Validators_1 = requireValidators();
|
|
@@ -11480,7 +11523,7 @@
|
|
|
11480
11523
|
if (hasRequiredNoise) return Noise;
|
|
11481
11524
|
hasRequiredNoise = 1;
|
|
11482
11525
|
Object.defineProperty(Noise, "__esModule", { value: true });
|
|
11483
|
-
Noise.Noise =
|
|
11526
|
+
Noise.Noise = void 0;
|
|
11484
11527
|
const Factory_1 = requireFactory();
|
|
11485
11528
|
const Node_1 = requireNode();
|
|
11486
11529
|
const Validators_1 = requireValidators();
|
|
@@ -11505,37 +11548,37 @@
|
|
|
11505
11548
|
if (hasRequiredPixelate) return Pixelate;
|
|
11506
11549
|
hasRequiredPixelate = 1;
|
|
11507
11550
|
Object.defineProperty(Pixelate, "__esModule", { value: true });
|
|
11508
|
-
Pixelate.Pixelate =
|
|
11551
|
+
Pixelate.Pixelate = void 0;
|
|
11509
11552
|
const Factory_1 = requireFactory();
|
|
11510
11553
|
const Util_1 = requireUtil();
|
|
11511
11554
|
const Node_1 = requireNode();
|
|
11512
11555
|
const Validators_1 = requireValidators();
|
|
11513
11556
|
const Pixelate$1 = function (imageData) {
|
|
11514
|
-
let pixelSize = Math.ceil(this.pixelSize()), width = imageData.width, height = imageData.height,
|
|
11557
|
+
let pixelSize = Math.ceil(this.pixelSize()), width = imageData.width, height = imageData.height, nBinsX = Math.ceil(width / pixelSize), nBinsY = Math.ceil(height / pixelSize), data = imageData.data;
|
|
11515
11558
|
if (pixelSize <= 0) {
|
|
11516
11559
|
Util_1.Util.error('pixelSize value can not be <= 0');
|
|
11517
11560
|
return;
|
|
11518
11561
|
}
|
|
11519
|
-
for (xBin = 0; xBin < nBinsX; xBin += 1) {
|
|
11520
|
-
for (yBin = 0; yBin < nBinsY; yBin += 1) {
|
|
11521
|
-
red = 0;
|
|
11522
|
-
green = 0;
|
|
11523
|
-
blue = 0;
|
|
11524
|
-
alpha = 0;
|
|
11525
|
-
xBinStart = xBin * pixelSize;
|
|
11526
|
-
xBinEnd = xBinStart + pixelSize;
|
|
11527
|
-
yBinStart = yBin * pixelSize;
|
|
11528
|
-
yBinEnd = yBinStart + pixelSize;
|
|
11529
|
-
pixelsInBin = 0;
|
|
11530
|
-
for (x = xBinStart; x < xBinEnd; x += 1) {
|
|
11562
|
+
for (let xBin = 0; xBin < nBinsX; xBin += 1) {
|
|
11563
|
+
for (let yBin = 0; yBin < nBinsY; yBin += 1) {
|
|
11564
|
+
let red = 0;
|
|
11565
|
+
let green = 0;
|
|
11566
|
+
let blue = 0;
|
|
11567
|
+
let alpha = 0;
|
|
11568
|
+
const xBinStart = xBin * pixelSize;
|
|
11569
|
+
const xBinEnd = xBinStart + pixelSize;
|
|
11570
|
+
const yBinStart = yBin * pixelSize;
|
|
11571
|
+
const yBinEnd = yBinStart + pixelSize;
|
|
11572
|
+
let pixelsInBin = 0;
|
|
11573
|
+
for (let x = xBinStart; x < xBinEnd; x += 1) {
|
|
11531
11574
|
if (x >= width) {
|
|
11532
11575
|
continue;
|
|
11533
11576
|
}
|
|
11534
|
-
for (y = yBinStart; y < yBinEnd; y += 1) {
|
|
11577
|
+
for (let y = yBinStart; y < yBinEnd; y += 1) {
|
|
11535
11578
|
if (y >= height) {
|
|
11536
11579
|
continue;
|
|
11537
11580
|
}
|
|
11538
|
-
i = (width * y + x) * 4;
|
|
11581
|
+
const i = (width * y + x) * 4;
|
|
11539
11582
|
red += data[i + 0];
|
|
11540
11583
|
green += data[i + 1];
|
|
11541
11584
|
blue += data[i + 2];
|
|
@@ -11547,15 +11590,15 @@
|
|
|
11547
11590
|
green = green / pixelsInBin;
|
|
11548
11591
|
blue = blue / pixelsInBin;
|
|
11549
11592
|
alpha = alpha / pixelsInBin;
|
|
11550
|
-
for (x = xBinStart; x < xBinEnd; x += 1) {
|
|
11593
|
+
for (let x = xBinStart; x < xBinEnd; x += 1) {
|
|
11551
11594
|
if (x >= width) {
|
|
11552
11595
|
continue;
|
|
11553
11596
|
}
|
|
11554
|
-
for (y = yBinStart; y < yBinEnd; y += 1) {
|
|
11597
|
+
for (let y = yBinStart; y < yBinEnd; y += 1) {
|
|
11555
11598
|
if (y >= height) {
|
|
11556
11599
|
continue;
|
|
11557
11600
|
}
|
|
11558
|
-
i = (width * y + x) * 4;
|
|
11601
|
+
const i = (width * y + x) * 4;
|
|
11559
11602
|
data[i + 0] = red;
|
|
11560
11603
|
data[i + 1] = green;
|
|
11561
11604
|
data[i + 2] = blue;
|
|
@@ -11578,7 +11621,7 @@
|
|
|
11578
11621
|
if (hasRequiredPosterize) return Posterize;
|
|
11579
11622
|
hasRequiredPosterize = 1;
|
|
11580
11623
|
Object.defineProperty(Posterize, "__esModule", { value: true });
|
|
11581
|
-
Posterize.Posterize =
|
|
11624
|
+
Posterize.Posterize = void 0;
|
|
11582
11625
|
const Factory_1 = requireFactory();
|
|
11583
11626
|
const Node_1 = requireNode();
|
|
11584
11627
|
const Validators_1 = requireValidators();
|
|
@@ -11601,7 +11644,7 @@
|
|
|
11601
11644
|
if (hasRequiredRGB) return RGB;
|
|
11602
11645
|
hasRequiredRGB = 1;
|
|
11603
11646
|
Object.defineProperty(RGB, "__esModule", { value: true });
|
|
11604
|
-
RGB.RGB =
|
|
11647
|
+
RGB.RGB = void 0;
|
|
11605
11648
|
const Factory_1 = requireFactory();
|
|
11606
11649
|
const Node_1 = requireNode();
|
|
11607
11650
|
const Validators_1 = requireValidators();
|
|
@@ -11652,7 +11695,7 @@
|
|
|
11652
11695
|
if (hasRequiredRGBA) return RGBA;
|
|
11653
11696
|
hasRequiredRGBA = 1;
|
|
11654
11697
|
Object.defineProperty(RGBA, "__esModule", { value: true });
|
|
11655
|
-
RGBA.RGBA =
|
|
11698
|
+
RGBA.RGBA = void 0;
|
|
11656
11699
|
const Factory_1 = requireFactory();
|
|
11657
11700
|
const Node_1 = requireNode();
|
|
11658
11701
|
const Validators_1 = requireValidators();
|
|
@@ -11714,7 +11757,7 @@
|
|
|
11714
11757
|
if (hasRequiredSepia) return Sepia;
|
|
11715
11758
|
hasRequiredSepia = 1;
|
|
11716
11759
|
Object.defineProperty(Sepia, "__esModule", { value: true });
|
|
11717
|
-
Sepia.Sepia =
|
|
11760
|
+
Sepia.Sepia = void 0;
|
|
11718
11761
|
const Sepia$1 = function (imageData) {
|
|
11719
11762
|
const data = imageData.data, nPixels = data.length;
|
|
11720
11763
|
for (let i = 0; i < nPixels; i += 4) {
|
|
@@ -11738,7 +11781,7 @@
|
|
|
11738
11781
|
if (hasRequiredSolarize) return Solarize;
|
|
11739
11782
|
hasRequiredSolarize = 1;
|
|
11740
11783
|
Object.defineProperty(Solarize, "__esModule", { value: true });
|
|
11741
|
-
Solarize.Solarize =
|
|
11784
|
+
Solarize.Solarize = void 0;
|
|
11742
11785
|
const Solarize$1 = function (imageData) {
|
|
11743
11786
|
const data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4;
|
|
11744
11787
|
let y = h;
|
|
@@ -11777,7 +11820,7 @@
|
|
|
11777
11820
|
if (hasRequiredThreshold) return Threshold;
|
|
11778
11821
|
hasRequiredThreshold = 1;
|
|
11779
11822
|
Object.defineProperty(Threshold, "__esModule", { value: true });
|
|
11780
|
-
Threshold.Threshold =
|
|
11823
|
+
Threshold.Threshold = void 0;
|
|
11781
11824
|
const Factory_1 = requireFactory();
|
|
11782
11825
|
const Node_1 = requireNode();
|
|
11783
11826
|
const Validators_1 = requireValidators();
|
|
@@ -11798,7 +11841,7 @@
|
|
|
11798
11841
|
if (hasRequired_FullInternals) return _FullInternals;
|
|
11799
11842
|
hasRequired_FullInternals = 1;
|
|
11800
11843
|
Object.defineProperty(_FullInternals, "__esModule", { value: true });
|
|
11801
|
-
_FullInternals.Konva =
|
|
11844
|
+
_FullInternals.Konva = void 0;
|
|
11802
11845
|
const _CoreInternals_1 = require_CoreInternals();
|
|
11803
11846
|
const Arc_1 = requireArc();
|
|
11804
11847
|
const Arrow_1 = requireArrow();
|
|
@@ -12062,8 +12105,8 @@
|
|
|
12062
12105
|
wcsPoints.push({ x: wcsPoint.x, y: wcsPoint.y, z: wcsPoint.z });
|
|
12063
12106
|
});
|
|
12064
12107
|
this._ref = new Konva.Line({
|
|
12065
|
-
stroke: (_a = params.color) !== null && _a !==
|
|
12066
|
-
strokeWidth: (_b = params.width) !== null && _b !==
|
|
12108
|
+
stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
|
|
12109
|
+
strokeWidth: (_b = params.width) !== null && _b !== void 0 ? _b : 4,
|
|
12067
12110
|
globalCompositeOperation: "source-over",
|
|
12068
12111
|
lineCap: "round",
|
|
12069
12112
|
lineJoin: "round",
|
|
@@ -12240,12 +12283,12 @@
|
|
|
12240
12283
|
x: params.position.x,
|
|
12241
12284
|
y: params.position.y,
|
|
12242
12285
|
text: params.text,
|
|
12243
|
-
fontSize: (_a = params.fontSize) !== null && _a !==
|
|
12286
|
+
fontSize: (_a = params.fontSize) !== null && _a !== void 0 ? _a : 34,
|
|
12244
12287
|
fontFamily: this.TEXT_FONT_FAMILY,
|
|
12245
|
-
fill: (_b = params.color) !== null && _b !==
|
|
12288
|
+
fill: (_b = params.color) !== null && _b !== void 0 ? _b : "#ff0000",
|
|
12246
12289
|
align: "left",
|
|
12247
12290
|
draggable: true,
|
|
12248
|
-
rotation: (_c = params.rotation) !== null && _c !==
|
|
12291
|
+
rotation: (_c = params.rotation) !== null && _c !== void 0 ? _c : 0,
|
|
12249
12292
|
});
|
|
12250
12293
|
this._ref.width(this._ref.getTextWidth());
|
|
12251
12294
|
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: params.position.x, y: params.position.y }));
|
|
@@ -12409,15 +12452,15 @@
|
|
|
12409
12452
|
}
|
|
12410
12453
|
}
|
|
12411
12454
|
this._ref = new Konva.Rect({
|
|
12412
|
-
stroke: (_a = params.color) !== null && _a !==
|
|
12413
|
-
strokeWidth: (_b = params.lineWidth) !== null && _b !==
|
|
12455
|
+
stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
|
|
12456
|
+
strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
|
|
12414
12457
|
globalCompositeOperation: "source-over",
|
|
12415
12458
|
lineCap: "round",
|
|
12416
12459
|
lineJoin: "round",
|
|
12417
12460
|
x: params.position.x,
|
|
12418
12461
|
y: params.position.y,
|
|
12419
|
-
width: (_c = params.width) !== null && _c !==
|
|
12420
|
-
height: (_d = params.height) !== null && _d !==
|
|
12462
|
+
width: (_c = params.width) !== null && _c !== void 0 ? _c : 200,
|
|
12463
|
+
height: (_d = params.height) !== null && _d !== void 0 ? _d : 200,
|
|
12421
12464
|
draggable: true,
|
|
12422
12465
|
strokeScaleEnabled: false,
|
|
12423
12466
|
});
|
|
@@ -12596,7 +12639,7 @@
|
|
|
12596
12639
|
if (!params.position)
|
|
12597
12640
|
params.position = { x: 0, y: 0 };
|
|
12598
12641
|
if (params.position2) {
|
|
12599
|
-
(_a = params.radius) !== null && _a !==
|
|
12642
|
+
(_a = params.radius) !== null && _a !== void 0 ? _a : (params.radius = { x: 0, y: 0 });
|
|
12600
12643
|
params.radius.x = getDistanceIn2D(params.position, params.position2);
|
|
12601
12644
|
if (params.position3)
|
|
12602
12645
|
params.radius.y = getDistanceIn2D(params.position, params.position3);
|
|
@@ -12608,8 +12651,8 @@
|
|
|
12608
12651
|
params.radius = { x: 25, y: 25 };
|
|
12609
12652
|
}
|
|
12610
12653
|
this._ref = new Konva.Ellipse({
|
|
12611
|
-
stroke: (_b = params.color) !== null && _b !==
|
|
12612
|
-
strokeWidth: (_c = params.lineWidth) !== null && _c !==
|
|
12654
|
+
stroke: (_b = params.color) !== null && _b !== void 0 ? _b : "#ff0000",
|
|
12655
|
+
strokeWidth: (_c = params.lineWidth) !== null && _c !== void 0 ? _c : 4,
|
|
12613
12656
|
globalCompositeOperation: "source-over",
|
|
12614
12657
|
lineCap: "round",
|
|
12615
12658
|
lineJoin: "round",
|
|
@@ -12793,8 +12836,8 @@
|
|
|
12793
12836
|
if (!params.end)
|
|
12794
12837
|
params.end = { x: 100, y: 100 };
|
|
12795
12838
|
this._ref = new Konva.Arrow({
|
|
12796
|
-
stroke: (_a = params.color) !== null && _a !==
|
|
12797
|
-
fill: (_b = params.color) !== null && _b !==
|
|
12839
|
+
stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
|
|
12840
|
+
fill: (_b = params.color) !== null && _b !== void 0 ? _b : "#ff0000",
|
|
12798
12841
|
strokeWidth: 4,
|
|
12799
12842
|
globalCompositeOperation: "source-over",
|
|
12800
12843
|
lineCap: "round",
|
|
@@ -13010,8 +13053,8 @@
|
|
|
13010
13053
|
x: params.position.x,
|
|
13011
13054
|
y: params.position.y,
|
|
13012
13055
|
image: this._canvasImage,
|
|
13013
|
-
width: (_a = params.width) !== null && _a !==
|
|
13014
|
-
height: (_b = params.height) !== null && _b !==
|
|
13056
|
+
width: (_a = params.width) !== null && _a !== void 0 ? _a : 0,
|
|
13057
|
+
height: (_b = params.height) !== null && _b !== void 0 ? _b : 0,
|
|
13015
13058
|
draggable: true,
|
|
13016
13059
|
});
|
|
13017
13060
|
this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: params.position.x, y: params.position.y }));
|
|
@@ -13202,10 +13245,10 @@
|
|
|
13202
13245
|
this._ref = new Konva.Shape({
|
|
13203
13246
|
x: params.position.x,
|
|
13204
13247
|
y: params.position.y,
|
|
13205
|
-
width: (_a = params.width) !== null && _a !==
|
|
13206
|
-
height: (_b = params.height) !== null && _b !==
|
|
13207
|
-
stroke: (_c = params.color) !== null && _c !==
|
|
13208
|
-
strokeWidth: (_d = params.lineWidth) !== null && _d !==
|
|
13248
|
+
width: (_a = params.width) !== null && _a !== void 0 ? _a : 200,
|
|
13249
|
+
height: (_b = params.height) !== null && _b !== void 0 ? _b : 200,
|
|
13250
|
+
stroke: (_c = params.color) !== null && _c !== void 0 ? _c : "#ff0000",
|
|
13251
|
+
strokeWidth: (_d = params.lineWidth) !== null && _d !== void 0 ? _d : 4,
|
|
13209
13252
|
draggable: true,
|
|
13210
13253
|
strokeScaleEnabled: false,
|
|
13211
13254
|
globalCompositeOperation: "source-over",
|
|
@@ -13555,7 +13598,7 @@
|
|
|
13555
13598
|
if (!Konva)
|
|
13556
13599
|
throw new Error('Markup error: Konva is not initialized. Forgot to add <script src="https://unpkg.com/konva@9/konva.min.js"></script> to your page?');
|
|
13557
13600
|
this._viewer = viewer;
|
|
13558
|
-
this._worldTransformer = worldTransformer !== null && worldTransformer !==
|
|
13601
|
+
this._worldTransformer = worldTransformer !== null && worldTransformer !== void 0 ? worldTransformer : new WorldTransform();
|
|
13559
13602
|
this._container = container;
|
|
13560
13603
|
this._markupContainer = document.createElement("div");
|
|
13561
13604
|
this._markupContainer.id = "markup-container";
|
|
@@ -13586,9 +13629,9 @@
|
|
|
13586
13629
|
this._viewer.removeEventListener("changeactivedragger", this.changeActiveDragger);
|
|
13587
13630
|
}
|
|
13588
13631
|
this.destroyKonva();
|
|
13589
|
-
(_a = this._resizeObserver) === null || _a ===
|
|
13632
|
+
(_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
13590
13633
|
this._resizeObserver = undefined;
|
|
13591
|
-
(_b = this._markupContainer) === null || _b ===
|
|
13634
|
+
(_b = this._markupContainer) === null || _b === void 0 ? void 0 : _b.remove();
|
|
13592
13635
|
this._markupContainer = undefined;
|
|
13593
13636
|
this._container = undefined;
|
|
13594
13637
|
this._viewer = undefined;
|
|
@@ -13612,11 +13655,11 @@
|
|
|
13612
13655
|
colorizeAllMarkup(r, g, b) {
|
|
13613
13656
|
this.setMarkupColor(r, g, b);
|
|
13614
13657
|
const hexColor = new MarkupColor(r, g, b).asHex();
|
|
13615
|
-
this.getObjects().filter((obj) => { var _a; return (_a = obj.setColor) === null || _a ===
|
|
13658
|
+
this.getObjects().filter((obj) => { var _a; return (_a = obj.setColor) === null || _a === void 0 ? void 0 : _a.call(obj, hexColor); });
|
|
13616
13659
|
}
|
|
13617
13660
|
colorizeSelectedMarkups(r, g, b) {
|
|
13618
13661
|
const hexColor = new MarkupColor(r, g, b).asHex();
|
|
13619
|
-
this.getSelectedObjects().filter((obj) => { var _a; return (_a = obj.setColor) === null || _a ===
|
|
13662
|
+
this.getSelectedObjects().filter((obj) => { var _a; return (_a = obj.setColor) === null || _a === void 0 ? void 0 : _a.call(obj, hexColor); });
|
|
13620
13663
|
}
|
|
13621
13664
|
setViewpoint(viewpoint) {
|
|
13622
13665
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -13625,9 +13668,9 @@
|
|
|
13625
13668
|
this.removeImageInput();
|
|
13626
13669
|
this._konvaStage.scale({ x: 1, y: 1 });
|
|
13627
13670
|
this._konvaStage.position({ x: 0, y: 0 });
|
|
13628
|
-
const markupColor = ((_a = viewpoint.custom_fields) === null || _a ===
|
|
13671
|
+
const markupColor = ((_a = viewpoint.custom_fields) === null || _a === void 0 ? void 0 : _a.markup_color) || { r: 255, g: 0, b: 0 };
|
|
13629
13672
|
this.setMarkupColor(markupColor.r, markupColor.g, markupColor.b);
|
|
13630
|
-
(_b = viewpoint.lines) === null || _b ===
|
|
13673
|
+
(_b = viewpoint.lines) === null || _b === void 0 ? void 0 : _b.forEach((line) => {
|
|
13631
13674
|
const linePoints = [];
|
|
13632
13675
|
line.points.forEach((point) => {
|
|
13633
13676
|
const screenPoint = this._worldTransformer.worldToScreen(point);
|
|
@@ -13636,32 +13679,32 @@
|
|
|
13636
13679
|
});
|
|
13637
13680
|
this.addLine(linePoints, line.color, line.type, line.width, line.id);
|
|
13638
13681
|
});
|
|
13639
|
-
(_c = viewpoint.texts) === null || _c ===
|
|
13682
|
+
(_c = viewpoint.texts) === null || _c === void 0 ? void 0 : _c.forEach((text) => {
|
|
13640
13683
|
const screenPoint = this._worldTransformer.worldToScreen(text.position);
|
|
13641
13684
|
this.addText(text.text, screenPoint, text.angle, text.color, text.text_size, text.font_size, text.id);
|
|
13642
13685
|
});
|
|
13643
|
-
(_d = viewpoint.rectangles) === null || _d ===
|
|
13686
|
+
(_d = viewpoint.rectangles) === null || _d === void 0 ? void 0 : _d.forEach((rect) => {
|
|
13644
13687
|
const screenPoint = this._worldTransformer.worldToScreen(rect.position);
|
|
13645
13688
|
const screenPoint2 = rect.position2 ? this._worldTransformer.worldToScreen(rect.position2) : null;
|
|
13646
13689
|
this.addRectangle(screenPoint, screenPoint2, rect.width, rect.height, rect.line_width, rect.color, rect.id);
|
|
13647
13690
|
});
|
|
13648
|
-
(_e = viewpoint.ellipses) === null || _e ===
|
|
13691
|
+
(_e = viewpoint.ellipses) === null || _e === void 0 ? void 0 : _e.forEach((ellipse) => {
|
|
13649
13692
|
const screenPoint = this._worldTransformer.worldToScreen(ellipse.position);
|
|
13650
13693
|
const screenPoint2 = ellipse.position2 ? this._worldTransformer.worldToScreen(ellipse.position2) : null;
|
|
13651
13694
|
const screenPoint3 = ellipse.position3 ? this._worldTransformer.worldToScreen(ellipse.position3) : null;
|
|
13652
13695
|
this.addEllipse(screenPoint, screenPoint2, screenPoint3, ellipse.radius, ellipse.line_width, ellipse.color, ellipse.id);
|
|
13653
13696
|
});
|
|
13654
|
-
(_f = viewpoint.arrows) === null || _f ===
|
|
13697
|
+
(_f = viewpoint.arrows) === null || _f === void 0 ? void 0 : _f.forEach((arrow) => {
|
|
13655
13698
|
const startPoint = this._worldTransformer.worldToScreen(arrow.start);
|
|
13656
13699
|
const endPoint = this._worldTransformer.worldToScreen(arrow.end);
|
|
13657
13700
|
this.addArrow(startPoint, endPoint, arrow.color, arrow.id);
|
|
13658
13701
|
});
|
|
13659
|
-
(_g = viewpoint.clouds) === null || _g ===
|
|
13702
|
+
(_g = viewpoint.clouds) === null || _g === void 0 ? void 0 : _g.forEach((cloud) => {
|
|
13660
13703
|
const screenPoint = this._worldTransformer.worldToScreen(cloud.position);
|
|
13661
13704
|
const screenPoint2 = cloud.position2 ? this._worldTransformer.worldToScreen(cloud.position2) : null;
|
|
13662
13705
|
this.addCloud(screenPoint, screenPoint2, cloud.width, cloud.height, cloud.line_width, cloud.color, cloud.id);
|
|
13663
13706
|
});
|
|
13664
|
-
(_h = viewpoint.images) === null || _h ===
|
|
13707
|
+
(_h = viewpoint.images) === null || _h === void 0 ? void 0 : _h.forEach((image) => {
|
|
13665
13708
|
const screenPoint = this._worldTransformer.worldToScreen(image.position);
|
|
13666
13709
|
const screenPoint2 = image.position2 ? this._worldTransformer.worldToScreen(image.position2) : null;
|
|
13667
13710
|
this.addImage(screenPoint, screenPoint2, image.src, image.width, image.height, image.id);
|
|
@@ -13979,7 +14022,7 @@
|
|
|
13979
14022
|
this.removeTextInput();
|
|
13980
14023
|
this.removeImageInput();
|
|
13981
14024
|
this.clearOverlay();
|
|
13982
|
-
(_a = this._konvaStage) === null || _a ===
|
|
14025
|
+
(_a = this._konvaStage) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
13983
14026
|
this._groupImages = undefined;
|
|
13984
14027
|
this._groupGeometry = undefined;
|
|
13985
14028
|
this._groupTexts = undefined;
|
|
@@ -14196,7 +14239,7 @@
|
|
|
14196
14239
|
}
|
|
14197
14240
|
removeTextInput() {
|
|
14198
14241
|
var _a;
|
|
14199
|
-
(_a = this._textInputRef) === null || _a ===
|
|
14242
|
+
(_a = this._textInputRef) === null || _a === void 0 ? void 0 : _a.remove();
|
|
14200
14243
|
this._textInputRef = null;
|
|
14201
14244
|
this._textInputPos = null;
|
|
14202
14245
|
this._textInputAngle = 0;
|
|
@@ -14239,7 +14282,7 @@
|
|
|
14239
14282
|
}
|
|
14240
14283
|
removeImageInput() {
|
|
14241
14284
|
var _a;
|
|
14242
|
-
(_a = this._imageInputRef) === null || _a ===
|
|
14285
|
+
(_a = this._imageInputRef) === null || _a === void 0 ? void 0 : _a.remove();
|
|
14243
14286
|
this._imageInputRef = null;
|
|
14244
14287
|
this._imageInputPos = null;
|
|
14245
14288
|
}
|
|
@@ -14248,7 +14291,7 @@
|
|
|
14248
14291
|
if (!text)
|
|
14249
14292
|
return;
|
|
14250
14293
|
// in case of edit - remove old Konva.Text object
|
|
14251
|
-
(_a = this.getSelectedObjects().
|
|
14294
|
+
(_a = this.getSelectedObjects().shift()) === null || _a === void 0 ? void 0 : _a.delete();
|
|
14252
14295
|
this.clearSelected();
|
|
14253
14296
|
this.removeTextInput();
|
|
14254
14297
|
// in case we have old viewpoint without font_size
|
|
@@ -14331,7 +14374,7 @@
|
|
|
14331
14374
|
if (!position || !src)
|
|
14332
14375
|
return;
|
|
14333
14376
|
// in case of edit - remove old Image placeholder object
|
|
14334
|
-
(_a = this.getSelectedObjects().
|
|
14377
|
+
(_a = this.getSelectedObjects().shift()) === null || _a === void 0 ? void 0 : _a.delete();
|
|
14335
14378
|
this.clearSelected();
|
|
14336
14379
|
this.removeImageInput();
|
|
14337
14380
|
const konvaImage = new KonvaImage({
|