@visactor/vtable 0.10.0 → 0.10.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/ListTable.d.ts +1 -2
- package/cjs/ListTable.js +2 -5
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.js +10 -8
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.js +8 -5
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/components/axis/get-axis-attributes.d.ts +2 -0
- package/cjs/components/axis/get-axis-attributes.js +3 -1
- package/cjs/components/axis/get-axis-attributes.js.map +1 -1
- package/cjs/components/axis/get-axis-component-size.js +65 -33
- package/cjs/components/axis/get-axis-component-size.js.map +1 -1
- package/cjs/components/tooltip/TooltipHandler.js +2 -0
- package/cjs/components/tooltip/TooltipHandler.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +4 -2
- package/cjs/core/BaseTable.js +29 -30
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/event/drill.js +2 -0
- package/cjs/event/drill.js.map +1 -1
- package/cjs/event/event.js +1 -1
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/table-group.js +19 -9
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/pivot-header-layout.d.ts +1 -0
- package/cjs/layout/pivot-header-layout.js +28 -4
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/simple-header-layout.js +22 -10
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/scenegraph/component/table-component.d.ts +3 -3
- package/cjs/scenegraph/component/table-component.js +6 -6
- package/cjs/scenegraph/component/table-component.js.map +1 -1
- package/cjs/scenegraph/component/util.d.ts +1 -1
- package/cjs/scenegraph/component/util.js +2 -1
- package/cjs/scenegraph/component/util.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -3
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +7 -21
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +9 -4
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +1 -0
- package/cjs/scenegraph/scenegraph.js +20 -21
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/utils/update-container.d.ts +2 -0
- package/cjs/scenegraph/utils/update-container.js +13 -0
- package/cjs/scenegraph/utils/update-container.js.map +1 -0
- package/cjs/state/resize/update-resize-column.d.ts +2 -0
- package/cjs/state/resize/update-resize-column.js +74 -0
- package/cjs/state/resize/update-resize-column.js.map +1 -0
- package/cjs/state/sort/index.js +4 -2
- package/cjs/state/sort/index.js.map +1 -1
- package/cjs/state/state.d.ts +2 -1
- package/cjs/state/state.js +5 -24
- package/cjs/state/state.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +3 -1
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/events.d.ts +1 -1
- package/cjs/ts-types/events.js.map +1 -1
- package/dist/vtable.js +1936 -726
- package/dist/vtable.min.js +3 -3
- package/es/ListTable.d.ts +1 -2
- package/es/ListTable.js +2 -5
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.js +10 -8
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.js +8 -5
- package/es/PivotTable.js.map +1 -1
- package/es/components/axis/get-axis-attributes.d.ts +2 -0
- package/es/components/axis/get-axis-attributes.js +3 -1
- package/es/components/axis/get-axis-attributes.js.map +1 -1
- package/es/components/axis/get-axis-component-size.js +65 -33
- package/es/components/axis/get-axis-component-size.js.map +1 -1
- package/es/components/tooltip/TooltipHandler.js +2 -0
- package/es/components/tooltip/TooltipHandler.js.map +1 -1
- package/es/core/BaseTable.d.ts +4 -2
- package/es/core/BaseTable.js +28 -28
- package/es/core/BaseTable.js.map +1 -1
- package/es/event/drill.js +2 -0
- package/es/event/drill.js.map +1 -1
- package/es/event/event.js +1 -1
- package/es/event/event.js.map +1 -1
- package/es/event/listener/table-group.js +19 -9
- package/es/event/listener/table-group.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/pivot-header-layout.d.ts +1 -0
- package/es/layout/pivot-header-layout.js +26 -4
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/simple-header-layout.js +22 -10
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/scenegraph/component/table-component.d.ts +3 -3
- package/es/scenegraph/component/table-component.js +6 -6
- package/es/scenegraph/component/table-component.js.map +1 -1
- package/es/scenegraph/component/util.d.ts +1 -1
- package/es/scenegraph/component/util.js +2 -1
- package/es/scenegraph/component/util.js.map +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -3
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +7 -21
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +9 -4
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +1 -0
- package/es/scenegraph/scenegraph.js +18 -20
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/utils/update-container.d.ts +2 -0
- package/es/scenegraph/utils/update-container.js +7 -0
- package/es/scenegraph/utils/update-container.js.map +1 -0
- package/es/state/resize/update-resize-column.d.ts +2 -0
- package/es/state/resize/update-resize-column.js +68 -0
- package/es/state/resize/update-resize-column.js.map +1 -0
- package/es/state/sort/index.js +4 -2
- package/es/state/sort/index.js.map +1 -1
- package/es/state/state.d.ts +2 -1
- package/es/state/state.js +6 -23
- package/es/state/state.js.map +1 -1
- package/es/ts-types/base-table.d.ts +3 -1
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/events.d.ts +1 -1
- package/es/ts-types/events.js.map +1 -1
- package/package.json +7 -7
package/dist/vtable.js
CHANGED
|
@@ -2407,6 +2407,17 @@
|
|
|
2407
2407
|
return a < b && !isNumberClose(a, b, relTol, absTol);
|
|
2408
2408
|
}
|
|
2409
2409
|
|
|
2410
|
+
const memoize = func => {
|
|
2411
|
+
let lastArgs = null,
|
|
2412
|
+
lastResult = null;
|
|
2413
|
+
return function () {
|
|
2414
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2415
|
+
args[_key] = arguments[_key];
|
|
2416
|
+
}
|
|
2417
|
+
return lastArgs && args.every((val, i) => val === lastArgs[i]) || (lastArgs = args, lastResult = func(...args)), lastResult;
|
|
2418
|
+
};
|
|
2419
|
+
};
|
|
2420
|
+
|
|
2410
2421
|
const clamp$1 = function (input, min, max) {
|
|
2411
2422
|
return input < min ? min : input > max ? max : input;
|
|
2412
2423
|
};
|
|
@@ -4663,7 +4674,7 @@
|
|
|
4663
4674
|
};
|
|
4664
4675
|
|
|
4665
4676
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
4666
|
-
var global$
|
|
4677
|
+
var global$d =
|
|
4667
4678
|
// eslint-disable-next-line es/no-global-this -- safe
|
|
4668
4679
|
check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) ||
|
|
4669
4680
|
// eslint-disable-next-line no-restricted-globals -- safe
|
|
@@ -4821,13 +4832,13 @@
|
|
|
4821
4832
|
return typeof it == 'object' ? it !== null : isCallable$h(it);
|
|
4822
4833
|
};
|
|
4823
4834
|
|
|
4824
|
-
var global$
|
|
4835
|
+
var global$c = global$d;
|
|
4825
4836
|
var isCallable$g = isCallable$i;
|
|
4826
4837
|
var aFunction = function (argument) {
|
|
4827
4838
|
return isCallable$g(argument) ? argument : undefined;
|
|
4828
4839
|
};
|
|
4829
4840
|
var getBuiltIn$6 = function (namespace, method) {
|
|
4830
|
-
return arguments.length < 2 ? aFunction(global$
|
|
4841
|
+
return arguments.length < 2 ? aFunction(global$c[namespace]) : global$c[namespace] && global$c[namespace][method];
|
|
4831
4842
|
};
|
|
4832
4843
|
|
|
4833
4844
|
var uncurryThis$k = functionUncurryThis;
|
|
@@ -4835,10 +4846,10 @@
|
|
|
4835
4846
|
|
|
4836
4847
|
var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
|
|
4837
4848
|
|
|
4838
|
-
var global$
|
|
4849
|
+
var global$b = global$d;
|
|
4839
4850
|
var userAgent = engineUserAgent;
|
|
4840
|
-
var process = global$
|
|
4841
|
-
var Deno = global$
|
|
4851
|
+
var process = global$b.process;
|
|
4852
|
+
var Deno = global$b.Deno;
|
|
4842
4853
|
var versions = process && process.versions || Deno && Deno.version;
|
|
4843
4854
|
var v8 = versions && versions.v8;
|
|
4844
4855
|
var match, version$1;
|
|
@@ -4863,8 +4874,8 @@
|
|
|
4863
4874
|
/* eslint-disable es/no-symbol -- required for testing */
|
|
4864
4875
|
var V8_VERSION = engineV8Version;
|
|
4865
4876
|
var fails$c = fails$g;
|
|
4866
|
-
var global$
|
|
4867
|
-
var $String$4 = global$
|
|
4877
|
+
var global$a = global$d;
|
|
4878
|
+
var $String$4 = global$a.String;
|
|
4868
4879
|
|
|
4869
4880
|
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
4870
4881
|
var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$c(function () {
|
|
@@ -4940,27 +4951,27 @@
|
|
|
4940
4951
|
|
|
4941
4952
|
var shared$4 = {exports: {}};
|
|
4942
4953
|
|
|
4943
|
-
var global$
|
|
4954
|
+
var global$9 = global$d;
|
|
4944
4955
|
|
|
4945
4956
|
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
4946
4957
|
var defineProperty$4 = Object.defineProperty;
|
|
4947
4958
|
var defineGlobalProperty$3 = function (key, value) {
|
|
4948
4959
|
try {
|
|
4949
|
-
defineProperty$4(global$
|
|
4960
|
+
defineProperty$4(global$9, key, {
|
|
4950
4961
|
value: value,
|
|
4951
4962
|
configurable: true,
|
|
4952
4963
|
writable: true
|
|
4953
4964
|
});
|
|
4954
4965
|
} catch (error) {
|
|
4955
|
-
global$
|
|
4966
|
+
global$9[key] = value;
|
|
4956
4967
|
}
|
|
4957
4968
|
return value;
|
|
4958
4969
|
};
|
|
4959
4970
|
|
|
4960
|
-
var global$
|
|
4971
|
+
var global$8 = global$d;
|
|
4961
4972
|
var defineGlobalProperty$2 = defineGlobalProperty$3;
|
|
4962
4973
|
var SHARED = '__core-js_shared__';
|
|
4963
|
-
var store$5 = global$
|
|
4974
|
+
var store$5 = global$8[SHARED] || defineGlobalProperty$2(SHARED, {});
|
|
4964
4975
|
var sharedStore = store$5;
|
|
4965
4976
|
|
|
4966
4977
|
var store$4 = sharedStore;
|
|
@@ -5003,13 +5014,13 @@
|
|
|
5003
5014
|
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id$3 + postfix, 36);
|
|
5004
5015
|
};
|
|
5005
5016
|
|
|
5006
|
-
var global$
|
|
5017
|
+
var global$7 = global$d;
|
|
5007
5018
|
var shared$3 = sharedExports;
|
|
5008
5019
|
var hasOwn$a = hasOwnProperty_1;
|
|
5009
5020
|
var uid$2 = uid$3;
|
|
5010
5021
|
var NATIVE_SYMBOL = symbolConstructorDetection;
|
|
5011
5022
|
var USE_SYMBOL_AS_UID = useSymbolAsUid;
|
|
5012
|
-
var Symbol$2 = global$
|
|
5023
|
+
var Symbol$2 = global$7.Symbol;
|
|
5013
5024
|
var WellKnownSymbolsStore = shared$3('wks');
|
|
5014
5025
|
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$2['for'] || Symbol$2 : Symbol$2 && Symbol$2.withoutSetter || uid$2;
|
|
5015
5026
|
var wellKnownSymbol$b = function (name) {
|
|
@@ -5054,9 +5065,9 @@
|
|
|
5054
5065
|
return isSymbol(key) ? key : key + '';
|
|
5055
5066
|
};
|
|
5056
5067
|
|
|
5057
|
-
var global$
|
|
5068
|
+
var global$6 = global$d;
|
|
5058
5069
|
var isObject$a = isObject$d;
|
|
5059
|
-
var document$1 = global$
|
|
5070
|
+
var document$1 = global$6.document;
|
|
5060
5071
|
// typeof document.createElement is 'object' in old IE
|
|
5061
5072
|
var EXISTS$1 = isObject$a(document$1) && isObject$a(document$1.createElement);
|
|
5062
5073
|
var documentCreateElement$1 = function (it) {
|
|
@@ -5209,9 +5220,9 @@
|
|
|
5209
5220
|
}
|
|
5210
5221
|
var inspectSource$2 = store$3.inspectSource;
|
|
5211
5222
|
|
|
5212
|
-
var global$
|
|
5223
|
+
var global$5 = global$d;
|
|
5213
5224
|
var isCallable$b = isCallable$i;
|
|
5214
|
-
var WeakMap$2 = global$
|
|
5225
|
+
var WeakMap$2 = global$5.WeakMap;
|
|
5215
5226
|
var weakMapBasicDetection = isCallable$b(WeakMap$2) && /native code/.test(String(WeakMap$2));
|
|
5216
5227
|
|
|
5217
5228
|
var shared$2 = sharedExports;
|
|
@@ -5224,7 +5235,7 @@
|
|
|
5224
5235
|
var hiddenKeys$5 = {};
|
|
5225
5236
|
|
|
5226
5237
|
var NATIVE_WEAK_MAP$1 = weakMapBasicDetection;
|
|
5227
|
-
var global$
|
|
5238
|
+
var global$4 = global$d;
|
|
5228
5239
|
var isObject$8 = isObject$d;
|
|
5229
5240
|
var createNonEnumerableProperty$2 = createNonEnumerableProperty$3;
|
|
5230
5241
|
var hasOwn$7 = hasOwnProperty_1;
|
|
@@ -5232,8 +5243,8 @@
|
|
|
5232
5243
|
var sharedKey$2 = sharedKey$3;
|
|
5233
5244
|
var hiddenKeys$4 = hiddenKeys$5;
|
|
5234
5245
|
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
5235
|
-
var TypeError$1 = global$
|
|
5236
|
-
var WeakMap$1 = global$
|
|
5246
|
+
var TypeError$1 = global$4.TypeError;
|
|
5247
|
+
var WeakMap$1 = global$4.WeakMap;
|
|
5237
5248
|
var set, get$2, has;
|
|
5238
5249
|
var enforce = function (it) {
|
|
5239
5250
|
return has(it) ? get$2(it) : set(it, {});
|
|
@@ -5544,7 +5555,7 @@
|
|
|
5544
5555
|
var POLYFILL = isForced$2.POLYFILL = 'P';
|
|
5545
5556
|
var isForced_1 = isForced$2;
|
|
5546
5557
|
|
|
5547
|
-
var global$
|
|
5558
|
+
var global$3 = global$d;
|
|
5548
5559
|
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
5549
5560
|
var createNonEnumerableProperty$1 = createNonEnumerableProperty$3;
|
|
5550
5561
|
var defineBuiltIn$4 = defineBuiltIn$5;
|
|
@@ -5573,11 +5584,11 @@
|
|
|
5573
5584
|
var STATIC = options.stat;
|
|
5574
5585
|
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
|
5575
5586
|
if (GLOBAL) {
|
|
5576
|
-
target = global$
|
|
5587
|
+
target = global$3;
|
|
5577
5588
|
} else if (STATIC) {
|
|
5578
|
-
target = global$
|
|
5589
|
+
target = global$3[TARGET] || defineGlobalProperty(TARGET, {});
|
|
5579
5590
|
} else {
|
|
5580
|
-
target = (global$
|
|
5591
|
+
target = (global$3[TARGET] || {}).prototype;
|
|
5581
5592
|
}
|
|
5582
5593
|
if (target) for (key in source) {
|
|
5583
5594
|
sourceProperty = source[key];
|
|
@@ -6079,7 +6090,7 @@
|
|
|
6079
6090
|
};
|
|
6080
6091
|
|
|
6081
6092
|
var $$a = _export;
|
|
6082
|
-
var global$
|
|
6093
|
+
var global$2 = global$d;
|
|
6083
6094
|
var uncurryThis$9 = functionUncurryThis;
|
|
6084
6095
|
var isForced = isForced_1;
|
|
6085
6096
|
var defineBuiltIn$3 = defineBuiltIn$5;
|
|
@@ -6097,7 +6108,7 @@
|
|
|
6097
6108
|
var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
|
|
6098
6109
|
var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
|
|
6099
6110
|
var ADDER = IS_MAP ? 'set' : 'add';
|
|
6100
|
-
var NativeConstructor = global$
|
|
6111
|
+
var NativeConstructor = global$2[CONSTRUCTOR_NAME];
|
|
6101
6112
|
var NativePrototype = NativeConstructor && NativeConstructor.prototype;
|
|
6102
6113
|
var Constructor = NativeConstructor;
|
|
6103
6114
|
var exported = {};
|
|
@@ -7043,7 +7054,7 @@
|
|
|
7043
7054
|
};
|
|
7044
7055
|
|
|
7045
7056
|
var FREEZING = freezing;
|
|
7046
|
-
var global$
|
|
7057
|
+
var global$1 = global$d;
|
|
7047
7058
|
var uncurryThis$5 = functionUncurryThis;
|
|
7048
7059
|
var defineBuiltIns = defineBuiltIns$3;
|
|
7049
7060
|
var InternalMetadataModule = internalMetadataExports;
|
|
@@ -7068,7 +7079,7 @@
|
|
|
7068
7079
|
var seal = $Object.seal;
|
|
7069
7080
|
var FROZEN = {};
|
|
7070
7081
|
var SEALED = {};
|
|
7071
|
-
var IS_IE11 = !global$
|
|
7082
|
+
var IS_IE11 = !global$1.ActiveXObject && 'ActiveXObject' in global$1;
|
|
7072
7083
|
var InternalWeakMap;
|
|
7073
7084
|
var wrapper = function (init) {
|
|
7074
7085
|
return function WeakMap() {
|
|
@@ -10508,7 +10519,7 @@
|
|
|
10508
10519
|
}
|
|
10509
10520
|
|
|
10510
10521
|
const EnvContribution = Symbol.for("EnvContribution");
|
|
10511
|
-
const
|
|
10522
|
+
const VGlobal = Symbol.for("VGlobal");
|
|
10512
10523
|
|
|
10513
10524
|
var __decorate$1J = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
10514
10525
|
var d,
|
|
@@ -10634,6 +10645,12 @@
|
|
|
10634
10645
|
loadBlob(url) {
|
|
10635
10646
|
return this._env || this.setEnv("browser"), this.envContribution.loadBlob(url);
|
|
10636
10647
|
}
|
|
10648
|
+
isChrome() {
|
|
10649
|
+
return this._env || this.setEnv("browser"), "browser" === this._env && navigator.userAgent.indexOf("Chrome") > -1;
|
|
10650
|
+
}
|
|
10651
|
+
isSafari() {
|
|
10652
|
+
return this._env || this.setEnv("browser"), "browser" === this._env && /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent);
|
|
10653
|
+
}
|
|
10637
10654
|
};
|
|
10638
10655
|
DefaultGlobal = __decorate$1J([injectable(), __param$S(0, inject(ContributionProvider)), __param$S(0, named(EnvContribution)), __metadata$15("design:paramtypes", [Object])], DefaultGlobal);
|
|
10639
10656
|
|
|
@@ -11014,24 +11031,24 @@
|
|
|
11014
11031
|
init(curveType, direction) {
|
|
11015
11032
|
this._lastX = this._lastY = this._startX = this._startY = 0, this.curveType = curveType, this.direction = direction, this.curves = [];
|
|
11016
11033
|
}
|
|
11017
|
-
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, defined) {
|
|
11034
|
+
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, defined, p) {
|
|
11018
11035
|
const curve = new CubicBezierCurve(new Point(this._lastX, this._lastY), new Point(cp1x, cp1y), new Point(cp2x, cp2y), new Point(x, y));
|
|
11019
|
-
curve.defined = defined, this.curves.push(curve), this._lastX = x, this._lastY = y;
|
|
11036
|
+
curve.originP1 = this._lastOriginP, curve.originP2 = p, curve.defined = defined, this.curves.push(curve), this._lastX = x, this._lastY = y, this._lastOriginP = p;
|
|
11020
11037
|
}
|
|
11021
11038
|
closePath() {
|
|
11022
11039
|
if (this.curves.length < 2) return;
|
|
11023
11040
|
const lastCurve = this.curves[this.curves.length - 1];
|
|
11024
|
-
this.lineTo(this._startX, this._startY, lastCurve.defined);
|
|
11041
|
+
this.lineTo(this._startX, this._startY, lastCurve.defined, this._startOriginP);
|
|
11025
11042
|
}
|
|
11026
11043
|
ellipse() {
|
|
11027
11044
|
throw new Error("SegContext不支持调用ellipse");
|
|
11028
11045
|
}
|
|
11029
|
-
lineTo(x, y, defined) {
|
|
11030
|
-
const curve = this.addLinearCurve(x, y, defined);
|
|
11031
|
-
this.curves.push(curve), this._lastX = x, this._lastY = y;
|
|
11046
|
+
lineTo(x, y, defined, p) {
|
|
11047
|
+
const curve = this.addLinearCurve(x, y, defined, this._lastOriginP, p);
|
|
11048
|
+
this.curves.push(curve), this._lastX = x, this._lastY = y, this._lastOriginP = p;
|
|
11032
11049
|
}
|
|
11033
|
-
moveTo(x, y) {
|
|
11034
|
-
return this._lastX = this._startX = x, this._lastY = this._startY = y, this;
|
|
11050
|
+
moveTo(x, y, p) {
|
|
11051
|
+
return this._lastX = this._startX = x, this._lastY = this._startY = y, this._lastOriginP = p, this._startOriginP = p, this;
|
|
11035
11052
|
}
|
|
11036
11053
|
quadraticCurveTo(cpx, cpy, x, y) {
|
|
11037
11054
|
throw new Error("SegContext不支持调用quadraticCurveTo");
|
|
@@ -11042,9 +11059,9 @@
|
|
|
11042
11059
|
tryUpdateLength(direction) {
|
|
11043
11060
|
return this.getLength(direction);
|
|
11044
11061
|
}
|
|
11045
|
-
addLinearCurve(x, y, defined) {
|
|
11062
|
+
addLinearCurve(x, y, defined, p1, p2) {
|
|
11046
11063
|
const curve = new LineCurve(new Point(this._lastX, this._lastY), new Point(x, y));
|
|
11047
|
-
return curve.defined = defined, curve;
|
|
11064
|
+
return curve.originP1 = p1, curve.originP2 = p2, curve.defined = defined, curve;
|
|
11048
11065
|
}
|
|
11049
11066
|
getPointAt(t) {
|
|
11050
11067
|
throw new Error("暂未实现");
|
|
@@ -11053,30 +11070,33 @@
|
|
|
11053
11070
|
return [];
|
|
11054
11071
|
}
|
|
11055
11072
|
getLength(direction) {
|
|
11073
|
+
var _a, _b;
|
|
11056
11074
|
if (direction === Direction$1.COLUMN) {
|
|
11057
11075
|
if (!this.curves.length) return 0;
|
|
11058
11076
|
const sc = this.curves[0],
|
|
11059
|
-
ec = this.curves[this.curves.length - 1]
|
|
11060
|
-
|
|
11077
|
+
ec = this.curves[this.curves.length - 1],
|
|
11078
|
+
endP = null !== (_a = ec.p3) && void 0 !== _a ? _a : ec.p1;
|
|
11079
|
+
return abs$1(sc.p0.y - endP.y);
|
|
11061
11080
|
}
|
|
11062
11081
|
if (direction === Direction$1.ROW) {
|
|
11063
11082
|
if (!this.curves.length) return 0;
|
|
11064
11083
|
const sc = this.curves[0],
|
|
11065
|
-
ec = this.curves[this.curves.length - 1]
|
|
11066
|
-
|
|
11084
|
+
ec = this.curves[this.curves.length - 1],
|
|
11085
|
+
endP = null !== (_b = ec.p3) && void 0 !== _b ? _b : ec.p1;
|
|
11086
|
+
return abs$1(sc.p0.x - endP.x);
|
|
11067
11087
|
}
|
|
11068
11088
|
return Number.isFinite(this.length) || (this.length = this.curves.reduce((l, c) => l + c.getLength(), 0)), this.length;
|
|
11069
11089
|
}
|
|
11070
11090
|
}
|
|
11071
11091
|
class ReflectSegContext extends SegContext {
|
|
11072
|
-
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, defined) {
|
|
11073
|
-
return super.bezierCurveTo(cp1y, cp1x, cp2y, cp2x, y, x, defined);
|
|
11092
|
+
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, defined, p) {
|
|
11093
|
+
return super.bezierCurveTo(cp1y, cp1x, cp2y, cp2x, y, x, defined, p);
|
|
11074
11094
|
}
|
|
11075
|
-
lineTo(x, y, defined) {
|
|
11076
|
-
return super.lineTo(y, x, defined);
|
|
11095
|
+
lineTo(x, y, defined, p) {
|
|
11096
|
+
return super.lineTo(y, x, defined, p);
|
|
11077
11097
|
}
|
|
11078
|
-
moveTo(x, y) {
|
|
11079
|
-
return super.moveTo(y, x);
|
|
11098
|
+
moveTo(x, y, p) {
|
|
11099
|
+
return super.moveTo(y, x, p);
|
|
11080
11100
|
}
|
|
11081
11101
|
clear() {
|
|
11082
11102
|
return super.clear();
|
|
@@ -11109,12 +11129,12 @@
|
|
|
11109
11129
|
y = p.y;
|
|
11110
11130
|
switch (this._point) {
|
|
11111
11131
|
case 0:
|
|
11112
|
-
this._point = 1, this._line ? this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined) : this.context.moveTo(x, y);
|
|
11132
|
+
this._point = 1, this._line ? this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p) : this.context.moveTo(x, y, p);
|
|
11113
11133
|
break;
|
|
11114
11134
|
case 1:
|
|
11115
11135
|
this._point = 2;
|
|
11116
11136
|
default:
|
|
11117
|
-
this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined);
|
|
11137
|
+
this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p);
|
|
11118
11138
|
}
|
|
11119
11139
|
this._lastDefined = p.defined;
|
|
11120
11140
|
}
|
|
@@ -11136,8 +11156,8 @@
|
|
|
11136
11156
|
return genCurveSegments(path, points);
|
|
11137
11157
|
}
|
|
11138
11158
|
|
|
11139
|
-
function point$2(curveClass, x, y, defined) {
|
|
11140
|
-
curveClass.context.bezierCurveTo((2 * curveClass._x0 + curveClass._x1) / 3, (2 * curveClass._y0 + curveClass._y1) / 3, (curveClass._x0 + 2 * curveClass._x1) / 3, (curveClass._y0 + 2 * curveClass._y1) / 3, (curveClass._x0 + 4 * curveClass._x1 + x) / 6, (curveClass._y0 + 4 * curveClass._y1 + y) / 6, defined);
|
|
11159
|
+
function point$2(curveClass, x, y, defined, p) {
|
|
11160
|
+
curveClass.context.bezierCurveTo((2 * curveClass._x0 + curveClass._x1) / 3, (2 * curveClass._y0 + curveClass._y1) / 3, (curveClass._x0 + 2 * curveClass._x1) / 3, (curveClass._y0 + 2 * curveClass._y1) / 3, (curveClass._x0 + 4 * curveClass._x1 + x) / 6, (curveClass._y0 + 4 * curveClass._y1 + y) / 6, defined, curveClass.lastPoint1);
|
|
11141
11161
|
}
|
|
11142
11162
|
class Basis {
|
|
11143
11163
|
constructor(context, startPoint) {
|
|
@@ -11153,7 +11173,7 @@
|
|
|
11153
11173
|
this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0, this.startPoint && this.point(this.startPoint);
|
|
11154
11174
|
}
|
|
11155
11175
|
lineEnd() {
|
|
11156
|
-
if (2 === this._point) point$2(this, 6 * this._x1 - (this._x0 + 4 * this._x1), 6 * this._y1 - (this._y0 + 4 * this._y1), !1 !== this._lastDefined1 && !1 !== this._lastDefined2);
|
|
11176
|
+
if (2 === this._point) point$2(this, 6 * this._x1 - (this._x0 + 4 * this._x1), 6 * this._y1 - (this._y0 + 4 * this._y1), !1 !== this._lastDefined1 && !1 !== this._lastDefined2, this.lastPoint1);
|
|
11157
11177
|
(this._line || 0 !== this._line && 1 === this._point) && this.context.closePath(), this._line = 1 - this._line;
|
|
11158
11178
|
}
|
|
11159
11179
|
point(p) {
|
|
@@ -11161,7 +11181,7 @@
|
|
|
11161
11181
|
y = p.y;
|
|
11162
11182
|
switch (this._point) {
|
|
11163
11183
|
case 0:
|
|
11164
|
-
this._point = 1, this._line ? this.context.lineTo(x, y, !1 !== this._lastDefined1 && !1 !== this._lastDefined2) : this.context.moveTo(x, y);
|
|
11184
|
+
this._point = 1, this._line ? this.context.lineTo(x, y, !1 !== this._lastDefined1 && !1 !== this._lastDefined2, p) : this.context.moveTo(x, y, p);
|
|
11165
11185
|
break;
|
|
11166
11186
|
case 1:
|
|
11167
11187
|
this._point = 2;
|
|
@@ -11169,7 +11189,7 @@
|
|
|
11169
11189
|
default:
|
|
11170
11190
|
point$2(this, x, y, !1 !== this._lastDefined1 && !1 !== this._lastDefined2);
|
|
11171
11191
|
}
|
|
11172
|
-
this._x0 = this._x1, this._x1 = x, this._y0 = this._y1, this._y1 = y, this._lastDefined1 = this._lastDefined2, this._lastDefined2 = p.defined;
|
|
11192
|
+
this._x0 = this._x1, this._x1 = x, this._y0 = this._y1, this._y1 = y, this._lastDefined1 = this._lastDefined2, this._lastDefined2 = p.defined, this.lastPoint0 = this.lastPoint1, this.lastPoint1 = p;
|
|
11173
11193
|
}
|
|
11174
11194
|
tryUpdateLength() {
|
|
11175
11195
|
return this.context.tryUpdateLength();
|
|
@@ -11205,13 +11225,13 @@
|
|
|
11205
11225
|
const h = curveClass._x1 - curveClass._x0;
|
|
11206
11226
|
return h ? (3 * (curveClass._y1 - curveClass._y0) / h - t) / 2 : t;
|
|
11207
11227
|
}
|
|
11208
|
-
function point$1(curveClass, t0, t1, defined) {
|
|
11228
|
+
function point$1(curveClass, t0, t1, defined, p) {
|
|
11209
11229
|
const x0 = curveClass._x0,
|
|
11210
11230
|
y0 = curveClass._y0,
|
|
11211
11231
|
x1 = curveClass._x1,
|
|
11212
11232
|
y1 = curveClass._y1,
|
|
11213
11233
|
dx = (x1 - x0) / 3;
|
|
11214
|
-
curveClass.context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1, defined);
|
|
11234
|
+
curveClass.context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1, defined, curveClass.lastPoint1);
|
|
11215
11235
|
}
|
|
11216
11236
|
class MonotoneX {
|
|
11217
11237
|
constructor(context, startPoint) {
|
|
@@ -11229,10 +11249,10 @@
|
|
|
11229
11249
|
lineEnd() {
|
|
11230
11250
|
switch (this._point) {
|
|
11231
11251
|
case 2:
|
|
11232
|
-
this.context.lineTo(this._x1, this._y1, !1 !== this._lastDefined2);
|
|
11252
|
+
this.context.lineTo(this._x1, this._y1, !1 !== this._lastDefined2, this.lastPoint1);
|
|
11233
11253
|
break;
|
|
11234
11254
|
case 3:
|
|
11235
|
-
point$1(this, this._t0, slope2(this, this._t0), !1 !== this._lastDefined2);
|
|
11255
|
+
point$1(this, this._t0, slope2(this, this._t0), !1 !== this._lastDefined2, this.lastPoint1);
|
|
11236
11256
|
}
|
|
11237
11257
|
(this._line || 0 !== this._line && 1 === this._point) && this.context.closePath(), this._line = 1 - this._line;
|
|
11238
11258
|
}
|
|
@@ -11243,7 +11263,7 @@
|
|
|
11243
11263
|
if (x !== this._x1 || y !== this._y1) {
|
|
11244
11264
|
switch (this._point) {
|
|
11245
11265
|
case 0:
|
|
11246
|
-
this._point = 1, this._line ? this.context.lineTo(x, y, !1 !== this._lastDefined1 && !1 !== this._lastDefined2) : this.context.moveTo(x, y);
|
|
11266
|
+
this._point = 1, this._line ? this.context.lineTo(x, y, !1 !== this._lastDefined1 && !1 !== this._lastDefined2, p) : this.context.moveTo(x, y, p);
|
|
11247
11267
|
break;
|
|
11248
11268
|
case 1:
|
|
11249
11269
|
this._point = 2;
|
|
@@ -11254,7 +11274,7 @@
|
|
|
11254
11274
|
default:
|
|
11255
11275
|
point$1(this, this._t0, t1 = slope3(this, x, y), !1 !== this._lastDefined1 && !1 !== this._lastDefined2);
|
|
11256
11276
|
}
|
|
11257
|
-
this._x0 = this._x1, this._x1 = x, this._y0 = this._y1, this._y1 = y, this._t0 = t1, this._lastDefined1 = this._lastDefined2, this._lastDefined2 = !1 !== p.defined;
|
|
11277
|
+
this._x0 = this._x1, this._x1 = x, this._y0 = this._y1, this._y1 = y, this._t0 = t1, this._lastDefined1 = this._lastDefined2, this._lastDefined2 = !1 !== p.defined, this.lastPoint0 = this.lastPoint1, this.lastPoint1 = p;
|
|
11258
11278
|
}
|
|
11259
11279
|
}
|
|
11260
11280
|
tryUpdateLength() {
|
|
@@ -11318,24 +11338,24 @@
|
|
|
11318
11338
|
this._x = this._y = NaN, this._point = 0, this.startPoint && this.point(this.startPoint);
|
|
11319
11339
|
}
|
|
11320
11340
|
lineEnd() {
|
|
11321
|
-
0 < this._t && this._t < 1 && 2 === this._point && this.context.lineTo(this._x, this._y, !1 !== this._lastDefined), (this._line || 0 !== this._line && 1 === this._point) && this.context.closePath(), this._line >= 0 && (this._t = 1 - this._t, this._line = 1 - this._line);
|
|
11341
|
+
0 < this._t && this._t < 1 && 2 === this._point && this.context.lineTo(this._x, this._y, !1 !== this._lastDefined, this.lastPoint), (this._line || 0 !== this._line && 1 === this._point) && this.context.closePath(), this._line >= 0 && (this._t = 1 - this._t, this._line = 1 - this._line);
|
|
11322
11342
|
}
|
|
11323
11343
|
point(p) {
|
|
11324
11344
|
const x = p.x,
|
|
11325
11345
|
y = p.y;
|
|
11326
11346
|
switch (this._point) {
|
|
11327
11347
|
case 0:
|
|
11328
|
-
this._point = 1, this._line ? this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined) : this.context.moveTo(x, y);
|
|
11348
|
+
this._point = 1, this._line ? this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p) : this.context.moveTo(x, y, p);
|
|
11329
11349
|
break;
|
|
11330
11350
|
case 1:
|
|
11331
11351
|
this._point = 2;
|
|
11332
11352
|
default:
|
|
11333
|
-
if (this._t <= 0) this.context.lineTo(this._x, y, !1 !== this._lastDefined && !1 !== p.defined), this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined);else {
|
|
11353
|
+
if (this._t <= 0) this.context.lineTo(this._x, y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p);else {
|
|
11334
11354
|
const x1 = this._x * (1 - this._t) + x * this._t;
|
|
11335
|
-
this.context.lineTo(x1, this._y, !1 !== this._lastDefined && !1 !== p.defined), this.context.lineTo(x1, y, !1 !== this._lastDefined && !1 !== p.defined);
|
|
11355
|
+
this.context.lineTo(x1, this._y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x1, y, !1 !== this._lastDefined && !1 !== p.defined, p);
|
|
11336
11356
|
}
|
|
11337
11357
|
}
|
|
11338
|
-
this._lastDefined = p.defined, this._x = x, this._y = y;
|
|
11358
|
+
this._lastDefined = p.defined, this._x = x, this._y = y, this.lastPoint = p;
|
|
11339
11359
|
}
|
|
11340
11360
|
tryUpdateLength() {
|
|
11341
11361
|
return this.context.tryUpdateLength();
|
|
@@ -11376,12 +11396,12 @@
|
|
|
11376
11396
|
y = p.y;
|
|
11377
11397
|
switch (this._point) {
|
|
11378
11398
|
case 0:
|
|
11379
|
-
this._point = 1, this._line ? this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined) : this.context.moveTo(x, y);
|
|
11399
|
+
this._point = 1, this._line ? this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p) : this.context.moveTo(x, y, p);
|
|
11380
11400
|
break;
|
|
11381
11401
|
case 1:
|
|
11382
11402
|
this._point = 2;
|
|
11383
11403
|
default:
|
|
11384
|
-
this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined);
|
|
11404
|
+
this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p);
|
|
11385
11405
|
}
|
|
11386
11406
|
this._lastDefined = p.defined;
|
|
11387
11407
|
}
|
|
@@ -11701,6 +11721,9 @@
|
|
|
11701
11721
|
return temp$1;
|
|
11702
11722
|
}
|
|
11703
11723
|
|
|
11724
|
+
const DefaultLayout = {
|
|
11725
|
+
alignSelf: "auto"
|
|
11726
|
+
};
|
|
11704
11727
|
const DefaultTransform = {
|
|
11705
11728
|
x: 0,
|
|
11706
11729
|
y: 0,
|
|
@@ -11761,9 +11784,11 @@
|
|
|
11761
11784
|
lineHeight: void 0,
|
|
11762
11785
|
underline: 0,
|
|
11763
11786
|
lineThrough: 0,
|
|
11764
|
-
scaleIn3d: !1
|
|
11787
|
+
scaleIn3d: !1,
|
|
11788
|
+
direction: "horizontal",
|
|
11789
|
+
wordBreak: "break-all"
|
|
11765
11790
|
};
|
|
11766
|
-
const DefaultStyle = Object.assign(Object.assign({
|
|
11791
|
+
const DefaultStyle = Object.assign(Object.assign(Object.assign({
|
|
11767
11792
|
opacity: 1,
|
|
11768
11793
|
background: null,
|
|
11769
11794
|
texture: null,
|
|
@@ -11773,7 +11798,13 @@
|
|
|
11773
11798
|
backgroundMode: 0,
|
|
11774
11799
|
blur: 0,
|
|
11775
11800
|
cursor: null
|
|
11776
|
-
}, DefaultFillStyle), DefaultStrokeStyle);
|
|
11801
|
+
}, DefaultFillStyle), DefaultStrokeStyle), DefaultLayout);
|
|
11802
|
+
const DefaultConnectAttribute = {
|
|
11803
|
+
connectedType: "none",
|
|
11804
|
+
connectedStyle: {},
|
|
11805
|
+
connectedX: NaN,
|
|
11806
|
+
connectedY: NaN
|
|
11807
|
+
};
|
|
11777
11808
|
const DefaultAttribute = Object.assign(Object.assign({
|
|
11778
11809
|
strokeSeg: null,
|
|
11779
11810
|
pickable: !0,
|
|
@@ -11798,7 +11829,7 @@
|
|
|
11798
11829
|
cap: !1,
|
|
11799
11830
|
forceShowCap: !1
|
|
11800
11831
|
});
|
|
11801
|
-
const DefaultAreaAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
|
|
11832
|
+
const DefaultAreaAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultConnectAttribute), {
|
|
11802
11833
|
points: [],
|
|
11803
11834
|
segments: [],
|
|
11804
11835
|
curveType: "linear",
|
|
@@ -11815,7 +11846,13 @@
|
|
|
11815
11846
|
cornerRadius: 0,
|
|
11816
11847
|
path: [],
|
|
11817
11848
|
clip: !1,
|
|
11818
|
-
visibleAll: !0
|
|
11849
|
+
visibleAll: !0,
|
|
11850
|
+
display: "relative",
|
|
11851
|
+
flexDirection: "row",
|
|
11852
|
+
flexWrap: "wrap",
|
|
11853
|
+
justifyContent: "flex-start",
|
|
11854
|
+
alignItems: "flex-start",
|
|
11855
|
+
alignContent: "flex-start"
|
|
11819
11856
|
});
|
|
11820
11857
|
const DefaultGlyphAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
|
|
11821
11858
|
path: "",
|
|
@@ -11824,7 +11861,7 @@
|
|
|
11824
11861
|
cornerRadius: 0,
|
|
11825
11862
|
clip: !1
|
|
11826
11863
|
});
|
|
11827
|
-
const DefaultLineAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
|
|
11864
|
+
const DefaultLineAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultConnectAttribute), {
|
|
11828
11865
|
points: [],
|
|
11829
11866
|
segments: [],
|
|
11830
11867
|
curveType: "linear",
|
|
@@ -11904,6 +11941,119 @@
|
|
|
11904
11941
|
opacity: 1
|
|
11905
11942
|
});
|
|
11906
11943
|
|
|
11944
|
+
class Application {}
|
|
11945
|
+
const application = new Application();
|
|
11946
|
+
|
|
11947
|
+
const DIRECTION_KEY$1 = {
|
|
11948
|
+
horizontal: {
|
|
11949
|
+
width: "width",
|
|
11950
|
+
height: "height",
|
|
11951
|
+
left: "left",
|
|
11952
|
+
top: "top",
|
|
11953
|
+
x: "x",
|
|
11954
|
+
y: "y",
|
|
11955
|
+
bottom: "bottom"
|
|
11956
|
+
},
|
|
11957
|
+
vertical: {
|
|
11958
|
+
width: "height",
|
|
11959
|
+
height: "width",
|
|
11960
|
+
left: "top",
|
|
11961
|
+
top: "left",
|
|
11962
|
+
x: "y",
|
|
11963
|
+
y: "x",
|
|
11964
|
+
bottom: "right"
|
|
11965
|
+
}
|
|
11966
|
+
};
|
|
11967
|
+
const defaultFormatting = {
|
|
11968
|
+
fontSize: 16,
|
|
11969
|
+
fontFamily: "sans-serif",
|
|
11970
|
+
fill: !0,
|
|
11971
|
+
stroke: !1,
|
|
11972
|
+
fontWeight: "normal",
|
|
11973
|
+
lineHeight: "normal",
|
|
11974
|
+
fontStyle: "normal",
|
|
11975
|
+
textDecoration: "none",
|
|
11976
|
+
textAlign: "left",
|
|
11977
|
+
script: "normal"
|
|
11978
|
+
};
|
|
11979
|
+
const regLetter = /\w|\(|\)/;
|
|
11980
|
+
const regPunctuation = /[.?!,;:/,。?!、;:]/;
|
|
11981
|
+
const regFirstSpace = /\S/;
|
|
11982
|
+
function applyFillStyle(ctx, character) {
|
|
11983
|
+
const fillStyle = character && character.fill || defaultFormatting.fill;
|
|
11984
|
+
if (!fillStyle) return void (ctx.globalAlpha = 0);
|
|
11985
|
+
ctx.globalAlpha = 1, ctx.fillStyle = fillStyle;
|
|
11986
|
+
let fontSize = character.fontSize || 16;
|
|
11987
|
+
switch (character.script) {
|
|
11988
|
+
case "super":
|
|
11989
|
+
case "sub":
|
|
11990
|
+
fontSize *= .8;
|
|
11991
|
+
}
|
|
11992
|
+
ctx.setTextStyle({
|
|
11993
|
+
textAlign: "left",
|
|
11994
|
+
textBaseline: character.textBaseline || "alphabetic",
|
|
11995
|
+
fontStyle: character.fontStyle || "",
|
|
11996
|
+
fontWeight: character.fontWeight || "",
|
|
11997
|
+
fontSize: fontSize,
|
|
11998
|
+
fontFamily: character.fontFamily || "sans-serif"
|
|
11999
|
+
});
|
|
12000
|
+
}
|
|
12001
|
+
function applyStrokeStyle(ctx, character) {
|
|
12002
|
+
const strokeStyle = character && character.stroke || defaultFormatting.stroke;
|
|
12003
|
+
if (!strokeStyle) return void (ctx.globalAlpha = 0);
|
|
12004
|
+
ctx.globalAlpha = 1, ctx.lineWidth = 1, ctx.strokeStyle = strokeStyle;
|
|
12005
|
+
let fontSize = character.fontSize || 16;
|
|
12006
|
+
switch (character.script) {
|
|
12007
|
+
case "super":
|
|
12008
|
+
case "sub":
|
|
12009
|
+
fontSize *= .8;
|
|
12010
|
+
}
|
|
12011
|
+
ctx.setTextStyle({
|
|
12012
|
+
textAlign: "left",
|
|
12013
|
+
textBaseline: character.textBaseline || "alphabetic",
|
|
12014
|
+
fontStyle: character.fontStyle || "",
|
|
12015
|
+
fontWeight: character.fontWeight || "",
|
|
12016
|
+
fontSize: fontSize,
|
|
12017
|
+
fontFamily: character.fontFamily || "sans-serif"
|
|
12018
|
+
});
|
|
12019
|
+
}
|
|
12020
|
+
function getStrByWithCanvas(desc, width, character, guessIndex, needTestLetter) {
|
|
12021
|
+
if (!width || width <= 0) return 0;
|
|
12022
|
+
const textMeasure = application.graphicUtil.textMeasure;
|
|
12023
|
+
let index = guessIndex,
|
|
12024
|
+
temp = desc.slice(0, index),
|
|
12025
|
+
tempWidth = Math.floor(textMeasure.measureText(temp, character).width),
|
|
12026
|
+
tempNext = desc.slice(0, index + 1),
|
|
12027
|
+
tempWidthNext = Math.floor(textMeasure.measureText(tempNext, character).width);
|
|
12028
|
+
for (; tempWidth > width || tempWidthNext <= width;) {
|
|
12029
|
+
if (tempWidth > width ? index-- : index++, index > desc.length) {
|
|
12030
|
+
index = desc.length;
|
|
12031
|
+
break;
|
|
12032
|
+
}
|
|
12033
|
+
if (index < 0) {
|
|
12034
|
+
index = 0;
|
|
12035
|
+
break;
|
|
12036
|
+
}
|
|
12037
|
+
temp = desc.slice(0, index), tempWidth = Math.floor(textMeasure.measureText(temp, character).width), tempNext = desc.slice(0, index + 1), tempWidthNext = Math.floor(textMeasure.measureText(tempNext, character).width);
|
|
12038
|
+
}
|
|
12039
|
+
return needTestLetter && (index = testLetter(desc, index)), index;
|
|
12040
|
+
}
|
|
12041
|
+
function testLetter(string, index) {
|
|
12042
|
+
let i = index;
|
|
12043
|
+
for (; regLetter.test(string[i - 1]) && regLetter.test(string[i]) || regPunctuation.test(string[i]);) if (i--, i <= 0) return index;
|
|
12044
|
+
return i;
|
|
12045
|
+
}
|
|
12046
|
+
function measureTextCanvas(text, character) {
|
|
12047
|
+
const measurement = application.graphicUtil.textMeasure.measureText(text, character),
|
|
12048
|
+
result = {
|
|
12049
|
+
ascent: 0,
|
|
12050
|
+
height: 0,
|
|
12051
|
+
descent: 0,
|
|
12052
|
+
width: 0
|
|
12053
|
+
};
|
|
12054
|
+
return "number" != typeof measurement.actualBoundingBoxAscent || "number" != typeof measurement.actualBoundingBoxDescent ? (result.width = Math.floor(measurement.width), result.height = character.fontSize || 0, result.ascent = result.height, result.descent = 0) : (result.width = Math.floor(measurement.width), result.height = Math.floor(measurement.actualBoundingBoxAscent + measurement.actualBoundingBoxDescent), result.ascent = Math.floor(measurement.actualBoundingBoxAscent), result.descent = result.height - result.ascent), result;
|
|
12055
|
+
}
|
|
12056
|
+
|
|
11907
12057
|
var __decorate$1I = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
11908
12058
|
var d,
|
|
11909
12059
|
c = arguments.length,
|
|
@@ -11949,19 +12099,65 @@
|
|
|
11949
12099
|
measureText(text, options) {
|
|
11950
12100
|
return this.context ? (this.context.setTextStyleWithoutAlignBaseline(options), this.context.measureText(text)) : this.estimate(text, options);
|
|
11951
12101
|
}
|
|
11952
|
-
|
|
12102
|
+
clipTextVertical(verticalList, options, width, wordBreak) {
|
|
12103
|
+
if (0 === verticalList.length) return {
|
|
12104
|
+
verticalList: verticalList,
|
|
12105
|
+
width: 0
|
|
12106
|
+
};
|
|
12107
|
+
const {
|
|
12108
|
+
fontSize = 12
|
|
12109
|
+
} = options;
|
|
12110
|
+
verticalList.forEach(item => {
|
|
12111
|
+
item.width = 0 === item.direction ? fontSize : this.measureTextWidth(item.text, options);
|
|
12112
|
+
});
|
|
12113
|
+
const out = [];
|
|
12114
|
+
let length = 0,
|
|
12115
|
+
i = 0;
|
|
12116
|
+
for (; i < verticalList.length && length + verticalList[i].width < width; i++) length += verticalList[i].width, out.push(verticalList[i]);
|
|
12117
|
+
if (verticalList[i] && verticalList[i].text.length > 1) {
|
|
12118
|
+
const clipedData = this._clipText(verticalList[i].text, options, width - length, 0, verticalList[i].text.length - 1);
|
|
12119
|
+
if (wordBreak && clipedData.str !== verticalList[i].text) {
|
|
12120
|
+
let text = "",
|
|
12121
|
+
length = 0;
|
|
12122
|
+
for (let j = 0; j < i; j++) {
|
|
12123
|
+
const item = verticalList[j];
|
|
12124
|
+
text += item.text, length += item.text.length;
|
|
12125
|
+
}
|
|
12126
|
+
text += verticalList[i].text;
|
|
12127
|
+
const totalLength = length + clipedData.str.length;
|
|
12128
|
+
let index = testLetter(text, totalLength);
|
|
12129
|
+
index -= length, index !== clipedData.str.length - 1 && (clipedData.str = clipedData.str.substring(0, index), clipedData.width = this.measureTextWidth(clipedData.str, options));
|
|
12130
|
+
}
|
|
12131
|
+
out.push(Object.assign(Object.assign({}, verticalList[i]), {
|
|
12132
|
+
text: clipedData.str,
|
|
12133
|
+
width: clipedData.width
|
|
12134
|
+
})), length += clipedData.width;
|
|
12135
|
+
}
|
|
12136
|
+
return {
|
|
12137
|
+
verticalList: out,
|
|
12138
|
+
width: length
|
|
12139
|
+
};
|
|
12140
|
+
}
|
|
12141
|
+
clipText(text, options, width, wordBreak) {
|
|
11953
12142
|
if (0 === text.length) return {
|
|
11954
12143
|
str: "",
|
|
11955
12144
|
width: 0
|
|
11956
12145
|
};
|
|
11957
12146
|
let length = this.measureTextWidth(text, options);
|
|
11958
|
-
|
|
12147
|
+
if (length <= width) return {
|
|
11959
12148
|
str: text,
|
|
11960
12149
|
width: length
|
|
11961
|
-
}
|
|
12150
|
+
};
|
|
12151
|
+
if (length = this.measureTextWidth(text[0], options), length > width) return {
|
|
11962
12152
|
str: "",
|
|
11963
12153
|
width: 0
|
|
11964
|
-
}
|
|
12154
|
+
};
|
|
12155
|
+
const data = this._clipText(text, options, width, 0, text.length - 1);
|
|
12156
|
+
if (wordBreak && data.str !== text) {
|
|
12157
|
+
const index = testLetter(text, data.str.length);
|
|
12158
|
+
index !== data.str.length && (data.str = text.substring(0, index), data.width = this.measureTextWidth(data.str, options));
|
|
12159
|
+
}
|
|
12160
|
+
return data;
|
|
11965
12161
|
}
|
|
11966
12162
|
_clipText(text, options, width, leftIdx, rightIdx) {
|
|
11967
12163
|
const middleIdx = Math.floor((leftIdx + rightIdx) / 2),
|
|
@@ -11995,8 +12191,26 @@
|
|
|
11995
12191
|
width: strWidth
|
|
11996
12192
|
};
|
|
11997
12193
|
}
|
|
11998
|
-
|
|
11999
|
-
if ("" === suffix) return this.
|
|
12194
|
+
clipTextWithSuffixVertical(verticalList, options, width, suffix, wordBreak) {
|
|
12195
|
+
if ("" === suffix) return this.clipTextVertical(verticalList, options, width, wordBreak);
|
|
12196
|
+
if (0 === verticalList.length) return {
|
|
12197
|
+
verticalList: verticalList,
|
|
12198
|
+
width: 0
|
|
12199
|
+
};
|
|
12200
|
+
const output = this.clipTextVertical(verticalList, options, width, wordBreak);
|
|
12201
|
+
if (output.verticalList.length === verticalList.length && output.verticalList[output.verticalList.length - 1].width === verticalList[verticalList.length - 1].width) return output;
|
|
12202
|
+
const suffixWidth = this.measureTextWidth(suffix, options);
|
|
12203
|
+
if (suffixWidth > width) return output;
|
|
12204
|
+
width -= suffixWidth;
|
|
12205
|
+
const out = this.clipTextVertical(verticalList, options, width, wordBreak);
|
|
12206
|
+
return out.width += suffixWidth, out.verticalList.push({
|
|
12207
|
+
text: suffix,
|
|
12208
|
+
direction: 1,
|
|
12209
|
+
width: suffixWidth
|
|
12210
|
+
}), out;
|
|
12211
|
+
}
|
|
12212
|
+
clipTextWithSuffix(text, options, width, suffix, wordBreak) {
|
|
12213
|
+
if ("" === suffix) return this.clipText(text, options, width, wordBreak);
|
|
12000
12214
|
if (0 === text.length) return {
|
|
12001
12215
|
str: "",
|
|
12002
12216
|
width: 0
|
|
@@ -12013,6 +12227,10 @@
|
|
|
12013
12227
|
};
|
|
12014
12228
|
width -= suffixWidth;
|
|
12015
12229
|
const data = this._clipText(text, options, width, 0, text.length - 1);
|
|
12230
|
+
if (wordBreak && data.str !== text) {
|
|
12231
|
+
const index = testLetter(text, data.str.length);
|
|
12232
|
+
index !== data.str.length && (data.str = text.substring(0, index), data.width = this.measureTextWidth(data.str, options));
|
|
12233
|
+
}
|
|
12016
12234
|
return data.str += suffix, data.width += suffixWidth, data;
|
|
12017
12235
|
}
|
|
12018
12236
|
};
|
|
@@ -12031,9 +12249,6 @@
|
|
|
12031
12249
|
|
|
12032
12250
|
const container = new Container$2();
|
|
12033
12251
|
|
|
12034
|
-
class Application {}
|
|
12035
|
-
const application = new Application();
|
|
12036
|
-
|
|
12037
12252
|
const CanvasFactory = Symbol.for("CanvasFactory");
|
|
12038
12253
|
const Context2dFactory = Symbol.for("Context2dFactory");
|
|
12039
12254
|
|
|
@@ -12462,7 +12677,7 @@
|
|
|
12462
12677
|
}, null != option ? option : {}), textSpec);
|
|
12463
12678
|
}
|
|
12464
12679
|
};
|
|
12465
|
-
DefaultGraphicUtil = __decorate$1G([injectable(), __param$R(0, inject(ContributionProvider)), __param$R(0, named(TextMeasureContribution)), __param$R(1, inject(
|
|
12680
|
+
DefaultGraphicUtil = __decorate$1G([injectable(), __param$R(0, inject(ContributionProvider)), __param$R(0, named(TextMeasureContribution)), __param$R(1, inject(VGlobal)), __metadata$14("design:paramtypes", [Object, Object])], DefaultGraphicUtil);
|
|
12466
12681
|
var TransformMode;
|
|
12467
12682
|
!function (TransformMode) {
|
|
12468
12683
|
TransformMode[TransformMode.transform = 0] = "transform", TransformMode[TransformMode.matrix = 1] = "matrix";
|
|
@@ -13233,13 +13448,14 @@
|
|
|
13233
13448
|
e.propagationStopped = !1, e.propagationImmediatelyStopped = !1, this.propagate(e, type), this.dispatch.emit(type || e.type, e);
|
|
13234
13449
|
}
|
|
13235
13450
|
mapEvent(e) {
|
|
13236
|
-
var _a;
|
|
13451
|
+
var _a, _b, _c, _d, _e;
|
|
13237
13452
|
if (!this.rootTarget) return;
|
|
13238
13453
|
const mappers = this.mappingTable[e.type];
|
|
13239
13454
|
let target;
|
|
13240
13455
|
const cacheKey = `${e.canvasX}-${e.canvasY}`;
|
|
13241
|
-
if ((null === (_a = this._prePointTargetCache) || void 0 === _a ? void 0 : _a[cacheKey]) ? target = this._prePointTargetCache[cacheKey] : (target = this.pickTarget(e.canvasX, e.canvasY), this._prePointTargetCache = {
|
|
13242
|
-
[cacheKey]: target
|
|
13456
|
+
if ((null === (_a = this._prePointTargetCache) || void 0 === _a ? void 0 : _a[cacheKey]) && (null === (_c = null === (_b = this._prePointTargetCache) || void 0 === _b ? void 0 : _b[cacheKey]) || void 0 === _c ? void 0 : _c.stage.renderCount) === (null === (_d = this._prePointTargetCache) || void 0 === _d ? void 0 : _d.stageRenderCount) ? target = this._prePointTargetCache[cacheKey] : (target = this.pickTarget(e.canvasX, e.canvasY), this._prePointTargetCache = {
|
|
13457
|
+
[cacheKey]: target,
|
|
13458
|
+
stageRenderCount: null !== (_e = null == target ? void 0 : target.stage.renderCount) && void 0 !== _e ? _e : -1
|
|
13243
13459
|
}), mappers) for (let i = 0, j = mappers.length; i < j; i++) mappers[i].fn(e, target);else console.warn(`[EventManager]: Event mapping not defined for ${e.type}`);
|
|
13244
13460
|
}
|
|
13245
13461
|
propagate(e, type) {
|
|
@@ -13316,13 +13532,12 @@
|
|
|
13316
13532
|
}
|
|
13317
13533
|
notifyListeners(e, type) {
|
|
13318
13534
|
const listeners = e.currentTarget._events[type];
|
|
13319
|
-
if (listeners) {
|
|
13320
|
-
|
|
13321
|
-
|
|
13322
|
-
|
|
13323
|
-
|
|
13324
|
-
|
|
13325
|
-
} else this.emitDelegation(e, type);
|
|
13535
|
+
if (listeners) if ("fn" in listeners) listeners.once && e.currentTarget.removeEventListener(type, listeners.fn, {
|
|
13536
|
+
once: !0
|
|
13537
|
+
}), listeners.fn.call(listeners.context, e);else for (let i = 0, j = listeners.length; i < j && !e.propagationImmediatelyStopped; i++) listeners[i].once && e.currentTarget.removeEventListener(type, listeners[i].fn, {
|
|
13538
|
+
once: !0
|
|
13539
|
+
}), listeners[i].fn.call(listeners[i].context, e);
|
|
13540
|
+
this.emitDelegation(e, type);
|
|
13326
13541
|
}
|
|
13327
13542
|
emitDelegation(e, type) {
|
|
13328
13543
|
const listeners = e.currentTarget._events[WILDCARD];
|
|
@@ -14824,6 +15039,9 @@
|
|
|
14824
15039
|
} else point.x = dx, point.y = dy;
|
|
14825
15040
|
return point;
|
|
14826
15041
|
}
|
|
15042
|
+
onAnimateBind(animate) {
|
|
15043
|
+
this._emitCustomEvent("animate-bind", animate);
|
|
15044
|
+
}
|
|
14827
15045
|
tryUpdateAABBBounds(full) {
|
|
14828
15046
|
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
14829
15047
|
if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
|
|
@@ -15356,6 +15574,38 @@
|
|
|
15356
15574
|
function genNumberType() {
|
|
15357
15575
|
return NUMBER_TYPE++;
|
|
15358
15576
|
}
|
|
15577
|
+
var TextDirection;
|
|
15578
|
+
!function (TextDirection) {
|
|
15579
|
+
TextDirection[TextDirection.HORIZONTAL = 0] = "HORIZONTAL", TextDirection[TextDirection.VERTICAL = 1] = "VERTICAL";
|
|
15580
|
+
}(TextDirection || (TextDirection = {}));
|
|
15581
|
+
function verticalLayout(text) {
|
|
15582
|
+
const nextCharacter = [];
|
|
15583
|
+
let flag = 0,
|
|
15584
|
+
currStr = "";
|
|
15585
|
+
for (let i = 0; i < text.length; i++) rotateText(text[i]) ? flag ? currStr += text[i] : (flag = 1, currStr = text[i]) : (flag && (nextCharacter.push({
|
|
15586
|
+
text: currStr,
|
|
15587
|
+
direction: TextDirection.VERTICAL
|
|
15588
|
+
}), currStr = "", flag = 0), nextCharacter.push({
|
|
15589
|
+
text: text[i],
|
|
15590
|
+
direction: TextDirection.HORIZONTAL
|
|
15591
|
+
}));
|
|
15592
|
+
return currStr && nextCharacter.push({
|
|
15593
|
+
text: currStr,
|
|
15594
|
+
direction: TextDirection.VERTICAL
|
|
15595
|
+
}), nextCharacter;
|
|
15596
|
+
}
|
|
15597
|
+
const rotateCharList = ["…", "(", ")", "—", "【", "】", "「", "」", "《", "》"],
|
|
15598
|
+
rotateCharMap = new Map();
|
|
15599
|
+
rotateCharList.forEach(c => rotateCharMap.set(c, !0));
|
|
15600
|
+
const noRotateCharList = [""],
|
|
15601
|
+
noRotateCharMap = new Map();
|
|
15602
|
+
function rotateText(c) {
|
|
15603
|
+
if (rotateCharMap.has(c)) return !0;
|
|
15604
|
+
if (noRotateCharMap.has(c)) return !1;
|
|
15605
|
+
let rotate = !1;
|
|
15606
|
+
return c.codePointAt(0) < 256 && (rotate = !0), rotate;
|
|
15607
|
+
}
|
|
15608
|
+
noRotateCharList.forEach(c => noRotateCharMap.set(c, !0));
|
|
15359
15609
|
|
|
15360
15610
|
const ARC_NUMBER_TYPE = genNumberType();
|
|
15361
15611
|
const ARC3D_NUMBER_TYPE = genNumberType();
|
|
@@ -15694,7 +15944,7 @@
|
|
|
15694
15944
|
return "browser" === this.global.env ? 10 : 0;
|
|
15695
15945
|
}
|
|
15696
15946
|
};
|
|
15697
|
-
DefaultLayerService = __decorate$1F([injectable(), __param$Q(0, inject(
|
|
15947
|
+
DefaultLayerService = __decorate$1F([injectable(), __param$Q(0, inject(VGlobal)), __metadata$13("design:paramtypes", [Object])], DefaultLayerService);
|
|
15698
15948
|
|
|
15699
15949
|
var __decorate$1E = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
15700
15950
|
var d,
|
|
@@ -15711,7 +15961,7 @@
|
|
|
15711
15961
|
decorator(target, key, paramIndex);
|
|
15712
15962
|
};
|
|
15713
15963
|
};
|
|
15714
|
-
const
|
|
15964
|
+
const VWindow = Symbol.for("VWindow");
|
|
15715
15965
|
const WindowHandlerContribution = Symbol.for("WindowHandlerContribution");
|
|
15716
15966
|
let DefaultWindow = class {
|
|
15717
15967
|
get width() {
|
|
@@ -15800,14 +16050,14 @@
|
|
|
15800
16050
|
this._handler.clearViewBox(viewBox, color);
|
|
15801
16051
|
}
|
|
15802
16052
|
};
|
|
15803
|
-
__decorate$1E([postConstruct(), __metadata$12("design:type", Function), __metadata$12("design:paramtypes", []), __metadata$12("design:returntype", void 0)], DefaultWindow.prototype, "postInit", null), DefaultWindow = __decorate$1E([injectable(), __param$P(0, inject(
|
|
16053
|
+
__decorate$1E([postConstruct(), __metadata$12("design:type", Function), __metadata$12("design:paramtypes", []), __metadata$12("design:returntype", void 0)], DefaultWindow.prototype, "postInit", null), DefaultWindow = __decorate$1E([injectable(), __param$P(0, inject(VGlobal)), __metadata$12("design:paramtypes", [Object])], DefaultWindow);
|
|
15804
16054
|
|
|
15805
16055
|
const TransformUtil = Symbol.for("TransformUtil");
|
|
15806
16056
|
const GraphicUtil = Symbol.for("GraphicUtil");
|
|
15807
16057
|
const LayerService = Symbol.for("LayerService");
|
|
15808
16058
|
|
|
15809
16059
|
var coreModule = new ContainerModule(bind => {
|
|
15810
|
-
bind(DefaultGlobal).toSelf().inSingletonScope(), bind(
|
|
16060
|
+
bind(DefaultGlobal).toSelf().inSingletonScope(), bind(VGlobal).toService(DefaultGlobal), bind(DefaultWindow).to(DefaultWindow), bind(VWindow).toService(DefaultWindow), bind(DefaultGraphicUtil).toSelf().inSingletonScope(), bind(GraphicUtil).toService(DefaultGraphicUtil), bind(DefaultTransformUtil).toSelf().inSingletonScope(), bind(TransformUtil).toService(DefaultTransformUtil), bind(DefaultLayerService).toSelf().inSingletonScope(), bind(LayerService).toService(DefaultLayerService);
|
|
15811
16061
|
});
|
|
15812
16062
|
|
|
15813
16063
|
function runFill(fill, background) {
|
|
@@ -16216,6 +16466,16 @@
|
|
|
16216
16466
|
cap = arcAttribute.cap,
|
|
16217
16467
|
forceShowCap = arcAttribute.forceShowCap
|
|
16218
16468
|
} = arc.attribute;
|
|
16469
|
+
let conicalOffset = 0;
|
|
16470
|
+
const tempChangeConicalColor = (isBoolean(cap) && cap || cap[0]) && "conical" === fill.gradient;
|
|
16471
|
+
if (tempChangeConicalColor) {
|
|
16472
|
+
const {
|
|
16473
|
+
sc: sc,
|
|
16474
|
+
startAngle: startAngle,
|
|
16475
|
+
endAngle: endAngle
|
|
16476
|
+
} = arc.getParsedAngle();
|
|
16477
|
+
abs$1(endAngle - startAngle) < pi2 - epsilon$1 && (conicalOffset = sc || 0, fill.startAngle -= conicalOffset, fill.endAngle -= conicalOffset);
|
|
16478
|
+
}
|
|
16219
16479
|
let beforeRenderContribitionsRuned = !1;
|
|
16220
16480
|
const {
|
|
16221
16481
|
isFullStroke: isFullStroke,
|
|
@@ -16250,7 +16510,7 @@
|
|
|
16250
16510
|
}
|
|
16251
16511
|
strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke());
|
|
16252
16512
|
}
|
|
16253
|
-
if (cap && forceShowCap) {
|
|
16513
|
+
if ((isBoolean(cap) && cap || cap[1]) && forceShowCap) {
|
|
16254
16514
|
const {
|
|
16255
16515
|
startAngle: sa,
|
|
16256
16516
|
endAngle: ea
|
|
@@ -16287,7 +16547,7 @@
|
|
|
16287
16547
|
}
|
|
16288
16548
|
this._arcAfterRenderContribitions.forEach(c => {
|
|
16289
16549
|
c.drawShape(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb);
|
|
16290
|
-
});
|
|
16550
|
+
}), tempChangeConicalColor && (fill.startAngle += conicalOffset, fill.endAngle += conicalOffset);
|
|
16291
16551
|
}
|
|
16292
16552
|
draw(arc, renderService, drawContext, params) {
|
|
16293
16553
|
const {
|
|
@@ -16470,14 +16730,14 @@
|
|
|
16470
16730
|
}
|
|
16471
16731
|
return bbox.yOffset = "top" === textBaseline ? 0 : "middle" === textBaseline ? bbox.height / -2 : "alphabetic" === textBaseline ? -.79 * bbox.height : -bbox.height, bbox;
|
|
16472
16732
|
}
|
|
16473
|
-
GetLayout(str, width, height, textAlign, textBaseline, lineHeight, suffix, miniApp) {
|
|
16733
|
+
GetLayout(str, width, height, textAlign, textBaseline, lineHeight, suffix, wordBreak, miniApp) {
|
|
16474
16734
|
const linesLayout = [],
|
|
16475
16735
|
bboxWH = [width, height],
|
|
16476
16736
|
bboxOffset = [0, 0];
|
|
16477
16737
|
for (; str.length > 0;) {
|
|
16478
16738
|
const {
|
|
16479
16739
|
str: clipText
|
|
16480
|
-
} = this.textMeasure.clipTextWithSuffix(str, this.textOptions, width, suffix);
|
|
16740
|
+
} = this.textMeasure.clipTextWithSuffix(str, this.textOptions, width, suffix, wordBreak);
|
|
16481
16741
|
linesLayout.push({
|
|
16482
16742
|
str: clipText,
|
|
16483
16743
|
width: this.textMeasure.measureTextWidth(clipText, this.textOptions)
|
|
@@ -16494,14 +16754,15 @@
|
|
|
16494
16754
|
}
|
|
16495
16755
|
GetLayoutByLines(lines, textAlign, textBaseline, lineHeight) {
|
|
16496
16756
|
let suffix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
|
|
16497
|
-
let
|
|
16757
|
+
let wordBreak = arguments.length > 5 ? arguments[5] : undefined;
|
|
16758
|
+
let lineWidth = arguments.length > 6 ? arguments[6] : undefined;
|
|
16498
16759
|
lines = lines.map(l => l.toString());
|
|
16499
16760
|
const linesLayout = [],
|
|
16500
16761
|
bboxWH = [0, 0];
|
|
16501
16762
|
if ("number" == typeof lineWidth && lineWidth !== 1 / 0) {
|
|
16502
16763
|
let width;
|
|
16503
16764
|
for (let i = 0, len = lines.length; i < len; i++) width = Math.min(this.textMeasure.measureTextWidth(lines[i], this.textOptions), lineWidth), linesLayout.push({
|
|
16504
|
-
str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix).str,
|
|
16765
|
+
str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak).str,
|
|
16505
16766
|
width: width
|
|
16506
16767
|
});
|
|
16507
16768
|
bboxWH[0] = lineWidth;
|
|
@@ -16603,6 +16864,20 @@
|
|
|
16603
16864
|
return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
|
|
16604
16865
|
}
|
|
16605
16866
|
updateSingallineAABBBounds(text) {
|
|
16867
|
+
const textTheme = getTheme(this).text,
|
|
16868
|
+
{
|
|
16869
|
+
direction = textTheme.direction
|
|
16870
|
+
} = this.attribute;
|
|
16871
|
+
return "horizontal" === direction ? this.updateHorizontalSinglelineAABBBounds(text) : this.updateVerticalSinglelineAABBBounds(text);
|
|
16872
|
+
}
|
|
16873
|
+
updateMultilineAABBBounds(text) {
|
|
16874
|
+
const textTheme = getTheme(this).text,
|
|
16875
|
+
{
|
|
16876
|
+
direction = textTheme.direction
|
|
16877
|
+
} = this.attribute;
|
|
16878
|
+
return "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
|
|
16879
|
+
}
|
|
16880
|
+
updateHorizontalSinglelineAABBBounds(text) {
|
|
16606
16881
|
var _a;
|
|
16607
16882
|
const textTheme = getTheme(this).text,
|
|
16608
16883
|
textMeasure = application.graphicUtil.textMeasure;
|
|
@@ -16616,7 +16891,8 @@
|
|
|
16616
16891
|
fontSize = textTheme.fontSize,
|
|
16617
16892
|
fontWeight = textTheme.fontWeight,
|
|
16618
16893
|
stroke = textTheme.stroke,
|
|
16619
|
-
lineWidth = textTheme.lineWidth
|
|
16894
|
+
lineWidth = textTheme.lineWidth,
|
|
16895
|
+
wordBreak = textTheme.wordBreak
|
|
16620
16896
|
} = attribute,
|
|
16621
16897
|
buf = Math.max(2, .075 * fontSize),
|
|
16622
16898
|
{
|
|
@@ -16634,13 +16910,13 @@
|
|
|
16634
16910
|
data = textMeasure.clipTextWithSuffix(text.toString(), {
|
|
16635
16911
|
fontSize: fontSize,
|
|
16636
16912
|
fontWeight: fontWeight
|
|
16637
|
-
}, maxLineWidth, strEllipsis);
|
|
16913
|
+
}, maxLineWidth, strEllipsis, "break-word" === wordBreak);
|
|
16638
16914
|
str = data.str, width = data.width;
|
|
16639
16915
|
} else {
|
|
16640
16916
|
const data = textMeasure.clipText(text.toString(), {
|
|
16641
16917
|
fontSize: fontSize,
|
|
16642
16918
|
fontWeight: fontWeight
|
|
16643
|
-
}, maxLineWidth);
|
|
16919
|
+
}, maxLineWidth, "break-word" === wordBreak);
|
|
16644
16920
|
str = data.str, width = data.width;
|
|
16645
16921
|
}
|
|
16646
16922
|
this.cache.clipedText = str, this.cache.clipedWidth = width;
|
|
@@ -16649,11 +16925,67 @@
|
|
|
16649
16925
|
fontWeight: fontWeight
|
|
16650
16926
|
}), this.cache.clipedText = text.toString(), this.cache.clipedWidth = width;
|
|
16651
16927
|
this.clearUpdateShapeTag();
|
|
16928
|
+
const dx = textDrawOffsetX(textAlign, width);
|
|
16929
|
+
let lh = lineHeight;
|
|
16930
|
+
vglobal.isSafari() && (lh += .2 * fontSize);
|
|
16931
|
+
const dy = textLayoutOffsetY(textBaseline, lh, fontSize, buf);
|
|
16932
|
+
return this._AABBBounds.set(dx, dy, dx + width, dy + lh), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
16933
|
+
}
|
|
16934
|
+
updateVerticalSinglelineAABBBounds(text) {
|
|
16935
|
+
var _a;
|
|
16936
|
+
const textTheme = getTheme(this).text,
|
|
16937
|
+
textMeasure = application.graphicUtil.textMeasure;
|
|
16938
|
+
let width;
|
|
16939
|
+
const buf = 2,
|
|
16940
|
+
attribute = this.attribute,
|
|
16941
|
+
{
|
|
16942
|
+
maxLineWidth = textTheme.maxLineWidth,
|
|
16943
|
+
ellipsis = textTheme.ellipsis,
|
|
16944
|
+
textAlign = textTheme.textAlign,
|
|
16945
|
+
textBaseline = textTheme.textBaseline,
|
|
16946
|
+
fontSize = textTheme.fontSize,
|
|
16947
|
+
fontWeight = textTheme.fontWeight,
|
|
16948
|
+
stroke = textTheme.stroke,
|
|
16949
|
+
lineHeight = null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf,
|
|
16950
|
+
lineWidth = textTheme.lineWidth,
|
|
16951
|
+
wordBreak = textTheme.wordBreak
|
|
16952
|
+
} = attribute;
|
|
16953
|
+
if (!this.shouldUpdateShape() && this.cache) {
|
|
16954
|
+
width = this.cache.clipedWidth;
|
|
16955
|
+
const dx = textDrawOffsetX(textAlign, width),
|
|
16956
|
+
dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
|
|
16957
|
+
return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
16958
|
+
}
|
|
16959
|
+
let verticalList = [verticalLayout(text.toString())];
|
|
16960
|
+
if (Number.isFinite(maxLineWidth)) {
|
|
16961
|
+
if (ellipsis) {
|
|
16962
|
+
const strEllipsis = !0 === ellipsis ? textTheme.ellipsis : ellipsis,
|
|
16963
|
+
data = textMeasure.clipTextWithSuffixVertical(verticalList[0], {
|
|
16964
|
+
fontSize: fontSize,
|
|
16965
|
+
fontWeight: fontWeight
|
|
16966
|
+
}, maxLineWidth, strEllipsis, "break-word" === wordBreak);
|
|
16967
|
+
verticalList = [data.verticalList], width = data.width;
|
|
16968
|
+
} else {
|
|
16969
|
+
const data = textMeasure.clipTextVertical(verticalList[0], {
|
|
16970
|
+
fontSize: fontSize,
|
|
16971
|
+
fontWeight: fontWeight
|
|
16972
|
+
}, maxLineWidth, "break-word" === wordBreak);
|
|
16973
|
+
verticalList = [data.verticalList], width = data.width;
|
|
16974
|
+
}
|
|
16975
|
+
this.cache.verticalList = verticalList, this.cache.clipedWidth = width;
|
|
16976
|
+
} else width = 0, verticalList[0].forEach(t => {
|
|
16977
|
+
const w = t.direction === TextDirection.HORIZONTAL ? fontSize : textMeasure.measureTextWidth(t.text, {
|
|
16978
|
+
fontSize: fontSize,
|
|
16979
|
+
fontWeight: fontWeight
|
|
16980
|
+
});
|
|
16981
|
+
width += w, t.width = w;
|
|
16982
|
+
}), this.cache.verticalList = verticalList, this.cache.clipedWidth = width;
|
|
16983
|
+
this.clearUpdateShapeTag();
|
|
16652
16984
|
const dx = textDrawOffsetX(textAlign, width),
|
|
16653
|
-
dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize
|
|
16654
|
-
return this._AABBBounds.set(dx, dy
|
|
16985
|
+
dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
|
|
16986
|
+
return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
16655
16987
|
}
|
|
16656
|
-
|
|
16988
|
+
updateHorizontalMultilineAABBBounds(text) {
|
|
16657
16989
|
var _a;
|
|
16658
16990
|
const textTheme = getTheme(this).text,
|
|
16659
16991
|
attribute = this.attribute,
|
|
@@ -16667,7 +16999,8 @@
|
|
|
16667
16999
|
ellipsis = textTheme.ellipsis,
|
|
16668
17000
|
maxLineWidth: maxLineWidth,
|
|
16669
17001
|
stroke = textTheme.stroke,
|
|
16670
|
-
lineWidth = textTheme.lineWidth
|
|
17002
|
+
lineWidth = textTheme.lineWidth,
|
|
17003
|
+
wordBreak = textTheme.wordBreak
|
|
16671
17004
|
} = attribute;
|
|
16672
17005
|
if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
|
|
16673
17006
|
const bbox = this.cache.layoutData.bbox;
|
|
@@ -16677,12 +17010,74 @@
|
|
|
16677
17010
|
layoutData = new CanvasTextLayout(fontFamily, {
|
|
16678
17011
|
fontSize: fontSize,
|
|
16679
17012
|
fontWeight: fontWeight
|
|
16680
|
-
}, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, maxLineWidth),
|
|
17013
|
+
}, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, "break-word" === wordBreak, maxLineWidth),
|
|
16681
17014
|
{
|
|
16682
17015
|
bbox: bbox
|
|
16683
17016
|
} = layoutData;
|
|
16684
17017
|
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
16685
17018
|
}
|
|
17019
|
+
updateVerticalMultilineAABBBounds(text) {
|
|
17020
|
+
var _a;
|
|
17021
|
+
const textTheme = getTheme(this).text,
|
|
17022
|
+
textMeasure = application.graphicUtil.textMeasure;
|
|
17023
|
+
let width;
|
|
17024
|
+
const buf = 2,
|
|
17025
|
+
attribute = this.attribute,
|
|
17026
|
+
{
|
|
17027
|
+
maxLineWidth = textTheme.maxLineWidth,
|
|
17028
|
+
ellipsis = textTheme.ellipsis,
|
|
17029
|
+
textAlign = textTheme.textAlign,
|
|
17030
|
+
textBaseline = textTheme.textBaseline,
|
|
17031
|
+
fontSize = textTheme.fontSize,
|
|
17032
|
+
fontWeight = textTheme.fontWeight,
|
|
17033
|
+
stroke = textTheme.stroke,
|
|
17034
|
+
lineHeight = null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf,
|
|
17035
|
+
lineWidth = textTheme.lineWidth,
|
|
17036
|
+
wordBreak = textTheme.wordBreak
|
|
17037
|
+
} = attribute;
|
|
17038
|
+
if (width = 0, !this.shouldUpdateShape() && this.cache) {
|
|
17039
|
+
this.cache.verticalList.forEach(item => {
|
|
17040
|
+
const w = item.reduce((a, b) => a + b.width, 0);
|
|
17041
|
+
width = max$2(w, width);
|
|
17042
|
+
});
|
|
17043
|
+
const dx = textDrawOffsetX(textAlign, width),
|
|
17044
|
+
height = this.cache.verticalList.length * lineHeight,
|
|
17045
|
+
dy = textLayoutOffsetY(textBaseline, height, fontSize);
|
|
17046
|
+
return this._AABBBounds.set(dy, dx, dy + height, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
17047
|
+
}
|
|
17048
|
+
const verticalLists = text.map(str => verticalLayout(str.toString()));
|
|
17049
|
+
verticalLists.forEach((verticalData, i) => {
|
|
17050
|
+
if (Number.isFinite(maxLineWidth)) {
|
|
17051
|
+
if (ellipsis) {
|
|
17052
|
+
const strEllipsis = !0 === ellipsis ? textTheme.ellipsis : ellipsis,
|
|
17053
|
+
data = textMeasure.clipTextWithSuffixVertical(verticalData, {
|
|
17054
|
+
fontSize: fontSize,
|
|
17055
|
+
fontWeight: fontWeight
|
|
17056
|
+
}, maxLineWidth, strEllipsis, "break-word" === wordBreak);
|
|
17057
|
+
verticalLists[i] = data.verticalList, width = data.width;
|
|
17058
|
+
} else {
|
|
17059
|
+
const data = textMeasure.clipTextVertical(verticalData, {
|
|
17060
|
+
fontSize: fontSize,
|
|
17061
|
+
fontWeight: fontWeight
|
|
17062
|
+
}, maxLineWidth, "break-word" === wordBreak);
|
|
17063
|
+
verticalLists[i] = data.verticalList, width = data.width;
|
|
17064
|
+
}
|
|
17065
|
+
} else width = 0, verticalData.forEach(t => {
|
|
17066
|
+
const w = t.direction === TextDirection.HORIZONTAL ? fontSize : textMeasure.measureTextWidth(t.text, {
|
|
17067
|
+
fontSize: fontSize,
|
|
17068
|
+
fontWeight: fontWeight
|
|
17069
|
+
});
|
|
17070
|
+
width += w, t.width = w;
|
|
17071
|
+
});
|
|
17072
|
+
}), this.cache.verticalList = verticalLists, this.clearUpdateShapeTag(), this.cache.verticalList.forEach(item => {
|
|
17073
|
+
const w = item.reduce((a, b) => a + b.width, 0);
|
|
17074
|
+
width = max$2(w, width);
|
|
17075
|
+
});
|
|
17076
|
+
const dx = textDrawOffsetX(textAlign, width),
|
|
17077
|
+
height = this.cache.verticalList.length * lineHeight,
|
|
17078
|
+
dy = textLayoutOffsetY(textBaseline, height, fontSize);
|
|
17079
|
+
return this._AABBBounds.set(dy, dx, dy + height, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
17080
|
+
}
|
|
16686
17081
|
tryUpdateOBBBounds() {
|
|
16687
17082
|
throw new Error("暂不支持");
|
|
16688
17083
|
}
|
|
@@ -17375,116 +17770,6 @@
|
|
|
17375
17770
|
}
|
|
17376
17771
|
}
|
|
17377
17772
|
|
|
17378
|
-
const DIRECTION_KEY$1 = {
|
|
17379
|
-
horizontal: {
|
|
17380
|
-
width: "width",
|
|
17381
|
-
height: "height",
|
|
17382
|
-
left: "left",
|
|
17383
|
-
top: "top",
|
|
17384
|
-
x: "x",
|
|
17385
|
-
y: "y",
|
|
17386
|
-
bottom: "bottom"
|
|
17387
|
-
},
|
|
17388
|
-
vertical: {
|
|
17389
|
-
width: "height",
|
|
17390
|
-
height: "width",
|
|
17391
|
-
left: "top",
|
|
17392
|
-
top: "left",
|
|
17393
|
-
x: "y",
|
|
17394
|
-
y: "x",
|
|
17395
|
-
bottom: "right"
|
|
17396
|
-
}
|
|
17397
|
-
};
|
|
17398
|
-
const defaultFormatting = {
|
|
17399
|
-
fontSize: 16,
|
|
17400
|
-
fontFamily: "sans-serif",
|
|
17401
|
-
fill: !0,
|
|
17402
|
-
stroke: !1,
|
|
17403
|
-
fontWeight: "normal",
|
|
17404
|
-
lineHeight: "normal",
|
|
17405
|
-
fontStyle: "normal",
|
|
17406
|
-
textDecoration: "none",
|
|
17407
|
-
textAlign: "left",
|
|
17408
|
-
script: "normal"
|
|
17409
|
-
};
|
|
17410
|
-
const regLetter = /\w|\(|\)/;
|
|
17411
|
-
const regPunctuation = /[.?!,;:/,。?!、;:]/;
|
|
17412
|
-
const regFirstSpace = /\S/;
|
|
17413
|
-
function applyFillStyle(ctx, character) {
|
|
17414
|
-
const fillStyle = character && character.fill || defaultFormatting.fill;
|
|
17415
|
-
if (!fillStyle) return void (ctx.globalAlpha = 0);
|
|
17416
|
-
ctx.globalAlpha = 1, ctx.fillStyle = fillStyle;
|
|
17417
|
-
let fontSize = character.fontSize || 16;
|
|
17418
|
-
switch (character.script) {
|
|
17419
|
-
case "super":
|
|
17420
|
-
case "sub":
|
|
17421
|
-
fontSize *= .8;
|
|
17422
|
-
}
|
|
17423
|
-
ctx.setTextStyle({
|
|
17424
|
-
textAlign: "left",
|
|
17425
|
-
textBaseline: character.textBaseline || "alphabetic",
|
|
17426
|
-
fontStyle: character.fontStyle || "",
|
|
17427
|
-
fontWeight: character.fontWeight || "",
|
|
17428
|
-
fontSize: fontSize,
|
|
17429
|
-
fontFamily: character.fontFamily || "sans-serif"
|
|
17430
|
-
});
|
|
17431
|
-
}
|
|
17432
|
-
function applyStrokeStyle(ctx, character) {
|
|
17433
|
-
const strokeStyle = character && character.stroke || defaultFormatting.stroke;
|
|
17434
|
-
if (!strokeStyle) return void (ctx.globalAlpha = 0);
|
|
17435
|
-
ctx.globalAlpha = 1, ctx.lineWidth = 1, ctx.strokeStyle = strokeStyle;
|
|
17436
|
-
let fontSize = character.fontSize || 16;
|
|
17437
|
-
switch (character.script) {
|
|
17438
|
-
case "super":
|
|
17439
|
-
case "sub":
|
|
17440
|
-
fontSize *= .8;
|
|
17441
|
-
}
|
|
17442
|
-
ctx.setTextStyle({
|
|
17443
|
-
textAlign: "left",
|
|
17444
|
-
textBaseline: character.textBaseline || "alphabetic",
|
|
17445
|
-
fontStyle: character.fontStyle || "",
|
|
17446
|
-
fontWeight: character.fontWeight || "",
|
|
17447
|
-
fontSize: fontSize,
|
|
17448
|
-
fontFamily: character.fontFamily || "sans-serif"
|
|
17449
|
-
});
|
|
17450
|
-
}
|
|
17451
|
-
function getStrByWithCanvas(desc, width, character, guessIndex, needTestLetter) {
|
|
17452
|
-
if (!width || width <= 0) return 0;
|
|
17453
|
-
const textMeasure = application.graphicUtil.textMeasure;
|
|
17454
|
-
let index = guessIndex,
|
|
17455
|
-
temp = desc.slice(0, index),
|
|
17456
|
-
tempWidth = Math.floor(textMeasure.measureText(temp, character).width),
|
|
17457
|
-
tempNext = desc.slice(0, index + 1),
|
|
17458
|
-
tempWidthNext = Math.floor(textMeasure.measureText(tempNext, character).width);
|
|
17459
|
-
for (; tempWidth > width || tempWidthNext <= width;) {
|
|
17460
|
-
if (tempWidth > width ? index-- : index++, index > desc.length) {
|
|
17461
|
-
index = desc.length;
|
|
17462
|
-
break;
|
|
17463
|
-
}
|
|
17464
|
-
if (index < 0) {
|
|
17465
|
-
index = 0;
|
|
17466
|
-
break;
|
|
17467
|
-
}
|
|
17468
|
-
temp = desc.slice(0, index), tempWidth = Math.floor(textMeasure.measureText(temp, character).width), tempNext = desc.slice(0, index + 1), tempWidthNext = Math.floor(textMeasure.measureText(tempNext, character).width);
|
|
17469
|
-
}
|
|
17470
|
-
return needTestLetter && (index = testLetter(desc, index)), index;
|
|
17471
|
-
}
|
|
17472
|
-
function testLetter(string, index) {
|
|
17473
|
-
let i = index;
|
|
17474
|
-
for (; regLetter.test(string[i - 1]) && regLetter.test(string[i]) || regPunctuation.test(string[i]);) if (i--, i <= 0) return index;
|
|
17475
|
-
return i;
|
|
17476
|
-
}
|
|
17477
|
-
function measureTextCanvas(text, character) {
|
|
17478
|
-
const measurement = application.graphicUtil.textMeasure.measureText(text, character),
|
|
17479
|
-
result = {
|
|
17480
|
-
ascent: 0,
|
|
17481
|
-
height: 0,
|
|
17482
|
-
descent: 0,
|
|
17483
|
-
width: 0
|
|
17484
|
-
};
|
|
17485
|
-
return "number" != typeof measurement.actualBoundingBoxAscent || "number" != typeof measurement.actualBoundingBoxDescent ? (result.width = Math.floor(measurement.width), result.height = character.fontSize || 0, result.ascent = result.height, result.descent = 0) : (result.width = Math.floor(measurement.width), result.height = Math.floor(measurement.actualBoundingBoxAscent + measurement.actualBoundingBoxDescent), result.ascent = Math.floor(measurement.actualBoundingBoxAscent), result.descent = result.height - result.ascent), result;
|
|
17486
|
-
}
|
|
17487
|
-
|
|
17488
17773
|
class Frame {
|
|
17489
17774
|
constructor(left, top, width, height, ellipsis, wordBreak, verticalDirection, globalAlign, globalBaseline, layoutDirection, isWidthMax, isHeightMax, singleLine, icons) {
|
|
17490
17775
|
this.left = left, this.top = top, this.width = width, this.height = height, this.actualHeight = 0, this.bottom = top + height, this.right = left + width, this.ellipsis = ellipsis, this.wordBreak = wordBreak, this.verticalDirection = verticalDirection, this.lines = [], this.globalAlign = globalAlign, this.globalBaseline = globalBaseline, this.layoutDirection = layoutDirection, this.directionKey = DIRECTION_KEY$1[this.layoutDirection], this.isWidthMax = isWidthMax, this.isHeightMax = isHeightMax, this.singleLine = singleLine, icons ? (icons.clear(), this.icons = icons) : this.icons = new Map();
|
|
@@ -18323,7 +18608,9 @@
|
|
|
18323
18608
|
capAngle = capWidth / outerRadius;
|
|
18324
18609
|
if (capWidth > epsilon$1 && outerRadius > epsilon$1) return {
|
|
18325
18610
|
startAngle: startAngle - sign * capAngle * startCap,
|
|
18326
|
-
endAngle: endAngle + sign * capAngle * endCap
|
|
18611
|
+
endAngle: endAngle + sign * capAngle * endCap,
|
|
18612
|
+
sc: sign * capAngle * startCap,
|
|
18613
|
+
ec: sign * capAngle * endCap
|
|
18327
18614
|
};
|
|
18328
18615
|
}
|
|
18329
18616
|
return {
|
|
@@ -19265,6 +19552,7 @@
|
|
|
19265
19552
|
if (heightLimit > 0 && (lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1)), lineClamp && (lineCountLimit = Math.min(lineCountLimit, lineClamp)), "number" == typeof maxLineWidth && maxLineWidth !== 1 / 0) {
|
|
19266
19553
|
if (maxLineWidth > 0) for (let i = 0; i < lines.length; i++) {
|
|
19267
19554
|
const str = lines[i];
|
|
19555
|
+
let needCut = !0;
|
|
19268
19556
|
if (i === lineCountLimit - 1) {
|
|
19269
19557
|
const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis);
|
|
19270
19558
|
linesLayout.push({
|
|
@@ -19274,14 +19562,17 @@
|
|
|
19274
19562
|
break;
|
|
19275
19563
|
}
|
|
19276
19564
|
const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth);
|
|
19277
|
-
if ("" !== str && "" === clip.str)
|
|
19278
|
-
|
|
19279
|
-
|
|
19280
|
-
|
|
19565
|
+
if ("" !== str && "" === clip.str) {
|
|
19566
|
+
if (ellipsis) {
|
|
19567
|
+
const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis);
|
|
19568
|
+
clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
|
|
19569
|
+
} else clip.str = "", clip.width = 0;
|
|
19570
|
+
needCut = !1;
|
|
19571
|
+
}
|
|
19281
19572
|
if (linesLayout.push({
|
|
19282
19573
|
str: clip.str,
|
|
19283
19574
|
width: clip.width
|
|
19284
|
-
}), clip.str.length === str.length) ;else {
|
|
19575
|
+
}), clip.str.length === str.length) ;else if (needCut) {
|
|
19285
19576
|
const newStr = str.substring(clip.str.length);
|
|
19286
19577
|
lines.splice(i + 1, 0, newStr);
|
|
19287
19578
|
}
|
|
@@ -19494,30 +19785,90 @@
|
|
|
19494
19785
|
BaseRender = __decorate$1u([injectable()], BaseRender);
|
|
19495
19786
|
|
|
19496
19787
|
function drawSegments(path, segPath, percent, clipRangeByDimension, params) {
|
|
19497
|
-
|
|
19788
|
+
var _a;
|
|
19498
19789
|
const {
|
|
19499
19790
|
offsetX = 0,
|
|
19500
19791
|
offsetY = 0,
|
|
19501
|
-
offsetZ = 0
|
|
19792
|
+
offsetZ = 0,
|
|
19793
|
+
mode = "none",
|
|
19794
|
+
drawConnect = !1,
|
|
19795
|
+
zeroX = 0,
|
|
19796
|
+
zeroY = 0
|
|
19502
19797
|
} = params || {};
|
|
19798
|
+
if (drawConnect && "none" === mode) return;
|
|
19799
|
+
if (!segPath) return;
|
|
19503
19800
|
let needMoveTo = !0;
|
|
19504
19801
|
const {
|
|
19505
19802
|
curves: curves
|
|
19506
19803
|
} = segPath;
|
|
19507
|
-
if (percent >= 1)
|
|
19508
|
-
|
|
19509
|
-
|
|
19804
|
+
if (percent >= 1) {
|
|
19805
|
+
if (drawConnect) {
|
|
19806
|
+
let lastCurve,
|
|
19807
|
+
defined0 = !0;
|
|
19808
|
+
curves.forEach((curve, i) => {
|
|
19809
|
+
var _a;
|
|
19810
|
+
let p0 = curve.p0;
|
|
19811
|
+
if (curve.originP1 !== curve.originP2) {
|
|
19812
|
+
if (lastCurve && lastCurve.originP1 === lastCurve.originP2 && (p0 = lastCurve.p0), curve.defined) defined0 || (path.lineTo(p0.x + offsetX, p0.y + offsetY, offsetZ), defined0 = !defined0);else {
|
|
19813
|
+
const {
|
|
19814
|
+
originP1: originP1,
|
|
19815
|
+
originP2: originP2
|
|
19816
|
+
} = curve;
|
|
19817
|
+
let validP;
|
|
19818
|
+
if (originP1 && !1 !== originP1.defined ? validP = p0 : originP1 && !1 !== originP2.defined && (validP = null !== (_a = curve.p3) && void 0 !== _a ? _a : curve.p1), defined0) {
|
|
19819
|
+
defined0 = !defined0;
|
|
19820
|
+
const x = validP ? validP.x : curve.p0.x,
|
|
19821
|
+
y = validP ? validP.y : curve.p0.y;
|
|
19822
|
+
path.moveTo(x + offsetX, y + offsetY, offsetZ);
|
|
19823
|
+
} else validP && (defined0 = !defined0, path.lineTo(validP.x + offsetX, validP.y + offsetY, offsetZ));
|
|
19824
|
+
}
|
|
19825
|
+
lastCurve = curve;
|
|
19826
|
+
} else lastCurve = curve;
|
|
19827
|
+
});
|
|
19828
|
+
} else curves.forEach(curve => {
|
|
19829
|
+
curve.defined ? (needMoveTo && path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), drawSegItem$1(path, curve, 1, params), needMoveTo = !1) : needMoveTo = !0;
|
|
19830
|
+
});
|
|
19831
|
+
return;
|
|
19832
|
+
}
|
|
19510
19833
|
if (percent <= 0) return;
|
|
19511
19834
|
let direction;
|
|
19512
19835
|
"x" === clipRangeByDimension ? direction = Direction$1.ROW : "y" === clipRangeByDimension ? direction = Direction$1.COLUMN : "auto" === clipRangeByDimension && (direction = segPath.direction);
|
|
19513
19836
|
const totalDrawLength = percent * segPath.tryUpdateLength(direction);
|
|
19514
|
-
let drawedLengthUntilLast = 0
|
|
19837
|
+
let drawedLengthUntilLast = 0,
|
|
19838
|
+
defined0 = !0,
|
|
19839
|
+
lastCurve = null;
|
|
19515
19840
|
for (let i = 0, n = curves.length; i < n; i++) {
|
|
19516
19841
|
const curve = curves[i],
|
|
19517
19842
|
curCurveLength = curve.getLength(direction),
|
|
19518
19843
|
_p = (totalDrawLength - drawedLengthUntilLast) / curCurveLength;
|
|
19519
19844
|
if (drawedLengthUntilLast += curCurveLength, _p < 0) break;
|
|
19520
|
-
|
|
19845
|
+
if (drawConnect) {
|
|
19846
|
+
let p0 = curve.p0;
|
|
19847
|
+
if (curve.originP1 === curve.originP2) {
|
|
19848
|
+
lastCurve = curve;
|
|
19849
|
+
continue;
|
|
19850
|
+
}
|
|
19851
|
+
if (lastCurve && lastCurve.originP1 === lastCurve.originP2 && (p0 = lastCurve.p0), curve.defined) defined0 || (path.lineTo(p0.x + offsetX, p0.y + offsetY, offsetZ), defined0 = !defined0);else {
|
|
19852
|
+
const {
|
|
19853
|
+
originP1: originP1,
|
|
19854
|
+
originP2: originP2
|
|
19855
|
+
} = curve;
|
|
19856
|
+
let validP;
|
|
19857
|
+
if (originP1 && !1 !== originP1.defined ? validP = p0 : originP1 && !1 !== originP2.defined && (validP = null !== (_a = curve.p3) && void 0 !== _a ? _a : curve.p1), defined0) {
|
|
19858
|
+
defined0 = !defined0;
|
|
19859
|
+
const x = validP ? validP.x : curve.p0.x,
|
|
19860
|
+
y = validP ? validP.y : curve.p0.y;
|
|
19861
|
+
path.moveTo(x + offsetX, y + offsetY, offsetZ);
|
|
19862
|
+
} else validP && (defined0 = !defined0, path.lineTo(validP.x + offsetX, validP.y + offsetY, offsetZ));
|
|
19863
|
+
}
|
|
19864
|
+
lastCurve = curve;
|
|
19865
|
+
} else {
|
|
19866
|
+
if (!curve.defined) {
|
|
19867
|
+
needMoveTo = !0;
|
|
19868
|
+
continue;
|
|
19869
|
+
}
|
|
19870
|
+
needMoveTo && path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), drawSegItem$1(path, curve, min$2(_p, 1), params), needMoveTo = !1;
|
|
19871
|
+
}
|
|
19521
19872
|
}
|
|
19522
19873
|
}
|
|
19523
19874
|
function drawIncrementalSegments(path, lastSeg, segments, params) {
|
|
@@ -19596,7 +19947,7 @@
|
|
|
19596
19947
|
this.z = z, drawPathProxy(line, context, x, y) || (this.drawShape(line, context, x, y, drawContext, params), this.z = 0, context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix), context.highPerformanceRestore();
|
|
19597
19948
|
}
|
|
19598
19949
|
drawSegmentItem(context, cache, fill, stroke, fillOpacity, strokeOpacity, attribute, defaultAttribute, clipRange, clipRangeByDimension, offsetX, offsetY, line, fillCb, strokeCb) {
|
|
19599
|
-
var _a;
|
|
19950
|
+
var _a, _b, _c, _d, _e;
|
|
19600
19951
|
if (!cache) return;
|
|
19601
19952
|
context.beginPath();
|
|
19602
19953
|
const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
|
|
@@ -19609,7 +19960,27 @@
|
|
|
19609
19960
|
x: originX = 0,
|
|
19610
19961
|
x: originY = 0
|
|
19611
19962
|
} = attribute;
|
|
19612
|
-
|
|
19963
|
+
!1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.stroke()));
|
|
19964
|
+
let {
|
|
19965
|
+
connectedType: connectedType,
|
|
19966
|
+
connectedX: connectedX,
|
|
19967
|
+
connectedY: connectedY,
|
|
19968
|
+
connectedStyle: connectedStyle
|
|
19969
|
+
} = attribute;
|
|
19970
|
+
if (isArray$3(defaultAttribute) ? (connectedType = null !== (_b = null != connectedType ? connectedType : defaultAttribute[0].connectedType) && void 0 !== _b ? _b : defaultAttribute[1].connectedType, connectedX = null !== (_c = null != connectedX ? connectedX : defaultAttribute[0].connectedX) && void 0 !== _c ? _c : defaultAttribute[1].connectedX, connectedY = null !== (_d = null != connectedY ? connectedY : defaultAttribute[0].connectedY) && void 0 !== _d ? _d : defaultAttribute[1].connectedY, connectedStyle = null !== (_e = null != connectedStyle ? connectedStyle : defaultAttribute[0].connectedStyle) && void 0 !== _e ? _e : defaultAttribute[1].connectedStyle) : (connectedType = null != connectedType ? connectedType : defaultAttribute.connectedType, connectedX = null != connectedX ? connectedX : defaultAttribute.connectedX, connectedY = null != connectedY ? connectedY : defaultAttribute.connectedY, connectedStyle = null != connectedStyle ? connectedStyle : defaultAttribute.connectedStyle), "connect" !== connectedType && "zero" !== connectedType && (connectedType = "none"), "none" !== connectedType) {
|
|
19971
|
+
context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, cache, clipRange, clipRangeByDimension, {
|
|
19972
|
+
offsetX: offsetX,
|
|
19973
|
+
offsetY: offsetY,
|
|
19974
|
+
offsetZ: z,
|
|
19975
|
+
drawConnect: !0,
|
|
19976
|
+
mode: connectedType,
|
|
19977
|
+
zeroX: connectedX,
|
|
19978
|
+
zeroY: connectedY
|
|
19979
|
+
});
|
|
19980
|
+
const da = [];
|
|
19981
|
+
isArray$3(defaultAttribute) ? defaultAttribute.forEach(i => da.push(i)) : da.push(defaultAttribute), da.push(attribute), !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da), context.stroke()));
|
|
19982
|
+
}
|
|
19983
|
+
return !1;
|
|
19613
19984
|
}
|
|
19614
19985
|
drawShape(line, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
19615
19986
|
const lineAttribute = getTheme(line, null == params ? void 0 : params.theme).line,
|
|
@@ -19680,6 +20051,11 @@
|
|
|
19680
20051
|
|
|
19681
20052
|
function drawAreaSegments(path, segPath, percent, params) {
|
|
19682
20053
|
var _a;
|
|
20054
|
+
const {
|
|
20055
|
+
drawConnect = !1,
|
|
20056
|
+
mode = "none"
|
|
20057
|
+
} = params || {};
|
|
20058
|
+
if (drawConnect && "none" === mode) return;
|
|
19683
20059
|
const {
|
|
19684
20060
|
top: top,
|
|
19685
20061
|
bottom: bottom
|
|
@@ -19688,11 +20064,34 @@
|
|
|
19688
20064
|
const topList = [],
|
|
19689
20065
|
bottomList = [];
|
|
19690
20066
|
let lastDefined = !0;
|
|
19691
|
-
|
|
19692
|
-
|
|
19693
|
-
|
|
20067
|
+
if (drawConnect) {
|
|
20068
|
+
let lastCurve,
|
|
20069
|
+
lastBottomCurve,
|
|
20070
|
+
defined0 = !0;
|
|
20071
|
+
const n = top.curves.length;
|
|
20072
|
+
top.curves.forEach((curve, i) => {
|
|
20073
|
+
const bototmCurve = bottom.curves[n - i - 1];
|
|
20074
|
+
let currentTopCurve = curve,
|
|
20075
|
+
currentBottomCurve = bototmCurve;
|
|
20076
|
+
if (curve.originP1 === curve.originP2) return lastCurve = curve, void (lastBottomCurve = bototmCurve);
|
|
20077
|
+
if (lastCurve && lastCurve.originP1 === lastCurve.originP2 && (currentTopCurve = lastCurve, currentBottomCurve = lastBottomCurve), curve.defined) defined0 || (topList.push(currentTopCurve), bottomList.push(currentBottomCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0, defined0 = !defined0);else {
|
|
20078
|
+
const {
|
|
20079
|
+
originP1: originP1,
|
|
20080
|
+
originP2: originP2
|
|
20081
|
+
} = curve;
|
|
20082
|
+
let validTopCurve, validBottomCurve;
|
|
20083
|
+
originP1 && !1 !== originP1.defined ? (validTopCurve = currentTopCurve, validBottomCurve = currentBottomCurve) : originP1 && !1 !== originP2.defined && (validTopCurve = curve, validBottomCurve = bototmCurve), defined0 ? (defined0 = !defined0, topList.push(validTopCurve || curve), bottomList.push(validBottomCurve || bototmCurve)) : validTopCurve && (defined0 = !defined0, topList.push(validTopCurve || curve), bottomList.push(validBottomCurve || bototmCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0);
|
|
20084
|
+
}
|
|
20085
|
+
lastCurve = curve;
|
|
20086
|
+
}), drawAreaConnectBlock(path, topList, bottomList, params);
|
|
20087
|
+
} else {
|
|
20088
|
+
for (let i = 0, n = top.curves.length; i < n; i++) {
|
|
20089
|
+
const topCurve = top.curves[i];
|
|
20090
|
+
lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1])), lastDefined = !lastDefined) : lastDefined && (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1]));
|
|
20091
|
+
}
|
|
20092
|
+
drawAreaBlock(path, topList, bottomList, params);
|
|
19694
20093
|
}
|
|
19695
|
-
return
|
|
20094
|
+
return;
|
|
19696
20095
|
}
|
|
19697
20096
|
if (percent <= 0) return;
|
|
19698
20097
|
let {
|
|
@@ -19710,17 +20109,51 @@
|
|
|
19710
20109
|
lastDefined = !0;
|
|
19711
20110
|
const topList = [],
|
|
19712
20111
|
bottomList = [];
|
|
20112
|
+
let lastTopCurve,
|
|
20113
|
+
lastBottomCurve,
|
|
20114
|
+
defined0 = !0;
|
|
19713
20115
|
for (let i = 0, n = top.curves.length; i < n; i++) {
|
|
19714
20116
|
const topCurve = top.curves[i],
|
|
19715
20117
|
curCurveLength = topCurve.getLength(direction),
|
|
19716
20118
|
percent = (totalDrawLength - drawedLengthUntilLast) / curCurveLength;
|
|
19717
20119
|
if (percent < 0) break;
|
|
19718
|
-
drawedLengthUntilLast += curCurveLength
|
|
19719
|
-
|
|
19720
|
-
|
|
19721
|
-
|
|
20120
|
+
if (drawedLengthUntilLast += curCurveLength, drawConnect) {
|
|
20121
|
+
const bototmCurve = bottom.curves[n - i - 1];
|
|
20122
|
+
let currentTopCurve = topCurve,
|
|
20123
|
+
currentBottomCurve = bototmCurve;
|
|
20124
|
+
if (topCurve.originP1 === topCurve.originP2) {
|
|
20125
|
+
lastTopCurve = topCurve, lastBottomCurve = bototmCurve;
|
|
20126
|
+
continue;
|
|
20127
|
+
}
|
|
20128
|
+
if (lastTopCurve && lastTopCurve.originP1 === lastTopCurve.originP2 && (currentTopCurve = lastTopCurve, currentBottomCurve = lastBottomCurve), topCurve.defined) defined0 || (topList.push(currentTopCurve), bottomList.push(currentBottomCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0, defined0 = !defined0);else {
|
|
20129
|
+
const {
|
|
20130
|
+
originP1: originP1,
|
|
20131
|
+
originP2: originP2
|
|
20132
|
+
} = topCurve;
|
|
20133
|
+
let validTopCurve, validBottomCurve;
|
|
20134
|
+
originP1 && !1 !== originP1.defined ? (validTopCurve = currentTopCurve, validBottomCurve = currentBottomCurve) : originP1 && !1 !== originP2.defined && (validTopCurve = topCurve, validBottomCurve = bototmCurve), defined0 ? (defined0 = !defined0, topList.push(validTopCurve || topCurve), bottomList.push(validBottomCurve || bototmCurve)) : validTopCurve && (defined0 = !defined0, topList.push(validTopCurve || topCurve), bottomList.push(validBottomCurve || bototmCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0);
|
|
20135
|
+
}
|
|
20136
|
+
lastTopCurve = topCurve;
|
|
20137
|
+
} else {
|
|
20138
|
+
let tc = null,
|
|
20139
|
+
bc = null;
|
|
20140
|
+
lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (tc = topCurve, bc = bottom.curves[n - i - 1]), lastDefined = !lastDefined) : lastDefined && (tc = topCurve, bc = bottom.curves[n - i - 1]), tc && bc && (percent < 1 && (tc = tc.p2 && tc.p3 ? divideCubic(tc, percent)[0] : divideLinear(tc, percent)[0], bc = bc.p2 && bc.p3 ? divideCubic(bc, 1 - percent)[1] : divideLinear(bc, 1 - percent)[1]), tc.defined = lastDefined, bc.defined = lastDefined, topList.push(tc), bottomList.push(bc)), tc = null, bc = null;
|
|
20141
|
+
}
|
|
19722
20142
|
}
|
|
19723
|
-
drawAreaBlock(path, topList, bottomList, params);
|
|
20143
|
+
drawConnect ? drawAreaConnectBlock(path, topList, bottomList, params) : drawAreaBlock(path, topList, bottomList, params);
|
|
20144
|
+
}
|
|
20145
|
+
function drawAreaConnectBlock(path, topList, bottomList, params) {
|
|
20146
|
+
if (topList.length < 2) return;
|
|
20147
|
+
const {
|
|
20148
|
+
offsetX = 0,
|
|
20149
|
+
offsetY = 0,
|
|
20150
|
+
offsetZ = 0,
|
|
20151
|
+
mode: mode
|
|
20152
|
+
} = params || {};
|
|
20153
|
+
let curve = topList[0];
|
|
20154
|
+
path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), curve = topList[topList.length - 1];
|
|
20155
|
+
let end = curve.p3 || curve.p1;
|
|
20156
|
+
path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ), curve = bottomList[bottomList.length - 1], path.lineTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), curve = bottomList[0], end = curve.p3 || curve.p1, path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ), path.closePath();
|
|
19724
20157
|
}
|
|
19725
20158
|
function drawAreaBlock(path, topList, bottomList, params) {
|
|
19726
20159
|
const {
|
|
@@ -19849,14 +20282,14 @@
|
|
|
19849
20282
|
y: null !== (_d = endPoint.y1) && void 0 !== _d ? _d : endPoint.y
|
|
19850
20283
|
});
|
|
19851
20284
|
}
|
|
19852
|
-
lastBottomSeg = calcLineCache(bottomPoints, curveType), bottomCaches.unshift(lastBottomSeg);
|
|
20285
|
+
lastBottomSeg = calcLineCache(bottomPoints, "stepBefore" === curveType ? "stepAfter" : "stepAfter" === curveType ? "stepBefore" : curveType), bottomCaches.unshift(lastBottomSeg);
|
|
19853
20286
|
}
|
|
19854
20287
|
area.cacheArea = bottomCaches.map((item, index) => ({
|
|
19855
20288
|
top: topCaches[index],
|
|
19856
20289
|
bottom: item
|
|
19857
20290
|
}));
|
|
19858
20291
|
} else {
|
|
19859
|
-
if (!points || !points.length) return area.
|
|
20292
|
+
if (!points || !points.length) return area.cacheArea = null, void area.clearUpdateShapeTag();
|
|
19860
20293
|
{
|
|
19861
20294
|
const topPoints = points,
|
|
19862
20295
|
bottomPoints = [];
|
|
@@ -19910,12 +20343,41 @@
|
|
|
19910
20343
|
drawPathProxy(area, context, x, y, drawContext, params) || this.drawShape(area, context, x, y, drawContext, params), context.highPerformanceRestore();
|
|
19911
20344
|
}
|
|
19912
20345
|
drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb) {
|
|
20346
|
+
let ret = !1;
|
|
20347
|
+
return ret = ret || this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, !1, fillCb, strokeCb), ret = ret || this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, !0, fillCb, strokeCb), ret;
|
|
20348
|
+
}
|
|
20349
|
+
_drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, connect, fillCb, strokeCb) {
|
|
20350
|
+
var _a, _b, _c, _d;
|
|
20351
|
+
let {
|
|
20352
|
+
connectedType: connectedType,
|
|
20353
|
+
connectedX: connectedX,
|
|
20354
|
+
connectedY: connectedY,
|
|
20355
|
+
connectedStyle: connectedStyle
|
|
20356
|
+
} = attribute;
|
|
20357
|
+
const da = [];
|
|
20358
|
+
if (connect && (isArray$3(defaultAttribute) ? (connectedType = null !== (_a = null != connectedType ? connectedType : defaultAttribute[0].connectedType) && void 0 !== _a ? _a : defaultAttribute[1].connectedType, connectedX = null !== (_b = null != connectedX ? connectedX : defaultAttribute[0].connectedX) && void 0 !== _b ? _b : defaultAttribute[1].connectedX, connectedY = null !== (_c = null != connectedY ? connectedY : defaultAttribute[0].connectedY) && void 0 !== _c ? _c : defaultAttribute[1].connectedY, connectedStyle = null !== (_d = null != connectedStyle ? connectedStyle : defaultAttribute[0].connectedStyle) && void 0 !== _d ? _d : defaultAttribute[1].connectedStyle) : (connectedType = null != connectedType ? connectedType : defaultAttribute.connectedType, connectedX = null != connectedX ? connectedX : defaultAttribute.connectedX, connectedY = null != connectedY ? connectedY : defaultAttribute.connectedY, connectedStyle = null != connectedStyle ? connectedStyle : defaultAttribute.connectedStyle), "connect" !== connectedType && "zero" !== connectedType && (connectedType = "none"), isArray$3(defaultAttribute) ? defaultAttribute.forEach(i => da.push(i)) : da.push(defaultAttribute), da.push(attribute)), connect && "none" === connectedType) return !1;
|
|
19913
20359
|
if (!cache) return;
|
|
19914
20360
|
context.beginPath();
|
|
19915
|
-
|
|
20361
|
+
const {
|
|
20362
|
+
points: points,
|
|
20363
|
+
segments: segments
|
|
20364
|
+
} = area.attribute;
|
|
20365
|
+
let endP,
|
|
20366
|
+
startP,
|
|
20367
|
+
direction = Direction$1.ROW;
|
|
20368
|
+
if (segments) {
|
|
20369
|
+
const endSeg = segments[segments.length - 1];
|
|
20370
|
+
startP = segments[0].points[0], endP = endSeg.points[endSeg.points.length - 1];
|
|
20371
|
+
} else startP = points[0], endP = points[points.length - 1];
|
|
20372
|
+
direction = abs$1(endP.x - startP.x) > abs$1(endP.y - startP.y) ? Direction$1.ROW : Direction$1.COLUMN, drawAreaSegments(context.camera ? context : context.nativeContext, cache, clipRange, {
|
|
19916
20373
|
offsetX: offsetX,
|
|
19917
20374
|
offsetY: offsetY,
|
|
19918
|
-
offsetZ: offsetZ
|
|
20375
|
+
offsetZ: offsetZ,
|
|
20376
|
+
direction: direction,
|
|
20377
|
+
drawConnect: connect,
|
|
20378
|
+
mode: connectedType,
|
|
20379
|
+
zeroX: connectedX,
|
|
20380
|
+
zeroY: connectedY
|
|
19919
20381
|
}), this._areaRenderContribitions || (this._areaRenderContribitions = this.areaRenderContribitions.getContributions() || [], this._areaRenderContribitions.sort((a, b) => b.order - a.order)), this._areaRenderContribitions.forEach(c => {
|
|
19920
20382
|
c.time === BaseRenderContributionTime.beforeFillStroke && c.drawShape(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
|
|
19921
20383
|
attribute: attribute
|
|
@@ -19925,7 +20387,7 @@
|
|
|
19925
20387
|
x: originX = 0,
|
|
19926
20388
|
x: originY = 0
|
|
19927
20389
|
} = attribute;
|
|
19928
|
-
if (!1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), this._areaRenderContribitions || (this._areaRenderContribitions = this.areaRenderContribitions.getContributions() || []), this._areaRenderContribitions.forEach(c => {
|
|
20390
|
+
if (!1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.fill())), this._areaRenderContribitions || (this._areaRenderContribitions = this.areaRenderContribitions.getContributions() || []), this._areaRenderContribitions.forEach(c => {
|
|
19929
20391
|
c.time === BaseRenderContributionTime.afterFillStroke && c.drawShape(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
|
|
19930
20392
|
attribute: attribute
|
|
19931
20393
|
});
|
|
@@ -19933,11 +20395,15 @@
|
|
|
19933
20395
|
const {
|
|
19934
20396
|
stroke: stroke
|
|
19935
20397
|
} = attribute;
|
|
19936
|
-
isArray$3(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, "
|
|
20398
|
+
isArray$3(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, direction === Direction$1.ROW ? "x" : "y", {
|
|
19937
20399
|
offsetX: offsetX,
|
|
19938
20400
|
offsetY: offsetY,
|
|
19939
|
-
offsetZ: offsetZ
|
|
19940
|
-
|
|
20401
|
+
offsetZ: offsetZ,
|
|
20402
|
+
drawConnect: connect,
|
|
20403
|
+
mode: connectedType,
|
|
20404
|
+
zeroX: connectedX,
|
|
20405
|
+
zeroY: connectedY
|
|
20406
|
+
})), context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.stroke();
|
|
19941
20407
|
}
|
|
19942
20408
|
return !1;
|
|
19943
20409
|
}
|
|
@@ -20257,8 +20723,10 @@
|
|
|
20257
20723
|
underline = textAttribute.underline,
|
|
20258
20724
|
lineThrough = textAttribute.lineThrough,
|
|
20259
20725
|
keepDirIn3d = textAttribute.keepDirIn3d,
|
|
20726
|
+
direction = textAttribute.direction,
|
|
20260
20727
|
fontSize = textAttribute.fontSize,
|
|
20261
20728
|
textBaseline = textAttribute.textBaseline,
|
|
20729
|
+
textAlign = textAttribute.textAlign,
|
|
20262
20730
|
x: originX = textAttribute.x,
|
|
20263
20731
|
y: originY = textAttribute.y
|
|
20264
20732
|
} = text.attribute,
|
|
@@ -20277,28 +20745,86 @@
|
|
|
20277
20745
|
c.time === BaseRenderContributionTime.beforeFillStroke ? this._textBeforeRenderContribitions.push(c) : this._textAfterRenderContribitions.push(c);
|
|
20278
20746
|
});
|
|
20279
20747
|
}
|
|
20280
|
-
|
|
20748
|
+
this._textBeforeRenderContribitions.forEach(c => {
|
|
20281
20749
|
c.drawShape(text, context, x, y, doFill, doStroke, fVisible, sVisible, textAttribute, drawContext, fillCb, strokeCb);
|
|
20282
|
-
}), context.setShadowStyle && context.setShadowStyle(text, text.attribute, textAttribute), transform3dMatrixToContextMatrix && this.transformUseContext2d(text, textAttribute, z, context)
|
|
20283
|
-
|
|
20284
|
-
|
|
20285
|
-
|
|
20286
|
-
|
|
20287
|
-
|
|
20288
|
-
|
|
20289
|
-
|
|
20290
|
-
|
|
20291
|
-
|
|
20292
|
-
|
|
20293
|
-
|
|
20294
|
-
|
|
20295
|
-
|
|
20296
|
-
|
|
20750
|
+
}), context.setShadowStyle && context.setShadowStyle(text, text.attribute, textAttribute), transform3dMatrixToContextMatrix && this.transformUseContext2d(text, textAttribute, z, context);
|
|
20751
|
+
const drawText = (t, offsetX, offsetY, direction) => {
|
|
20752
|
+
let _x = x + offsetX;
|
|
20753
|
+
const _y = y + offsetY;
|
|
20754
|
+
if (direction) {
|
|
20755
|
+
context.highPerformanceSave(), _x += fontSize;
|
|
20756
|
+
const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);
|
|
20757
|
+
matrix.rotateByCenter(Math.PI / 2, _x, _y), context.transformFromMatrix(matrix, !0), matrixAllocate.free(matrix);
|
|
20758
|
+
}
|
|
20759
|
+
doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), context.strokeText(t, _x, _y, z))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), context.fillText(t, _x, _y, z), this.drawUnderLine(underline, lineThrough, text, _x, _y, z, textAttribute, context))), direction && (context.highPerformanceRestore(), context.setTransformForCurrent());
|
|
20760
|
+
};
|
|
20761
|
+
if (Array.isArray(str)) {
|
|
20762
|
+
if (context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z), "horizontal" === direction) {
|
|
20763
|
+
const {
|
|
20764
|
+
multilineLayout: multilineLayout
|
|
20765
|
+
} = text;
|
|
20766
|
+
if (!multilineLayout) return void context.highPerformanceRestore();
|
|
20767
|
+
const {
|
|
20768
|
+
xOffset: xOffset,
|
|
20769
|
+
yOffset: yOffset
|
|
20770
|
+
} = multilineLayout.bbox;
|
|
20771
|
+
doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
|
|
20772
|
+
context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
|
|
20773
|
+
}))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
|
|
20774
|
+
context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z), this.drawMultiUnderLine(underline, lineThrough, text, (line.leftOffset || 0) + x, (line.topOffset || 0) + yOffset + y, z, line.width, textAttribute, context);
|
|
20775
|
+
})));
|
|
20776
|
+
} else {
|
|
20777
|
+
const cache = text.cache,
|
|
20778
|
+
{
|
|
20779
|
+
verticalList: verticalList
|
|
20780
|
+
} = cache;
|
|
20781
|
+
context.textAlign = "left", context.textBaseline = "top";
|
|
20782
|
+
const totalHeight = lineHeight * verticalList.length;
|
|
20783
|
+
let totalW = 0;
|
|
20784
|
+
verticalList.forEach(verticalData => {
|
|
20785
|
+
const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);
|
|
20786
|
+
totalW = max$2(_w, totalW);
|
|
20787
|
+
});
|
|
20788
|
+
let offsetY = 0,
|
|
20789
|
+
offsetX = 0;
|
|
20790
|
+
"bottom" === textBaseline ? offsetX = -totalHeight : "middle" === textBaseline && (offsetX = -totalHeight / 2), "center" === textAlign ? offsetY -= totalW / 2 : "right" === textAlign && (offsetY -= totalW), verticalList.forEach((verticalData, i) => {
|
|
20791
|
+
const currentW = verticalData.reduce((a, b) => a + (b.width || 0), 0),
|
|
20792
|
+
dw = totalW - currentW;
|
|
20793
|
+
let currentOffsetY = offsetY;
|
|
20794
|
+
"center" === textAlign ? currentOffsetY += dw / 2 : "right" === textAlign && (currentOffsetY += dw), verticalData.forEach(item => {
|
|
20795
|
+
const {
|
|
20796
|
+
text: text,
|
|
20797
|
+
width: width,
|
|
20798
|
+
direction: direction
|
|
20799
|
+
} = item;
|
|
20800
|
+
drawText(text, totalHeight - (i + 1) * lineHeight + offsetX, currentOffsetY, direction), currentOffsetY += width;
|
|
20801
|
+
});
|
|
20802
|
+
});
|
|
20803
|
+
}
|
|
20297
20804
|
} else {
|
|
20298
|
-
|
|
20299
|
-
|
|
20300
|
-
|
|
20301
|
-
|
|
20805
|
+
const cache = text.cache;
|
|
20806
|
+
if ("horizontal" === direction) {
|
|
20807
|
+
context.setTextStyle(text.attribute, textAttribute, z);
|
|
20808
|
+
const t = text.clipedText;
|
|
20809
|
+
let dy = 0;
|
|
20810
|
+
lineHeight !== fontSize && ("top" === textBaseline ? dy = (lineHeight - fontSize) / 2 : "middle" === textBaseline || "bottom" === textBaseline && (dy = -(lineHeight - fontSize) / 2)), drawText(t, 0, dy, 0);
|
|
20811
|
+
} else if (cache) {
|
|
20812
|
+
context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);
|
|
20813
|
+
const {
|
|
20814
|
+
verticalList: verticalList
|
|
20815
|
+
} = cache;
|
|
20816
|
+
let offsetY = 0;
|
|
20817
|
+
const totalW = verticalList[0].reduce((a, b) => a + (b.width || 0), 0);
|
|
20818
|
+
let offsetX = 0;
|
|
20819
|
+
"bottom" === textBaseline ? offsetX = -lineHeight : "middle" === textBaseline && (offsetX = -lineHeight / 2), "center" === textAlign ? offsetY -= totalW / 2 : "right" === textAlign && (offsetY -= totalW), context.textAlign = "left", context.textBaseline = "top", verticalList[0].forEach(item => {
|
|
20820
|
+
const {
|
|
20821
|
+
text: text,
|
|
20822
|
+
width: width,
|
|
20823
|
+
direction: direction
|
|
20824
|
+
} = item;
|
|
20825
|
+
drawText(text, offsetX, offsetY, direction), offsetY += width;
|
|
20826
|
+
});
|
|
20827
|
+
}
|
|
20302
20828
|
}
|
|
20303
20829
|
transform3dMatrixToContextMatrix && this.restoreTransformUseContext2d(text, textAttribute, z, context), this._textAfterRenderContribitions.forEach(c => {
|
|
20304
20830
|
c.drawShape(text, context, x, y, doFill, doStroke, fVisible, sVisible, textAttribute, drawContext, fillCb, strokeCb);
|
|
@@ -20910,15 +21436,26 @@
|
|
|
20910
21436
|
}
|
|
20911
21437
|
drawShape(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb) {
|
|
20912
21438
|
const {
|
|
20913
|
-
|
|
20914
|
-
|
|
20915
|
-
|
|
20916
|
-
|
|
20917
|
-
|
|
20918
|
-
|
|
20919
|
-
|
|
20920
|
-
|
|
20921
|
-
|
|
21439
|
+
outerBorder: outerBorder,
|
|
21440
|
+
innerBorder: innerBorder
|
|
21441
|
+
} = arc.attribute,
|
|
21442
|
+
doOuterBorder = outerBorder && !1 !== outerBorder.visible,
|
|
21443
|
+
doInnerBorder = innerBorder && !1 !== innerBorder.visible;
|
|
21444
|
+
if (!doOuterBorder && !doInnerBorder) return;
|
|
21445
|
+
const {
|
|
21446
|
+
innerRadius = arcAttribute.innerRadius,
|
|
21447
|
+
outerRadius = arcAttribute.outerRadius,
|
|
21448
|
+
startAngle = arcAttribute.startAngle,
|
|
21449
|
+
endAngle = arcAttribute.endAngle,
|
|
21450
|
+
opacity = arcAttribute.opacity,
|
|
21451
|
+
x: originX = arcAttribute.x,
|
|
21452
|
+
y: originY = arcAttribute.y,
|
|
21453
|
+
scaleX = arcAttribute.scaleX,
|
|
21454
|
+
scaleY = arcAttribute.scaleY
|
|
21455
|
+
} = arc.attribute,
|
|
21456
|
+
doStrokeOuter = !(!outerBorder || !outerBorder.stroke),
|
|
21457
|
+
doStrokeInner = !(!innerBorder || !innerBorder.stroke);
|
|
21458
|
+
if (doOuterBorder) {
|
|
20922
21459
|
const {
|
|
20923
21460
|
distance = arcAttribute.outerBorder.distance
|
|
20924
21461
|
} = outerBorder,
|
|
@@ -20929,12 +21466,12 @@
|
|
|
20929
21466
|
innerRadius: innerRadius - d,
|
|
20930
21467
|
startAngle: startAngle - deltaAngle,
|
|
20931
21468
|
endAngle: endAngle + deltaAngle
|
|
20932
|
-
}), context.beginPath(), drawArcPath$1(arc, context, x, y, outerRadius + d, innerRadius - d), context.setShadowStyle && context.setShadowStyle(arc, arc.attribute, arcAttribute), strokeCb) strokeCb(context, outerBorder, arcAttribute.outerBorder);else if (
|
|
21469
|
+
}), context.beginPath(), drawArcPath$1(arc, context, x, y, outerRadius + d, innerRadius - d), context.setShadowStyle && context.setShadowStyle(arc, arc.attribute, arcAttribute), strokeCb) strokeCb(context, outerBorder, arcAttribute.outerBorder);else if (doStrokeOuter) {
|
|
20933
21470
|
const lastOpacity = arcAttribute.outerBorder.opacity;
|
|
20934
|
-
arcAttribute.outerBorder.opacity = opacity, context.setStrokeStyle(arc, outerBorder, x, y, arcAttribute.outerBorder), arcAttribute.outerBorder.opacity = lastOpacity, context.stroke();
|
|
21471
|
+
arcAttribute.outerBorder.opacity = opacity, context.setStrokeStyle(arc, outerBorder, (originX - x) / scaleX, (originY - y) / scaleY, arcAttribute.outerBorder), arcAttribute.outerBorder.opacity = lastOpacity, context.stroke();
|
|
20935
21472
|
}
|
|
20936
21473
|
}
|
|
20937
|
-
if (
|
|
21474
|
+
if (doInnerBorder) {
|
|
20938
21475
|
const {
|
|
20939
21476
|
distance = arcAttribute.innerBorder.distance
|
|
20940
21477
|
} = innerBorder,
|
|
@@ -20945,9 +21482,9 @@
|
|
|
20945
21482
|
innerRadius: innerRadius + d,
|
|
20946
21483
|
startAngle: startAngle + deltaAngle,
|
|
20947
21484
|
endAngle: endAngle - deltaAngle
|
|
20948
|
-
}), context.beginPath(), drawArcPath$1(arc, context, x, y, outerRadius - d, innerRadius + d), context.setShadowStyle && context.setShadowStyle(arc, arc.attribute, arcAttribute), strokeCb) strokeCb(context, innerBorder, arcAttribute.innerBorder);else if (
|
|
21485
|
+
}), context.beginPath(), drawArcPath$1(arc, context, x, y, outerRadius - d, innerRadius + d), context.setShadowStyle && context.setShadowStyle(arc, arc.attribute, arcAttribute), strokeCb) strokeCb(context, innerBorder, arcAttribute.innerBorder);else if (doStrokeInner) {
|
|
20949
21486
|
const lastOpacity = arcAttribute.innerBorder.opacity;
|
|
20950
|
-
arcAttribute.innerBorder.opacity = opacity, context.setStrokeStyle(arc, innerBorder, x, y, arcAttribute.innerBorder), arcAttribute.innerBorder.opacity = lastOpacity, context.stroke();
|
|
21487
|
+
arcAttribute.innerBorder.opacity = opacity, context.setStrokeStyle(arc, innerBorder, (originX - x) / scaleX, (originY - y) / scaleY, arcAttribute.innerBorder), arcAttribute.innerBorder.opacity = lastOpacity, context.stroke();
|
|
20951
21488
|
}
|
|
20952
21489
|
}
|
|
20953
21490
|
arc.setAttributes({
|
|
@@ -20985,31 +21522,42 @@
|
|
|
20985
21522
|
}
|
|
20986
21523
|
drawShape(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb) {
|
|
20987
21524
|
const {
|
|
20988
|
-
|
|
20989
|
-
|
|
20990
|
-
|
|
20991
|
-
|
|
20992
|
-
|
|
20993
|
-
|
|
20994
|
-
|
|
20995
|
-
|
|
21525
|
+
outerBorder: outerBorder,
|
|
21526
|
+
innerBorder: innerBorder
|
|
21527
|
+
} = circle.attribute,
|
|
21528
|
+
doOuterBorder = outerBorder && !1 !== outerBorder.visible,
|
|
21529
|
+
doInnerBorder = innerBorder && !1 !== innerBorder.visible;
|
|
21530
|
+
if (!doOuterBorder && !doInnerBorder) return;
|
|
21531
|
+
const {
|
|
21532
|
+
radius = circleAttribute.radius,
|
|
21533
|
+
startAngle = circleAttribute.startAngle,
|
|
21534
|
+
endAngle = circleAttribute.endAngle,
|
|
21535
|
+
opacity = circleAttribute.opacity,
|
|
21536
|
+
x: originX = circleAttribute.x,
|
|
21537
|
+
y: originY = circleAttribute.y,
|
|
21538
|
+
scaleX = circleAttribute.scaleX,
|
|
21539
|
+
scaleY = circleAttribute.scaleY
|
|
21540
|
+
} = circle.attribute,
|
|
21541
|
+
doStrokeOuter = !(!outerBorder || !outerBorder.stroke),
|
|
21542
|
+
doStrokeInner = !(!innerBorder || !innerBorder.stroke);
|
|
21543
|
+
if (doOuterBorder) {
|
|
20996
21544
|
const {
|
|
20997
21545
|
distance = circleAttribute.outerBorder.distance
|
|
20998
21546
|
} = outerBorder,
|
|
20999
21547
|
dw = getScaledStroke(context, distance, context.dpr);
|
|
21000
|
-
if (context.beginPath(), context.arc(x, y, radius + dw, startAngle, endAngle), context.closePath(), context.setShadowStyle && context.setShadowStyle(circle, circle.attribute, circleAttribute), strokeCb) strokeCb(context, outerBorder, circleAttribute.outerBorder);else if (
|
|
21548
|
+
if (context.beginPath(), context.arc(x, y, radius + dw, startAngle, endAngle), context.closePath(), context.setShadowStyle && context.setShadowStyle(circle, circle.attribute, circleAttribute), strokeCb) strokeCb(context, outerBorder, circleAttribute.outerBorder);else if (doStrokeOuter) {
|
|
21001
21549
|
const lastOpacity = circleAttribute.outerBorder.opacity;
|
|
21002
|
-
circleAttribute.outerBorder.opacity = opacity, context.setStrokeStyle(circle, outerBorder, x, y, circleAttribute.outerBorder), circleAttribute.outerBorder.opacity = lastOpacity, context.stroke();
|
|
21550
|
+
circleAttribute.outerBorder.opacity = opacity, context.setStrokeStyle(circle, outerBorder, (originX - x) / scaleX, (originY - y) / scaleY, circleAttribute.outerBorder), circleAttribute.outerBorder.opacity = lastOpacity, context.stroke();
|
|
21003
21551
|
}
|
|
21004
21552
|
}
|
|
21005
|
-
if (
|
|
21553
|
+
if (doInnerBorder) {
|
|
21006
21554
|
const {
|
|
21007
21555
|
distance = circleAttribute.innerBorder.distance
|
|
21008
21556
|
} = innerBorder,
|
|
21009
21557
|
dw = getScaledStroke(context, distance, context.dpr);
|
|
21010
|
-
if (context.beginPath(), context.arc(x, y, radius - dw, startAngle, endAngle), context.closePath(), context.setShadowStyle && context.setShadowStyle(circle, circle.attribute, circleAttribute), strokeCb) strokeCb(context, innerBorder, circleAttribute.innerBorder);else if (
|
|
21558
|
+
if (context.beginPath(), context.arc(x, y, radius - dw, startAngle, endAngle), context.closePath(), context.setShadowStyle && context.setShadowStyle(circle, circle.attribute, circleAttribute), strokeCb) strokeCb(context, innerBorder, circleAttribute.innerBorder);else if (doStrokeInner) {
|
|
21011
21559
|
const lastOpacity = circleAttribute.innerBorder.opacity;
|
|
21012
|
-
circleAttribute.innerBorder.opacity = opacity, context.setStrokeStyle(circle, innerBorder, x, y, circleAttribute.innerBorder), circleAttribute.innerBorder.opacity = lastOpacity, context.stroke();
|
|
21560
|
+
circleAttribute.innerBorder.opacity = opacity, context.setStrokeStyle(circle, innerBorder, (originX - x) / scaleX, (originY - y) / scaleY, circleAttribute.innerBorder), circleAttribute.innerBorder.opacity = lastOpacity, context.stroke();
|
|
21013
21561
|
}
|
|
21014
21562
|
}
|
|
21015
21563
|
}
|
|
@@ -21106,14 +21654,25 @@
|
|
|
21106
21654
|
}
|
|
21107
21655
|
drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
|
|
21108
21656
|
const {
|
|
21109
|
-
|
|
21110
|
-
|
|
21111
|
-
|
|
21112
|
-
|
|
21113
|
-
|
|
21114
|
-
|
|
21115
|
-
|
|
21116
|
-
|
|
21657
|
+
outerBorder: outerBorder,
|
|
21658
|
+
innerBorder: innerBorder
|
|
21659
|
+
} = rect.attribute,
|
|
21660
|
+
doOuterBorder = outerBorder && !1 !== outerBorder.visible,
|
|
21661
|
+
doInnerBorder = innerBorder && !1 !== innerBorder.visible;
|
|
21662
|
+
if (!doOuterBorder && !doInnerBorder) return;
|
|
21663
|
+
const {
|
|
21664
|
+
width = rectAttribute.width,
|
|
21665
|
+
height = rectAttribute.height,
|
|
21666
|
+
cornerRadius = rectAttribute.cornerRadius,
|
|
21667
|
+
opacity = rectAttribute.opacity,
|
|
21668
|
+
x: originX = rectAttribute.x,
|
|
21669
|
+
y: originY = rectAttribute.y,
|
|
21670
|
+
scaleX = rectAttribute.scaleX,
|
|
21671
|
+
scaleY = rectAttribute.scaleY
|
|
21672
|
+
} = rect.attribute,
|
|
21673
|
+
doStrokeOuter = !(!outerBorder || !outerBorder.stroke),
|
|
21674
|
+
doStrokeInner = !(!innerBorder || !innerBorder.stroke);
|
|
21675
|
+
if (doOuterBorder) {
|
|
21117
21676
|
const {
|
|
21118
21677
|
distance = rectAttribute.outerBorder.distance
|
|
21119
21678
|
} = outerBorder,
|
|
@@ -21121,12 +21680,12 @@
|
|
|
21121
21680
|
nextX = x - d,
|
|
21122
21681
|
nextY = y - d,
|
|
21123
21682
|
dw = 2 * d;
|
|
21124
|
-
if (0 === cornerRadius || isArray$3(cornerRadius) && cornerRadius.every(num => 0 === num) ? (context.beginPath(), context.rect(nextX, nextY, width + dw, height + dw)) : (context.beginPath(), createRectPath(context, nextX, nextY, width + dw, height + dw, cornerRadius)), context.setShadowStyle && context.setShadowStyle(rect, rect.attribute, rectAttribute), strokeCb) strokeCb(context, outerBorder, rectAttribute.outerBorder);else if (
|
|
21683
|
+
if (0 === cornerRadius || isArray$3(cornerRadius) && cornerRadius.every(num => 0 === num) ? (context.beginPath(), context.rect(nextX, nextY, width + dw, height + dw)) : (context.beginPath(), createRectPath(context, nextX, nextY, width + dw, height + dw, cornerRadius)), context.setShadowStyle && context.setShadowStyle(rect, rect.attribute, rectAttribute), strokeCb) strokeCb(context, outerBorder, rectAttribute.outerBorder);else if (doStrokeOuter) {
|
|
21125
21684
|
const lastOpacity = rectAttribute.outerBorder.opacity;
|
|
21126
|
-
rectAttribute.outerBorder.opacity = opacity, context.setStrokeStyle(rect, outerBorder, x, y, rectAttribute.outerBorder), rectAttribute.outerBorder.opacity = lastOpacity, context.stroke();
|
|
21685
|
+
rectAttribute.outerBorder.opacity = opacity, context.setStrokeStyle(rect, outerBorder, (originX - x) / scaleX, (originY - y) / scaleY, rectAttribute.outerBorder), rectAttribute.outerBorder.opacity = lastOpacity, context.stroke();
|
|
21127
21686
|
}
|
|
21128
21687
|
}
|
|
21129
|
-
if (
|
|
21688
|
+
if (doInnerBorder) {
|
|
21130
21689
|
const {
|
|
21131
21690
|
distance = rectAttribute.innerBorder.distance
|
|
21132
21691
|
} = innerBorder,
|
|
@@ -21134,9 +21693,9 @@
|
|
|
21134
21693
|
nextX = x + d,
|
|
21135
21694
|
nextY = y + d,
|
|
21136
21695
|
dw = 2 * d;
|
|
21137
|
-
if (0 === cornerRadius || isArray$3(cornerRadius) && cornerRadius.every(num => 0 === num) ? (context.beginPath(), context.rect(nextX, nextY, width - dw, height - dw)) : (context.beginPath(), createRectPath(context, nextX, nextY, width - dw, height - dw, cornerRadius)), context.setShadowStyle && context.setShadowStyle(rect, rect.attribute, rectAttribute), strokeCb) strokeCb(context, innerBorder, rectAttribute.innerBorder);else if (
|
|
21696
|
+
if (0 === cornerRadius || isArray$3(cornerRadius) && cornerRadius.every(num => 0 === num) ? (context.beginPath(), context.rect(nextX, nextY, width - dw, height - dw)) : (context.beginPath(), createRectPath(context, nextX, nextY, width - dw, height - dw, cornerRadius)), context.setShadowStyle && context.setShadowStyle(rect, rect.attribute, rectAttribute), strokeCb) strokeCb(context, innerBorder, rectAttribute.innerBorder);else if (doStrokeInner) {
|
|
21138
21697
|
const lastOpacity = rectAttribute.innerBorder.opacity;
|
|
21139
|
-
rectAttribute.innerBorder.opacity = opacity, context.setStrokeStyle(rect, innerBorder, x, y, rectAttribute.innerBorder), rectAttribute.innerBorder.opacity = lastOpacity, context.stroke();
|
|
21698
|
+
rectAttribute.innerBorder.opacity = opacity, context.setStrokeStyle(rect, innerBorder, (originX - x) / scaleX, (originY - y) / scaleY, rectAttribute.innerBorder), rectAttribute.innerBorder.opacity = lastOpacity, context.stroke();
|
|
21140
21699
|
}
|
|
21141
21700
|
}
|
|
21142
21701
|
}
|
|
@@ -21199,33 +21758,43 @@
|
|
|
21199
21758
|
this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
21200
21759
|
}
|
|
21201
21760
|
drawShape(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb) {
|
|
21761
|
+
const parsedPath = symbol.getParsedPath();
|
|
21762
|
+
if (!parsedPath) return;
|
|
21202
21763
|
const {
|
|
21203
|
-
size = symbolAttribute.size,
|
|
21204
|
-
opacity = symbolAttribute.opacity,
|
|
21205
21764
|
outerBorder: outerBorder,
|
|
21206
21765
|
innerBorder: innerBorder
|
|
21207
21766
|
} = symbol.attribute,
|
|
21208
|
-
|
|
21209
|
-
|
|
21210
|
-
|
|
21211
|
-
|
|
21212
|
-
|
|
21213
|
-
|
|
21214
|
-
|
|
21215
|
-
|
|
21216
|
-
|
|
21217
|
-
|
|
21218
|
-
|
|
21767
|
+
doOuterBorder = outerBorder && !1 !== outerBorder.visible,
|
|
21768
|
+
doInnerBorder = innerBorder && !1 !== innerBorder.visible;
|
|
21769
|
+
if (!doOuterBorder && !doInnerBorder) return;
|
|
21770
|
+
const {
|
|
21771
|
+
size = symbolAttribute.size,
|
|
21772
|
+
opacity = symbolAttribute.opacity,
|
|
21773
|
+
x: originX = symbolAttribute.x,
|
|
21774
|
+
y: originY = symbolAttribute.y,
|
|
21775
|
+
scaleX = symbolAttribute.scaleX,
|
|
21776
|
+
scaleY = symbolAttribute.scaleY
|
|
21777
|
+
} = symbol.attribute,
|
|
21778
|
+
doStrokeOuter = !(!outerBorder || !outerBorder.stroke),
|
|
21779
|
+
doStrokeInner = !(!innerBorder || !innerBorder.stroke);
|
|
21780
|
+
if (doOuterBorder) {
|
|
21781
|
+
const {
|
|
21782
|
+
distance = symbolAttribute.outerBorder.distance
|
|
21783
|
+
} = outerBorder,
|
|
21784
|
+
d = getScaledStroke(context, distance, context.dpr);
|
|
21785
|
+
if (context.beginPath(), !1 === parsedPath.drawOffset(context, size, x, y, d) && context.closePath(), context.setShadowStyle && context.setShadowStyle(symbol, symbol.attribute, symbolAttribute), strokeCb) strokeCb(context, outerBorder, symbolAttribute.outerBorder);else if (doStrokeOuter) {
|
|
21786
|
+
const lastOpacity = symbolAttribute.outerBorder.opacity;
|
|
21787
|
+
symbolAttribute.outerBorder.opacity = opacity, context.setStrokeStyle(symbol, outerBorder, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute.outerBorder), symbolAttribute.outerBorder.opacity = lastOpacity, context.stroke();
|
|
21219
21788
|
}
|
|
21220
|
-
|
|
21221
|
-
|
|
21222
|
-
|
|
21223
|
-
|
|
21224
|
-
|
|
21225
|
-
|
|
21226
|
-
|
|
21227
|
-
|
|
21228
|
-
|
|
21789
|
+
}
|
|
21790
|
+
if (doInnerBorder) {
|
|
21791
|
+
const {
|
|
21792
|
+
distance = symbolAttribute.innerBorder.distance
|
|
21793
|
+
} = innerBorder,
|
|
21794
|
+
d = getScaledStroke(context, distance, context.dpr);
|
|
21795
|
+
if (context.beginPath(), !1 === parsedPath.drawOffset(context, size, x, y, -d) && context.closePath(), context.setShadowStyle && context.setShadowStyle(symbol, symbol.attribute, symbolAttribute), strokeCb) strokeCb(context, innerBorder, symbolAttribute.innerBorder);else if (doStrokeInner) {
|
|
21796
|
+
const lastOpacity = symbolAttribute.innerBorder.opacity;
|
|
21797
|
+
symbolAttribute.innerBorder.opacity = opacity, context.setStrokeStyle(symbol, innerBorder, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute.innerBorder), symbolAttribute.innerBorder.opacity = lastOpacity, context.stroke();
|
|
21229
21798
|
}
|
|
21230
21799
|
}
|
|
21231
21800
|
}
|
|
@@ -21575,7 +22144,7 @@
|
|
|
21575
22144
|
return picker || null;
|
|
21576
22145
|
}
|
|
21577
22146
|
};
|
|
21578
|
-
DefaultPickService = __decorate$1b([injectable(), __param$C(0, inject(
|
|
22147
|
+
DefaultPickService = __decorate$1b([injectable(), __param$C(0, inject(VGlobal)), __param$C(1, inject(ContributionProvider)), __param$C(1, named(PickItemInterceptor)), __metadata$R("design:paramtypes", [Object, Object])], DefaultPickService);
|
|
21579
22148
|
|
|
21580
22149
|
var __decorate$1a = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
21581
22150
|
var d,
|
|
@@ -21637,7 +22206,7 @@
|
|
|
21637
22206
|
return !1 === graphic.attribute.pickable ? null : graphic.AABBBounds.containsPoint(point) ? graphic : null;
|
|
21638
22207
|
}
|
|
21639
22208
|
};
|
|
21640
|
-
DefaultGlobalPickerService = __decorate$1a([injectable(), __param$B(0, inject(
|
|
22209
|
+
DefaultGlobalPickerService = __decorate$1a([injectable(), __param$B(0, inject(VGlobal)), __metadata$Q("design:paramtypes", [Object])], DefaultGlobalPickerService);
|
|
21641
22210
|
|
|
21642
22211
|
function lookAt(out, eye, center, up) {
|
|
21643
22212
|
let x0, x1, x2, y0, y1, y2, z0, z1, z2, len;
|
|
@@ -22487,7 +23056,7 @@
|
|
|
22487
23056
|
return picker && picker.contains(graphic, point, params) ? graphic : null;
|
|
22488
23057
|
}
|
|
22489
23058
|
};
|
|
22490
|
-
__decorate$17([postConstruct(), __metadata$N("design:type", Function), __metadata$N("design:paramtypes", []), __metadata$N("design:returntype", void 0)], DefaultCanvasPickerService.prototype, "init", null), DefaultCanvasPickerService = __decorate$17([injectable(), __param$A(0, inject(ContributionProvider)), __param$A(0, named(CanvasPickerContribution)), __param$A(1, inject(CanvasCirclePicker)), __param$A(2, inject(CanvasRectPicker)), __param$A(3, inject(CanvasArcPicker)), __param$A(4, inject(CanvasAreaPicker)), __param$A(5, inject(CanvasImagePicker)), __param$A(6, inject(CanvasLinePicker)), __param$A(7, inject(CanvasPathPicker)), __param$A(8, inject(CanvasSymbolPicker)), __param$A(9, inject(CanvasTextPicker)), __param$A(10, inject(CanvasPolygonPicker)), __param$A(11, inject(CanvasRichTextPicker)), __param$A(12, inject(DrawContribution)), __param$A(13, inject(
|
|
23059
|
+
__decorate$17([postConstruct(), __metadata$N("design:type", Function), __metadata$N("design:paramtypes", []), __metadata$N("design:returntype", void 0)], DefaultCanvasPickerService.prototype, "init", null), DefaultCanvasPickerService = __decorate$17([injectable(), __param$A(0, inject(ContributionProvider)), __param$A(0, named(CanvasPickerContribution)), __param$A(1, inject(CanvasCirclePicker)), __param$A(2, inject(CanvasRectPicker)), __param$A(3, inject(CanvasArcPicker)), __param$A(4, inject(CanvasAreaPicker)), __param$A(5, inject(CanvasImagePicker)), __param$A(6, inject(CanvasLinePicker)), __param$A(7, inject(CanvasPathPicker)), __param$A(8, inject(CanvasSymbolPicker)), __param$A(9, inject(CanvasTextPicker)), __param$A(10, inject(CanvasPolygonPicker)), __param$A(11, inject(CanvasRichTextPicker)), __param$A(12, inject(DrawContribution)), __param$A(13, inject(VGlobal)), __param$A(14, inject(ContributionProvider)), __param$A(14, named(PickItemInterceptor)), __metadata$N("design:paramtypes", [Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object])], DefaultCanvasPickerService);
|
|
22491
23060
|
|
|
22492
23061
|
var __decorate$16 = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
22493
23062
|
var d,
|
|
@@ -22740,7 +23309,7 @@
|
|
|
22740
23309
|
return picker && picker.contains(graphic, point, params) ? graphic : null;
|
|
22741
23310
|
}
|
|
22742
23311
|
};
|
|
22743
|
-
__decorate$15([postConstruct(), __metadata$L("design:type", Function), __metadata$L("design:paramtypes", []), __metadata$L("design:returntype", void 0)], DefaultMathPickerService.prototype, "init", null), DefaultMathPickerService = __decorate$15([injectable(), __param$z(0, inject(ContributionProvider)), __param$z(0, named(MathPickerContribution)), __param$z(1, inject(
|
|
23312
|
+
__decorate$15([postConstruct(), __metadata$L("design:type", Function), __metadata$L("design:paramtypes", []), __metadata$L("design:returntype", void 0)], DefaultMathPickerService.prototype, "init", null), DefaultMathPickerService = __decorate$15([injectable(), __param$z(0, inject(ContributionProvider)), __param$z(0, named(MathPickerContribution)), __param$z(1, inject(VGlobal)), __param$z(2, inject(ContributionProvider)), __param$z(2, named(PickItemInterceptor)), __metadata$L("design:paramtypes", [Object, Object, Object])], DefaultMathPickerService);
|
|
22744
23313
|
|
|
22745
23314
|
var pickModule = new ContainerModule(bind => {
|
|
22746
23315
|
bind(DefaultCanvasPickerService).toSelf().inSingletonScope(), bind(DefaultMathPickerService).toSelf().inSingletonScope(), bind(PickerService).toService(DefaultCanvasPickerService), bind(DefaultGlobalPickerService).toSelf().inSingletonScope(), bind(GlobalPickerService).toService(DefaultGlobalPickerService), bind(Canvas3DPickItemInterceptor).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(Canvas3DPickItemInterceptor), bindContributionProvider(bind, PickItemInterceptor);
|
|
@@ -23727,7 +24296,7 @@
|
|
|
23727
24296
|
context.nativeContext.save(), context.nativeContext.setTransform(dpr, 0, 0, dpr, 0, 0), context.clearRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1), color && (context.fillStyle = color, context.fillRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1)), context.nativeContext.restore();
|
|
23728
24297
|
}
|
|
23729
24298
|
};
|
|
23730
|
-
BrowserWindowHandlerContribution.env = "browser", BrowserWindowHandlerContribution = __decorate$X([injectable(), __param$x(0, inject(
|
|
24299
|
+
BrowserWindowHandlerContribution.env = "browser", BrowserWindowHandlerContribution = __decorate$X([injectable(), __param$x(0, inject(VGlobal)), __metadata$D("design:paramtypes", [Object])], BrowserWindowHandlerContribution);
|
|
23731
24300
|
|
|
23732
24301
|
var __decorate$W = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
23733
24302
|
var d,
|
|
@@ -24028,7 +24597,7 @@
|
|
|
24028
24597
|
context.nativeContext.save(), context.nativeContext.setTransform(dpr, 0, 0, dpr, 0, 0), context.clearRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1), color && (context.fillStyle = color, context.fillRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1)), context.nativeContext.restore();
|
|
24029
24598
|
}
|
|
24030
24599
|
};
|
|
24031
|
-
FeishuWindowHandlerContribution.env = "feishu", FeishuWindowHandlerContribution = __decorate$U([injectable(), __param$w(0, inject(
|
|
24600
|
+
FeishuWindowHandlerContribution.env = "feishu", FeishuWindowHandlerContribution = __decorate$U([injectable(), __param$w(0, inject(VGlobal)), __metadata$B("design:paramtypes", [Object])], FeishuWindowHandlerContribution);
|
|
24032
24601
|
|
|
24033
24602
|
var __decorate$T = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
24034
24603
|
var d,
|
|
@@ -24358,7 +24927,7 @@
|
|
|
24358
24927
|
context.nativeContext.save(), context.nativeContext.setTransform(dpr, 0, 0, dpr, 0, 0), context.clearRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1), color && (context.fillStyle = color, context.fillRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1)), context.nativeContext.restore();
|
|
24359
24928
|
}
|
|
24360
24929
|
};
|
|
24361
|
-
TaroWindowHandlerContribution.env = "taro", TaroWindowHandlerContribution = __decorate$R([injectable(), __param$v(0, inject(
|
|
24930
|
+
TaroWindowHandlerContribution.env = "taro", TaroWindowHandlerContribution = __decorate$R([injectable(), __param$v(0, inject(VGlobal)), __metadata$z("design:paramtypes", [Object])], TaroWindowHandlerContribution);
|
|
24362
24931
|
|
|
24363
24932
|
var __decorate$Q = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
24364
24933
|
var d,
|
|
@@ -24668,7 +25237,7 @@
|
|
|
24668
25237
|
context.nativeContext.save(), context.nativeContext.setTransform(dpr, 0, 0, dpr, 0, 0), context.clearRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1), color && (context.fillStyle = color, context.fillRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1)), context.nativeContext.restore();
|
|
24669
25238
|
}
|
|
24670
25239
|
};
|
|
24671
|
-
LynxWindowHandlerContribution.env = "lynx", LynxWindowHandlerContribution = __decorate$O([injectable(), __param$u(0, inject(
|
|
25240
|
+
LynxWindowHandlerContribution.env = "lynx", LynxWindowHandlerContribution = __decorate$O([injectable(), __param$u(0, inject(VGlobal)), __metadata$x("design:paramtypes", [Object])], LynxWindowHandlerContribution);
|
|
24672
25241
|
|
|
24673
25242
|
var __decorate$N = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
24674
25243
|
var d,
|
|
@@ -24893,7 +25462,7 @@
|
|
|
24893
25462
|
}
|
|
24894
25463
|
clearViewBox(vb, color) {}
|
|
24895
25464
|
};
|
|
24896
|
-
NodeWindowHandlerContribution.env = "node", NodeWindowHandlerContribution = __decorate$L([injectable(), __param$t(0, inject(
|
|
25465
|
+
NodeWindowHandlerContribution.env = "node", NodeWindowHandlerContribution = __decorate$L([injectable(), __param$t(0, inject(VGlobal)), __metadata$u("design:paramtypes", [Object])], NodeWindowHandlerContribution);
|
|
24897
25466
|
|
|
24898
25467
|
var __decorate$K = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
24899
25468
|
var d,
|
|
@@ -25163,7 +25732,7 @@
|
|
|
25163
25732
|
context.nativeContext.save(), context.nativeContext.setTransform(dpr, 0, 0, dpr, 0, 0), context.clearRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1), color && (context.fillStyle = color, context.fillRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1)), context.nativeContext.restore();
|
|
25164
25733
|
}
|
|
25165
25734
|
};
|
|
25166
|
-
WxWindowHandlerContribution.env = "wx", WxWindowHandlerContribution = __decorate$I([injectable(), __param$s(0, inject(
|
|
25735
|
+
WxWindowHandlerContribution.env = "wx", WxWindowHandlerContribution = __decorate$I([injectable(), __param$s(0, inject(VGlobal)), __metadata$s("design:paramtypes", [Object])], WxWindowHandlerContribution);
|
|
25167
25736
|
|
|
25168
25737
|
var windowModules = new ContainerModule(bind => {
|
|
25169
25738
|
bind(BrowserWindowHandlerContribution).toSelf(), bind(WindowHandlerContribution).toDynamicValue(ctx => ctx.container.get(BrowserWindowHandlerContribution)).whenTargetNamed(BrowserWindowHandlerContribution.env), bind(FeishuWindowHandlerContribution).toSelf(), bind(WindowHandlerContribution).toDynamicValue(ctx => ctx.container.get(FeishuWindowHandlerContribution)).whenTargetNamed(FeishuWindowHandlerContribution.env), bind(TaroWindowHandlerContribution).toSelf(), bind(WindowHandlerContribution).toDynamicValue(ctx => ctx.container.get(TaroWindowHandlerContribution)).whenTargetNamed(TaroWindowHandlerContribution.env), bind(LynxWindowHandlerContribution).toSelf(), bind(WindowHandlerContribution).toDynamicValue(ctx => ctx.container.get(LynxWindowHandlerContribution)).whenTargetNamed(LynxWindowHandlerContribution.env), bind(WxWindowHandlerContribution).toSelf(), bind(WindowHandlerContribution).toDynamicValue(ctx => ctx.container.get(WxWindowHandlerContribution)).whenTargetNamed(WxWindowHandlerContribution.env), bind(NodeWindowHandlerContribution).toSelf(), bind(WindowHandlerContribution).toDynamicValue(ctx => ctx.container.get(NodeWindowHandlerContribution)).whenTargetNamed(NodeWindowHandlerContribution.env);
|
|
@@ -25251,7 +25820,7 @@
|
|
|
25251
25820
|
this.canvas.release();
|
|
25252
25821
|
}
|
|
25253
25822
|
};
|
|
25254
|
-
CanvasLayerHandlerContribution = __decorate$H([injectable(), __param$r(0, inject(
|
|
25823
|
+
CanvasLayerHandlerContribution = __decorate$H([injectable(), __param$r(0, inject(VGlobal)), __metadata$r("design:paramtypes", [Object])], CanvasLayerHandlerContribution);
|
|
25255
25824
|
|
|
25256
25825
|
var __decorate$G = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
25257
25826
|
var d,
|
|
@@ -25324,7 +25893,7 @@
|
|
|
25324
25893
|
}
|
|
25325
25894
|
merge(layerHandlers) {}
|
|
25326
25895
|
};
|
|
25327
|
-
OffscreenLayerHandlerContribution = __decorate$G([injectable(), __param$q(0, inject(
|
|
25896
|
+
OffscreenLayerHandlerContribution = __decorate$G([injectable(), __param$q(0, inject(VGlobal)), __metadata$q("design:paramtypes", [Object])], OffscreenLayerHandlerContribution);
|
|
25328
25897
|
|
|
25329
25898
|
var layerHandlerModules = new ContainerModule(bind => {
|
|
25330
25899
|
bind(CanvasLayerHandlerContribution).toSelf(), bind(OffscreenLayerHandlerContribution).toSelf(), bind(LayerHandlerContribution).toService(CanvasLayerHandlerContribution);
|
|
@@ -25958,7 +26527,7 @@
|
|
|
25958
26527
|
});
|
|
25959
26528
|
}
|
|
25960
26529
|
};
|
|
25961
|
-
__decorate$z([inject(
|
|
26530
|
+
__decorate$z([inject(VGlobal), __metadata$n("design:type", Object)], DefaultIncrementalDrawContribution.prototype, "global", void 0), DefaultIncrementalDrawContribution = __decorate$z([injectable(), __param$n(0, multiInject(GraphicRender)), __param$n(1, inject(RenderSelector)), __param$n(2, inject(DefaultIncrementalCanvasLineRender)), __param$n(3, inject(DefaultIncrementalCanvasAreaRender)), __param$n(4, inject(LayerService)), __param$n(5, inject(ContributionProvider)), __param$n(5, named(DrawItemInterceptor)), __metadata$n("design:paramtypes", [Array, Object, Object, Object, Object, Object])], DefaultIncrementalDrawContribution);
|
|
25962
26531
|
|
|
25963
26532
|
var __decorate$y = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
25964
26533
|
var d,
|
|
@@ -27749,8 +28318,8 @@
|
|
|
27749
28318
|
}
|
|
27750
28319
|
|
|
27751
28320
|
container.load(coreModule), container.load(graphicModule), container.load(renderModule$1), container.load(pickModule), container.load(pluginModule), load$3(container), load$2(container), load$1(container), load(container);
|
|
27752
|
-
const
|
|
27753
|
-
application.global =
|
|
28321
|
+
const vglobal = container.get(VGlobal);
|
|
28322
|
+
application.global = vglobal;
|
|
27754
28323
|
const graphicUtil = container.get(GraphicUtil);
|
|
27755
28324
|
application.graphicUtil = graphicUtil;
|
|
27756
28325
|
const transformUtil = container.get(TransformUtil);
|
|
@@ -27871,6 +28440,164 @@
|
|
|
27871
28440
|
}
|
|
27872
28441
|
}
|
|
27873
28442
|
|
|
28443
|
+
class FlexLayoutPlugin {
|
|
28444
|
+
constructor() {
|
|
28445
|
+
this.name = "FlexLayoutPlugin", this.activeEvent = "onRegister", this.id = Generator.GenAutoIncrementId(), this.key = this.name + this.id;
|
|
28446
|
+
}
|
|
28447
|
+
tryLayout(graphic) {
|
|
28448
|
+
const p = graphic.parent;
|
|
28449
|
+
if (!p) return;
|
|
28450
|
+
const theme = getTheme(p).group,
|
|
28451
|
+
{
|
|
28452
|
+
display = theme.display
|
|
28453
|
+
} = p.attribute;
|
|
28454
|
+
if ("flex" !== display) return;
|
|
28455
|
+
const {
|
|
28456
|
+
width: width,
|
|
28457
|
+
height: height,
|
|
28458
|
+
flexDirection = theme.flexDirection,
|
|
28459
|
+
flexWrap = theme.flexWrap,
|
|
28460
|
+
justifyContent = theme.justifyContent,
|
|
28461
|
+
alignItems = theme.alignItems,
|
|
28462
|
+
alignContent = theme.alignContent
|
|
28463
|
+
} = p.attribute;
|
|
28464
|
+
if (!width || !height) return;
|
|
28465
|
+
const result = {
|
|
28466
|
+
main: {
|
|
28467
|
+
len: width,
|
|
28468
|
+
field: "x"
|
|
28469
|
+
},
|
|
28470
|
+
cross: {
|
|
28471
|
+
len: height,
|
|
28472
|
+
field: "y"
|
|
28473
|
+
},
|
|
28474
|
+
dir: 1
|
|
28475
|
+
},
|
|
28476
|
+
main = result.main,
|
|
28477
|
+
cross = result.cross;
|
|
28478
|
+
"row-reverse" === flexDirection ? result.dir = -1 : "column" === flexDirection ? (main.len = height, cross.len = width, main.field = "y", cross.field = "x") : "column-reverse" === flexDirection && (main.len = height, cross.len = width, main.field = "y", cross.field = "x", result.dir = -1);
|
|
28479
|
+
let mainLen = 0,
|
|
28480
|
+
crossLen = 0;
|
|
28481
|
+
const mianLenArray = [];
|
|
28482
|
+
p.forEachChildren(c => {
|
|
28483
|
+
const b = c.AABBBounds,
|
|
28484
|
+
ml = "x" === main.field ? b.width() : b.height(),
|
|
28485
|
+
cl = "x" === cross.field ? b.width() : b.height();
|
|
28486
|
+
mianLenArray.push({
|
|
28487
|
+
mainLen: ml,
|
|
28488
|
+
crossLen: cl
|
|
28489
|
+
}), mainLen += ml, crossLen = Math.max(crossLen, cl);
|
|
28490
|
+
});
|
|
28491
|
+
const mainList = [];
|
|
28492
|
+
if (mainLen > main.len && "wrap" === flexWrap) {
|
|
28493
|
+
let tempMainL = 0,
|
|
28494
|
+
tempCrossL = 0;
|
|
28495
|
+
mianLenArray.forEach((_ref, i) => {
|
|
28496
|
+
let {
|
|
28497
|
+
mainLen: mainLen,
|
|
28498
|
+
crossLen: crossLen
|
|
28499
|
+
} = _ref;
|
|
28500
|
+
tempMainL + mainLen > main.len ? 0 === tempMainL ? (mainList.push({
|
|
28501
|
+
idx: i,
|
|
28502
|
+
mainLen: tempMainL + mainLen,
|
|
28503
|
+
crossLen: crossLen
|
|
28504
|
+
}), tempMainL = 0, tempCrossL = 0) : (mainList.push({
|
|
28505
|
+
idx: i - 1,
|
|
28506
|
+
mainLen: tempMainL,
|
|
28507
|
+
crossLen: crossLen
|
|
28508
|
+
}), tempMainL = mainLen, tempCrossL = crossLen) : (tempMainL += mainLen, tempCrossL = Math.max(tempCrossL, crossLen));
|
|
28509
|
+
}), mainList.push({
|
|
28510
|
+
idx: mianLenArray.length - 1,
|
|
28511
|
+
mainLen: tempMainL,
|
|
28512
|
+
crossLen: tempCrossL
|
|
28513
|
+
});
|
|
28514
|
+
} else mainList.push({
|
|
28515
|
+
idx: mianLenArray.length - 1,
|
|
28516
|
+
mainLen: mainLen,
|
|
28517
|
+
crossLen: crossLen
|
|
28518
|
+
});
|
|
28519
|
+
const children = p.getChildren();
|
|
28520
|
+
let lastIdx = 0;
|
|
28521
|
+
if (mainList.forEach(s => {
|
|
28522
|
+
this.layoutMain(p, children, justifyContent, main, mianLenArray, lastIdx, s), lastIdx = s.idx + 1;
|
|
28523
|
+
}), crossLen = mainList.reduce((a, b) => a + b.crossLen, 0), 1 === mainList.length) {
|
|
28524
|
+
if ("flex-end" === alignItems) {
|
|
28525
|
+
const anchorPos = cross.len;
|
|
28526
|
+
this.layoutCross(children, alignItems, cross, anchorPos, mianLenArray, mainList[0], 0);
|
|
28527
|
+
} else if ("center" === alignItems) {
|
|
28528
|
+
const anchorPos = cross.len / 2;
|
|
28529
|
+
this.layoutCross(children, alignItems, cross, anchorPos, mianLenArray, mainList[0], 0);
|
|
28530
|
+
}
|
|
28531
|
+
} else if ("flex-start" === alignContent) {
|
|
28532
|
+
lastIdx = 0;
|
|
28533
|
+
let anchorPos = 0;
|
|
28534
|
+
mainList.forEach((s, i) => {
|
|
28535
|
+
this.layoutCross(children, "flex-start", cross, anchorPos, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, anchorPos += s.crossLen;
|
|
28536
|
+
});
|
|
28537
|
+
} else if ("center" === alignContent) {
|
|
28538
|
+
lastIdx = 0;
|
|
28539
|
+
let anchorPos = Math.max(0, (cross.len - crossLen) / 2);
|
|
28540
|
+
mainList.forEach((s, i) => {
|
|
28541
|
+
this.layoutCross(children, "center", cross, anchorPos + s.crossLen / 2, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, anchorPos += s.crossLen;
|
|
28542
|
+
});
|
|
28543
|
+
} else if ("space-around" === alignContent) {
|
|
28544
|
+
lastIdx = 0;
|
|
28545
|
+
const padding = Math.max(0, (cross.len - crossLen) / mainList.length / 2);
|
|
28546
|
+
let anchorPos = padding;
|
|
28547
|
+
mainList.forEach((s, i) => {
|
|
28548
|
+
this.layoutCross(children, "flex-start", cross, anchorPos, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, anchorPos += s.crossLen + 2 * padding;
|
|
28549
|
+
});
|
|
28550
|
+
} else if ("space-between" === alignContent) {
|
|
28551
|
+
lastIdx = 0;
|
|
28552
|
+
const padding = Math.max(0, (cross.len - crossLen) / (2 * mainList.length - 2));
|
|
28553
|
+
let anchorPos = 0;
|
|
28554
|
+
mainList.forEach((s, i) => {
|
|
28555
|
+
this.layoutCross(children, "flex-start", cross, anchorPos, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, anchorPos += s.crossLen + 2 * padding;
|
|
28556
|
+
});
|
|
28557
|
+
}
|
|
28558
|
+
}
|
|
28559
|
+
layoutMain(p, children, justifyContent, main, mianLenArray, lastIdx, currSeg) {
|
|
28560
|
+
if ("flex-start" === justifyContent) {
|
|
28561
|
+
let pos = 0;
|
|
28562
|
+
for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[main.field] = pos, pos += mianLenArray[i].mainLen;
|
|
28563
|
+
} else if ("flex-end" === justifyContent) {
|
|
28564
|
+
let pos = main.len;
|
|
28565
|
+
for (let i = lastIdx; i <= currSeg.idx; i++) pos -= mianLenArray[i].mainLen, children[i].attribute[main.field] = pos;
|
|
28566
|
+
} else if ("space-around" === justifyContent) {
|
|
28567
|
+
if (currSeg.mainLen >= main.len) {
|
|
28568
|
+
let pos = 0;
|
|
28569
|
+
for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[main.field] = pos, pos += mianLenArray[i].mainLen;
|
|
28570
|
+
} else {
|
|
28571
|
+
const size = currSeg.idx - lastIdx + 1,
|
|
28572
|
+
padding = (main.len - currSeg.mainLen) / size / 2;
|
|
28573
|
+
let pos = padding;
|
|
28574
|
+
for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[main.field] = pos, pos += mianLenArray[i].mainLen + 2 * padding;
|
|
28575
|
+
}
|
|
28576
|
+
} else if ("space-between" === justifyContent) if (currSeg.mainLen >= main.len) {
|
|
28577
|
+
let pos = 0;
|
|
28578
|
+
for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[main.field] = pos, pos += mianLenArray[i].mainLen;
|
|
28579
|
+
} else {
|
|
28580
|
+
const size = currSeg.idx - lastIdx + 1,
|
|
28581
|
+
padding = (main.len - currSeg.mainLen) / (2 * size - 2);
|
|
28582
|
+
let pos = 0;
|
|
28583
|
+
for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[main.field] = pos, pos += mianLenArray[i].mainLen + 2 * padding;
|
|
28584
|
+
}
|
|
28585
|
+
}
|
|
28586
|
+
layoutCross(children, alignItem, cross, anchorPos, lenArray, currSeg, lastIdx) {
|
|
28587
|
+
if ("flex-end" === alignItem) for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[cross.field] = anchorPos - lenArray[i].crossLen;else if ("center" === alignItem) for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[cross.field] = anchorPos - lenArray[i].crossLen / 2;else for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[cross.field] = anchorPos;
|
|
28588
|
+
}
|
|
28589
|
+
activate(context) {
|
|
28590
|
+
this.pluginService = context, graphicService.hooks.onAttributeUpdate.tap(this.key, graphic => {
|
|
28591
|
+
graphic.glyphHost && (graphic = graphic.glyphHost), this.tryLayout(graphic);
|
|
28592
|
+
}), graphicService.hooks.onSetStage.tap(this.key, graphic => {
|
|
28593
|
+
graphic.glyphHost && (graphic = graphic.glyphHost), this.tryLayout(graphic);
|
|
28594
|
+
});
|
|
28595
|
+
}
|
|
28596
|
+
deactivate(context) {
|
|
28597
|
+
graphicService.hooks.onAttributeUpdate.taps = graphicService.hooks.onAttributeUpdate.taps.filter(item => item.name !== this.key), graphicService.hooks.onSetStage.taps = graphicService.hooks.onSetStage.taps.filter(item => item.name !== this.key);
|
|
28598
|
+
}
|
|
28599
|
+
}
|
|
28600
|
+
|
|
27874
28601
|
const defaultTicker = new DefaultTicker();
|
|
27875
28602
|
defaultTicker.addTimeline(defaultTimeline);
|
|
27876
28603
|
defaultTicker.setFPS(60);
|
|
@@ -27969,7 +28696,7 @@
|
|
|
27969
28696
|
}, this.theme = new Theme(), this.hooks = {
|
|
27970
28697
|
beforeRender: new SyncHook(["stage"]),
|
|
27971
28698
|
afterRender: new SyncHook(["stage"])
|
|
27972
|
-
}, this.global = container.get(
|
|
28699
|
+
}, this.global = container.get(VGlobal), this.window = container.get(VWindow), this.renderService = container.get(RenderService), this.pickerService = container.get(PickerService), this.pluginService = container.get(PluginService), this.layerService = container.get(LayerService), this.pluginService.active(this, params), this.window.create({
|
|
27973
28700
|
width: params.width,
|
|
27974
28701
|
height: params.height,
|
|
27975
28702
|
container: params.container,
|
|
@@ -27999,7 +28726,7 @@
|
|
|
27999
28726
|
return this.viewBox.height();
|
|
28000
28727
|
}
|
|
28001
28728
|
}
|
|
28002
|
-
})), params.autoRender && this.enableAutoRender(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), this._beforeRender = params.beforeRender, this._afterRender = params.afterRender, this.ticker = params.ticker || defaultTicker, this.supportInteractiveLayer = !1 !== params.interactiveLayer;
|
|
28729
|
+
})), params.autoRender && this.enableAutoRender(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), this._beforeRender = params.beforeRender, this._afterRender = params.afterRender, this.ticker = params.ticker || defaultTicker, this.supportInteractiveLayer = !1 !== params.interactiveLayer;
|
|
28003
28730
|
}
|
|
28004
28731
|
get3dOptions(options) {
|
|
28005
28732
|
const {
|
|
@@ -28112,6 +28839,14 @@
|
|
|
28112
28839
|
plugin.deactivate(this.pluginService);
|
|
28113
28840
|
}));
|
|
28114
28841
|
}
|
|
28842
|
+
enableLayout() {
|
|
28843
|
+
this._enableLayout || (this._enableLayout = !0, this.pluginService.register(new FlexLayoutPlugin()));
|
|
28844
|
+
}
|
|
28845
|
+
disableLayout() {
|
|
28846
|
+
this._enableLayout && (this._enableLayout = !1, this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach(plugin => {
|
|
28847
|
+
plugin.deactivate(this.pluginService);
|
|
28848
|
+
}));
|
|
28849
|
+
}
|
|
28115
28850
|
tryUpdateAABBBounds() {
|
|
28116
28851
|
const viewBox = this._viewBox;
|
|
28117
28852
|
return this._AABBBounds.setValue(viewBox.x1, viewBox.y1, viewBox.x2, viewBox.y2), this._AABBBounds;
|
|
@@ -28256,7 +28991,7 @@
|
|
|
28256
28991
|
}
|
|
28257
28992
|
renderToNewWindow() {
|
|
28258
28993
|
let fullImage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
|
|
28259
|
-
const window = container.get(
|
|
28994
|
+
const window = container.get(VWindow);
|
|
28260
28995
|
return fullImage ? window.create({
|
|
28261
28996
|
width: this.viewWidth,
|
|
28262
28997
|
height: this.viewHeight,
|
|
@@ -28376,7 +29111,7 @@
|
|
|
28376
29111
|
const {
|
|
28377
29112
|
direction: direction
|
|
28378
29113
|
} = this.attribute;
|
|
28379
|
-
this._prePos = "horizontal" === direction ? e.clientX : e.clientY, "browser" ===
|
|
29114
|
+
this._prePos = "horizontal" === direction ? e.clientX : e.clientY, "browser" === vglobal.env ? (vglobal.addEventListener("pointermove", this._onSliderPointerMove), vglobal.addEventListener("pointerup", this._onSliderPointerUp)) : (this._slider.addEventListener("pointermove", this._onSliderPointerMove), this._slider.addEventListener("pointerup", this._onSliderPointerUp), this._slider.addEventListener("pointerupoutside", this._onSliderPointerUp));
|
|
28380
29115
|
}, this._onSliderPointerMove = e => {
|
|
28381
29116
|
e.stopPropagation();
|
|
28382
29117
|
const {
|
|
@@ -28392,7 +29127,7 @@
|
|
|
28392
29127
|
} = this._getSliderRenderBounds();
|
|
28393
29128
|
"vertical" === direction ? (currentPos = e.clientY, delta = currentPos - this._prePos, currentScrollValue = delta / height) : (currentPos = e.clientX, delta = currentPos - this._prePos, currentScrollValue = delta / width), this.setScrollRange([preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue], !0), this._prePos = currentPos;
|
|
28394
29129
|
}, this._onSliderPointerUp = e => {
|
|
28395
|
-
e.preventDefault(), "browser" ===
|
|
29130
|
+
e.preventDefault(), "browser" === vglobal.env ? (vglobal.removeEventListener("pointermove", this._onSliderPointerMove), vglobal.removeEventListener("pointerup", this._onSliderPointerUp)) : (this._slider.removeEventListener("pointermove", this._onSliderPointerMove), this._slider.removeEventListener("pointerup", this._onSliderPointerUp), this._slider.removeEventListener("pointerupoutside", this._onSliderPointerUp));
|
|
28396
29131
|
};
|
|
28397
29132
|
}
|
|
28398
29133
|
setScrollRange(range) {
|
|
@@ -28989,7 +29724,7 @@
|
|
|
28989
29724
|
|
|
28990
29725
|
var AXIS_ELEMENT_NAME;
|
|
28991
29726
|
!function (AXIS_ELEMENT_NAME) {
|
|
28992
|
-
AXIS_ELEMENT_NAME.innerView = "inner-view", AXIS_ELEMENT_NAME.axisContainer = "axis-container", AXIS_ELEMENT_NAME.labelContainer = "axis-label-container", AXIS_ELEMENT_NAME.tickContainer = "axis-tick-container", AXIS_ELEMENT_NAME.tick = "axis-tick", AXIS_ELEMENT_NAME.subTick = "axis-sub-tick", AXIS_ELEMENT_NAME.label = "axis-label", AXIS_ELEMENT_NAME.title = "axis-title", AXIS_ELEMENT_NAME.gridContainer = "axis-grid-container", AXIS_ELEMENT_NAME.grid = "axis-grid", AXIS_ELEMENT_NAME.gridRegion = "axis-grid-region", AXIS_ELEMENT_NAME.line = "axis-line", AXIS_ELEMENT_NAME.background = "axis-background";
|
|
29727
|
+
AXIS_ELEMENT_NAME.innerView = "inner-view", AXIS_ELEMENT_NAME.axisContainer = "axis-container", AXIS_ELEMENT_NAME.labelContainer = "axis-label-container", AXIS_ELEMENT_NAME.tickContainer = "axis-tick-container", AXIS_ELEMENT_NAME.tick = "axis-tick", AXIS_ELEMENT_NAME.subTick = "axis-sub-tick", AXIS_ELEMENT_NAME.label = "axis-label", AXIS_ELEMENT_NAME.title = "axis-title", AXIS_ELEMENT_NAME.gridContainer = "axis-grid-container", AXIS_ELEMENT_NAME.grid = "axis-grid", AXIS_ELEMENT_NAME.gridRegion = "axis-grid-region", AXIS_ELEMENT_NAME.line = "axis-line", AXIS_ELEMENT_NAME.background = "axis-background", AXIS_ELEMENT_NAME.axisLabelBackground = "axis-label-background";
|
|
28993
29728
|
}(AXIS_ELEMENT_NAME || (AXIS_ELEMENT_NAME = {}));
|
|
28994
29729
|
var AxisStateValue;
|
|
28995
29730
|
!function (AxisStateValue) {
|
|
@@ -29140,8 +29875,7 @@
|
|
|
29140
29875
|
tick: tick,
|
|
29141
29876
|
line: line,
|
|
29142
29877
|
grid: grid,
|
|
29143
|
-
items: items
|
|
29144
|
-
panel: panel
|
|
29878
|
+
items: items
|
|
29145
29879
|
} = this.attribute,
|
|
29146
29880
|
axisContainer = createGroup({
|
|
29147
29881
|
x: 0,
|
|
@@ -29156,22 +29890,14 @@
|
|
|
29156
29890
|
pickable: !1
|
|
29157
29891
|
});
|
|
29158
29892
|
labelGroup.name = AXIS_ELEMENT_NAME.labelContainer, labelGroup.id = this._getNodeId("label-container"), this.axisLabelsContainer = labelGroup, axisContainer.add(labelGroup), items.forEach((axisItems, layer) => {
|
|
29159
|
-
const
|
|
29160
|
-
|
|
29893
|
+
const layerLabelGroup = this.renderLabels(labelGroup, axisItems, layer),
|
|
29894
|
+
labels = layerLabelGroup.getChildren();
|
|
29895
|
+
this.beforeLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length), this.handleLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length), this.afterLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);
|
|
29161
29896
|
});
|
|
29162
29897
|
}
|
|
29163
29898
|
(null == grid ? void 0 : grid.visible) && this.renderGrid(container);
|
|
29164
29899
|
}
|
|
29165
|
-
|
|
29166
|
-
const axisContainerBounds = axisContainer.AABBBounds,
|
|
29167
|
-
bgRect = createRect(Object.assign({
|
|
29168
|
-
x: axisContainerBounds.x1,
|
|
29169
|
-
y: axisContainerBounds.y1,
|
|
29170
|
-
width: axisContainerBounds.width(),
|
|
29171
|
-
height: axisContainerBounds.height()
|
|
29172
|
-
}, panel.style));
|
|
29173
|
-
bgRect.name = AXIS_ELEMENT_NAME.background, bgRect.id = this._getNodeId("background"), isEmpty(panel.state) || (bgRect.states = merge$2({}, DEFAULT_STATES$2, panel.state)), axisContainer.insertBefore(bgRect, axisContainer.firstChild);
|
|
29174
|
-
}
|
|
29900
|
+
(null == title ? void 0 : title.visible) && this.renderTitle(axisContainer);
|
|
29175
29901
|
}
|
|
29176
29902
|
renderTicks(container) {
|
|
29177
29903
|
const tickLineItems = this.getTickLineItems(),
|
|
@@ -29183,7 +29909,7 @@
|
|
|
29183
29909
|
tickLineGroup.name = AXIS_ELEMENT_NAME.tickContainer, tickLineGroup.id = this._getNodeId("tick-container"), container.add(tickLineGroup), tickLineItems.forEach((item, index) => {
|
|
29184
29910
|
var _a;
|
|
29185
29911
|
const line = createLine(Object.assign({}, this._getTickLineAttribute("tick", item, index, tickLineItems)));
|
|
29186
|
-
if (line.name = AXIS_ELEMENT_NAME.tick, line.id = this._getNodeId(item.id), isEmpty(null === (_a = this.attribute.tick) || void 0 === _a ? void 0 : _a.state)) line.states =
|
|
29912
|
+
if (line.name = AXIS_ELEMENT_NAME.tick, line.id = this._getNodeId(item.id), isEmpty(null === (_a = this.attribute.tick) || void 0 === _a ? void 0 : _a.state)) line.states = DEFAULT_STATES$2;else {
|
|
29187
29913
|
const data = this.data[index],
|
|
29188
29914
|
tickLineState = merge$2({}, DEFAULT_STATES$2, this.attribute.tick.state);
|
|
29189
29915
|
Object.keys(tickLineState).forEach(key => {
|
|
@@ -29199,7 +29925,7 @@
|
|
|
29199
29925
|
const subTickLineItems = this.getSubTickLineItems();
|
|
29200
29926
|
subTickLineItems.length && subTickLineItems.forEach((item, index) => {
|
|
29201
29927
|
const line = createLine(Object.assign({}, this._getTickLineAttribute("subTick", item, index, tickLineItems)));
|
|
29202
|
-
if (line.name = AXIS_ELEMENT_NAME.subTick, line.id = this._getNodeId(`${index}`), isEmpty(subTick.state)) line.states =
|
|
29928
|
+
if (line.name = AXIS_ELEMENT_NAME.subTick, line.id = this._getNodeId(`${index}`), isEmpty(subTick.state)) line.states = DEFAULT_STATES$2;else {
|
|
29203
29929
|
const subTickLineState = merge$2({}, DEFAULT_STATES$2, subTick.state);
|
|
29204
29930
|
Object.keys(subTickLineState).forEach(key => {
|
|
29205
29931
|
isFunction(subTickLineState[key]) && (subTickLineState[key] = subTickLineState[key](item.value, index, item, tickLineItems));
|
|
@@ -29229,7 +29955,7 @@
|
|
|
29229
29955
|
var _a, _b;
|
|
29230
29956
|
const labelStyle = this._getLabelAttribute(item, index, data, layer),
|
|
29231
29957
|
text = createText(labelStyle);
|
|
29232
|
-
if (text.name = AXIS_ELEMENT_NAME.label, text.id = this._getNodeId(`layer${layer}-label-${item.id}`), isEmpty(null === (_a = this.attribute.label) || void 0 === _a ? void 0 : _a.state)) text.states =
|
|
29958
|
+
if (text.name = AXIS_ELEMENT_NAME.label, text.id = this._getNodeId(`layer${layer}-label-${item.id}`), isEmpty(null === (_a = this.attribute.label) || void 0 === _a ? void 0 : _a.state)) text.states = DEFAULT_STATES$2;else {
|
|
29233
29959
|
const labelState = merge$2({}, DEFAULT_STATES$2, this.attribute.label.state);
|
|
29234
29960
|
Object.keys(labelState).forEach(key => {
|
|
29235
29961
|
isFunction(labelState[key]) && (labelState[key] = labelState[key](item, index, data, layer));
|
|
@@ -29378,10 +30104,9 @@
|
|
|
29378
30104
|
let {
|
|
29379
30105
|
style: textStyle
|
|
29380
30106
|
} = tagAttributes;
|
|
29381
|
-
|
|
29382
|
-
|
|
29383
|
-
|
|
29384
|
-
}, textStyle), isFunction(textStyle.text) && (textStyle.text = textStyle.text({
|
|
30107
|
+
textStyle = isFunction(textStyle) ? merge$2({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer)) : textStyle;
|
|
30108
|
+
const labelAlign = this.getLabelAlign(vector, inside, textStyle.angle);
|
|
30109
|
+
return textStyle = merge$2(labelAlign, textStyle), isFunction(textStyle.text) && (textStyle.text = textStyle.text({
|
|
29385
30110
|
label: tickDatum.label,
|
|
29386
30111
|
value: tickDatum.rawValue,
|
|
29387
30112
|
index: tickDatum.index,
|
|
@@ -29509,37 +30234,49 @@
|
|
|
29509
30234
|
bounds.x1 += deltaX, bounds.x2 += deltaX, bounds.y1 += deltaY, bounds.y2 += deltaY, bounds.centerX += deltaX, bounds.centerY += deltaY, item.rotatedBounds = bounds;
|
|
29510
30235
|
});
|
|
29511
30236
|
}
|
|
30237
|
+
function clampAngle() {
|
|
30238
|
+
let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
30239
|
+
if (angle < 0) for (; angle < 0;) angle += 2 * Math.PI;
|
|
30240
|
+
if (angle > 0) for (; angle >= 2 * Math.PI;) angle -= 2 * Math.PI;
|
|
30241
|
+
return angle;
|
|
30242
|
+
}
|
|
29512
30243
|
function rotateYAxis(orient, items) {
|
|
29513
|
-
|
|
29514
|
-
|
|
29515
|
-
|
|
29516
|
-
|
|
29517
|
-
if (angle < 0) for (; angle < 0;) angle += 2 * Math.PI;
|
|
29518
|
-
if (angle > 0) for (; angle >= 2 * Math.PI;) angle -= 2 * Math.PI;
|
|
29519
|
-
const step = angle / (.5 * Math.PI);
|
|
29520
|
-
let index;
|
|
29521
|
-
index = step === Math.floor(step) ? 2 * Math.floor(step) : 2 * Math.floor(step) + 1, item.setAttributes({
|
|
29522
|
-
textAlign: align[index],
|
|
29523
|
-
textBaseline: baseline[index],
|
|
29524
|
-
angle: angle
|
|
29525
|
-
});
|
|
30244
|
+
items.forEach((item, i) => {
|
|
30245
|
+
item.setAttributes(Object.assign(Object.assign({}, getYAxisLabelAlign(orient, item.attribute.angle)), {
|
|
30246
|
+
angle: clampAngle(item.attribute.angle)
|
|
30247
|
+
}));
|
|
29526
30248
|
});
|
|
29527
30249
|
}
|
|
29528
30250
|
function rotateXAxis(orient, items) {
|
|
30251
|
+
items.forEach(item => {
|
|
30252
|
+
item.setAttributes(Object.assign(Object.assign({}, getXAxisLabelAlign(orient, item.attribute.angle)), {
|
|
30253
|
+
angle: clampAngle(item.attribute.angle)
|
|
30254
|
+
}));
|
|
30255
|
+
});
|
|
30256
|
+
}
|
|
30257
|
+
function getXAxisLabelAlign(orient) {
|
|
30258
|
+
let angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
29529
30259
|
let align = ["center", "left", "left", "left", "center", "right", "right", "right", "left"],
|
|
29530
30260
|
baseline = ["top", "top", "middle", "bottom", "bottom", "bottom", "middle", "top", "top"];
|
|
29531
|
-
"top" === orient && (align = ["center", "right", "right", "right", "center", "left", "left", "left", "right"], baseline = ["bottom", "bottom", "middle", "top", "top", "top", "middle", "bottom", "bottom"])
|
|
29532
|
-
|
|
29533
|
-
|
|
29534
|
-
|
|
29535
|
-
|
|
29536
|
-
|
|
29537
|
-
|
|
29538
|
-
|
|
29539
|
-
|
|
29540
|
-
|
|
29541
|
-
|
|
29542
|
-
|
|
30261
|
+
"top" === orient && (align = ["center", "right", "right", "right", "center", "left", "left", "left", "right"], baseline = ["bottom", "bottom", "middle", "top", "top", "top", "middle", "bottom", "bottom"]);
|
|
30262
|
+
const step = (angle = clampAngle(angle)) / (.5 * Math.PI);
|
|
30263
|
+
let index;
|
|
30264
|
+
return index = step === Math.floor(step) ? 2 * Math.floor(step) : 2 * Math.floor(step) + 1, {
|
|
30265
|
+
textAlign: align[index],
|
|
30266
|
+
textBaseline: baseline[index]
|
|
30267
|
+
};
|
|
30268
|
+
}
|
|
30269
|
+
function getYAxisLabelAlign(orient) {
|
|
30270
|
+
let angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
30271
|
+
let align = ["right", "right", "center", "left", "center", "left", "center", "right", "right"],
|
|
30272
|
+
baseline = ["middle", "middle", "top", "top", "middle", "middle", "bottom", "bottom", "middle"];
|
|
30273
|
+
"right" === orient && (align = ["left", "right", "right", "right", "left", "left", "left", "left", "right"], baseline = ["middle", "bottom", "middle", "top", "top", "top", "middle", "bottom", "bottom"]);
|
|
30274
|
+
const step = (angle = clampAngle(angle)) / (.5 * Math.PI);
|
|
30275
|
+
let index;
|
|
30276
|
+
return index = step === Math.floor(step) ? 2 * Math.floor(step) : 2 * Math.floor(step) + 1, {
|
|
30277
|
+
textAlign: align[index],
|
|
30278
|
+
textBaseline: baseline[index]
|
|
30279
|
+
};
|
|
29543
30280
|
}
|
|
29544
30281
|
|
|
29545
30282
|
function autoLimit(labels, config) {
|
|
@@ -29559,6 +30296,60 @@
|
|
|
29559
30296
|
});
|
|
29560
30297
|
}
|
|
29561
30298
|
|
|
30299
|
+
function alignAxisLabels(labels, start, containerSize, orient, align) {
|
|
30300
|
+
if ("right" === orient || "left" === orient) {
|
|
30301
|
+
if ("left" === align) {
|
|
30302
|
+
const flag = "right" === orient ? 0 : -1;
|
|
30303
|
+
labels.forEach(label => {
|
|
30304
|
+
label.setAttributes({
|
|
30305
|
+
x: start + containerSize * flag,
|
|
30306
|
+
textAlign: "left"
|
|
30307
|
+
});
|
|
30308
|
+
});
|
|
30309
|
+
} else if ("right" === align) {
|
|
30310
|
+
const flag = "right" === orient ? 1 : 0;
|
|
30311
|
+
labels.forEach(label => {
|
|
30312
|
+
label.setAttributes({
|
|
30313
|
+
x: start + containerSize * flag,
|
|
30314
|
+
textAlign: "right"
|
|
30315
|
+
});
|
|
30316
|
+
});
|
|
30317
|
+
} else if ("center" === align) {
|
|
30318
|
+
const flag = "right" === orient ? 1 : -1;
|
|
30319
|
+
labels.forEach(label => {
|
|
30320
|
+
label.setAttributes({
|
|
30321
|
+
x: start + .5 * containerSize * flag,
|
|
30322
|
+
textAlign: "center"
|
|
30323
|
+
});
|
|
30324
|
+
});
|
|
30325
|
+
}
|
|
30326
|
+
} else if ("bottom" === orient || "top" === orient) if ("top" === align) {
|
|
30327
|
+
const flag = "bottom" === orient ? 0 : -1;
|
|
30328
|
+
labels.forEach(label => {
|
|
30329
|
+
label.setAttributes({
|
|
30330
|
+
y: start + containerSize * flag,
|
|
30331
|
+
textBaseline: "top"
|
|
30332
|
+
});
|
|
30333
|
+
});
|
|
30334
|
+
} else if ("bottom" === align) {
|
|
30335
|
+
const flag = "bottom" === orient ? 1 : 0;
|
|
30336
|
+
labels.forEach(label => {
|
|
30337
|
+
label.setAttributes({
|
|
30338
|
+
y: start + containerSize * flag,
|
|
30339
|
+
textBaseline: "bottom"
|
|
30340
|
+
});
|
|
30341
|
+
});
|
|
30342
|
+
} else if ("middle" === align) {
|
|
30343
|
+
const flag = "bottom" === orient ? 1 : -1;
|
|
30344
|
+
labels.forEach(label => {
|
|
30345
|
+
label.setAttributes({
|
|
30346
|
+
y: start + .5 * containerSize * flag,
|
|
30347
|
+
textBaseline: "middle"
|
|
30348
|
+
});
|
|
30349
|
+
});
|
|
30350
|
+
}
|
|
30351
|
+
}
|
|
30352
|
+
|
|
29562
30353
|
var __rest$1 = undefined && undefined.__rest || function (s, e) {
|
|
29563
30354
|
var t = {};
|
|
29564
30355
|
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
|
|
@@ -29581,6 +30372,24 @@
|
|
|
29581
30372
|
constructor(attributes, mode) {
|
|
29582
30373
|
super(merge$2({}, LineAxis.defaultAttributes, attributes), mode), "3d" === mode && this.setMode(mode);
|
|
29583
30374
|
}
|
|
30375
|
+
_renderInner(container) {
|
|
30376
|
+
var _a;
|
|
30377
|
+
super._renderInner(container);
|
|
30378
|
+
const {
|
|
30379
|
+
panel: panel
|
|
30380
|
+
} = this.attribute;
|
|
30381
|
+
if (panel && panel.visible) {
|
|
30382
|
+
const axisContainer = this.axisContainer,
|
|
30383
|
+
axisContainerBounds = axisContainer.AABBBounds,
|
|
30384
|
+
bgRect = createRect(Object.assign({
|
|
30385
|
+
x: axisContainerBounds.x1,
|
|
30386
|
+
y: axisContainerBounds.y1,
|
|
30387
|
+
width: axisContainerBounds.width(),
|
|
30388
|
+
height: axisContainerBounds.height()
|
|
30389
|
+
}, panel.style));
|
|
30390
|
+
bgRect.name = AXIS_ELEMENT_NAME.background, bgRect.id = this._getNodeId("background"), bgRect.states = merge$2({}, DEFAULT_STATES$1, null !== (_a = panel.state) && void 0 !== _a ? _a : {}), axisContainer.insertBefore(bgRect, axisContainer.firstChild);
|
|
30391
|
+
}
|
|
30392
|
+
}
|
|
29584
30393
|
renderLine(container) {
|
|
29585
30394
|
const {
|
|
29586
30395
|
start: start,
|
|
@@ -29706,10 +30515,10 @@
|
|
|
29706
30515
|
textAlign: textAlign,
|
|
29707
30516
|
textBaseline: textBaseline
|
|
29708
30517
|
}, textStyle),
|
|
29709
|
-
state:
|
|
29710
|
-
text: state.text,
|
|
29711
|
-
shape: state.shape,
|
|
29712
|
-
panel: state.background
|
|
30518
|
+
state: {
|
|
30519
|
+
text: merge$2({}, DEFAULT_STATES$1, null == state ? void 0 : state.text),
|
|
30520
|
+
shape: merge$2({}, DEFAULT_STATES$1, null == state ? void 0 : state.shape),
|
|
30521
|
+
panel: merge$2({}, DEFAULT_STATES$1, null == state ? void 0 : state.background)
|
|
29713
30522
|
}
|
|
29714
30523
|
});
|
|
29715
30524
|
return attrs.angle = angle, shape && shape.visible && (attrs.shape = Object.assign({
|
|
@@ -29821,34 +30630,36 @@
|
|
|
29821
30630
|
factor = (inside ? 1 : -1) * verticalFactor;
|
|
29822
30631
|
return isNumberClose(vector[1], 0) ? base = !isNumberClose(vector[0], 0) || Object.is(vector[0], -0) || Object.is(vector[1], -0) ? "middle" : 1 === factor ? "bottom" : "top" : vector[1] > 0 ? base = "top" : vector[1] < 0 && (base = "bottom"), base;
|
|
29823
30632
|
}
|
|
29824
|
-
|
|
29825
|
-
|
|
30633
|
+
getLabelAlign(vector, inside, angle) {
|
|
30634
|
+
const orient = this.attribute.orient;
|
|
30635
|
+
if (isValidNumber(angle)) {
|
|
30636
|
+
if ("top" === orient || "bottom" === orient) return getXAxisLabelAlign(orient, angle);
|
|
30637
|
+
if ("left" === orient || "right" === orient) return getYAxisLabelAlign(orient, angle);
|
|
30638
|
+
}
|
|
30639
|
+
return {
|
|
30640
|
+
textAlign: this.getTextAlign(vector),
|
|
30641
|
+
textBaseline: this.getTextBaseline(vector, inside)
|
|
30642
|
+
};
|
|
30643
|
+
}
|
|
30644
|
+
beforeLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {}
|
|
30645
|
+
handleLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
29826
30646
|
if (isEmpty(labelShapes)) return;
|
|
29827
30647
|
const {
|
|
29828
30648
|
verticalLimitSize: verticalLimitSize,
|
|
29829
30649
|
label: label,
|
|
29830
|
-
title: title,
|
|
29831
|
-
line: line,
|
|
29832
|
-
tick: tick,
|
|
29833
30650
|
orient: orient
|
|
29834
30651
|
} = this.attribute,
|
|
29835
|
-
|
|
29836
|
-
|
|
29837
|
-
|
|
29838
|
-
|
|
29839
|
-
|
|
29840
|
-
|
|
29841
|
-
|
|
29842
|
-
|
|
29843
|
-
|
|
29844
|
-
|
|
29845
|
-
|
|
29846
|
-
autoLimit: autoLimit$1,
|
|
29847
|
-
limitEllipsis: limitEllipsis,
|
|
29848
|
-
autoHide: autoHide$1,
|
|
29849
|
-
autoHideMethod: autoHideMethod,
|
|
29850
|
-
autoHideSeparation: autoHideSeparation
|
|
29851
|
-
} = label;
|
|
30652
|
+
limitLength = this._getAxisLabelLimitLength(verticalLimitSize, layerCount),
|
|
30653
|
+
{
|
|
30654
|
+
layoutFunc: layoutFunc,
|
|
30655
|
+
autoRotate: autoRotate$1,
|
|
30656
|
+
autoRotateAngle: autoRotateAngle,
|
|
30657
|
+
autoLimit: autoLimit$1,
|
|
30658
|
+
limitEllipsis: limitEllipsis,
|
|
30659
|
+
autoHide: autoHide$1,
|
|
30660
|
+
autoHideMethod: autoHideMethod,
|
|
30661
|
+
autoHideSeparation: autoHideSeparation
|
|
30662
|
+
} = label;
|
|
29852
30663
|
isFunction(layoutFunc) ? layoutFunc(labelShapes, labelData, layer, this) : (autoRotate$1 && autoRotate(labelShapes, {
|
|
29853
30664
|
labelRotateAngle: autoRotateAngle,
|
|
29854
30665
|
orient: orient
|
|
@@ -29862,6 +30673,56 @@
|
|
|
29862
30673
|
separation: autoHideSeparation
|
|
29863
30674
|
}));
|
|
29864
30675
|
}
|
|
30676
|
+
afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
30677
|
+
const {
|
|
30678
|
+
verticalLimitSize: verticalLimitSize,
|
|
30679
|
+
orient: orient
|
|
30680
|
+
} = this.attribute,
|
|
30681
|
+
isHorizontal = "bottom" === orient || "top" === orient,
|
|
30682
|
+
axisLabelContainerBounds = labelContainer.AABBBounds;
|
|
30683
|
+
let axisLabelContainerSize = isHorizontal ? axisLabelContainerBounds.height() : axisLabelContainerBounds.width();
|
|
30684
|
+
const {
|
|
30685
|
+
verticalMinSize: verticalMinSize
|
|
30686
|
+
} = this.attribute;
|
|
30687
|
+
if (isValidNumber(verticalMinSize) && (!isValidNumber(verticalLimitSize) || verticalMinSize <= verticalLimitSize)) {
|
|
30688
|
+
const minSize = this._getAxisLabelLimitLength(verticalMinSize, layerCount);
|
|
30689
|
+
let x, y;
|
|
30690
|
+
axisLabelContainerSize = Math.max(axisLabelContainerSize, minSize), "left" === orient ? (x = axisLabelContainerBounds.x2 - axisLabelContainerSize, y = axisLabelContainerBounds.y1) : "right" === orient ? (x = axisLabelContainerBounds.x1, y = axisLabelContainerBounds.y1) : "top" === orient ? (x = axisLabelContainerBounds.x1, y = axisLabelContainerBounds.y2 - axisLabelContainerSize) : "bottom" === orient && (x = axisLabelContainerBounds.x1, y = axisLabelContainerBounds.y1);
|
|
30691
|
+
const bgRect = createRect({
|
|
30692
|
+
x: x,
|
|
30693
|
+
y: y,
|
|
30694
|
+
width: isHorizontal ? axisLabelContainerBounds.width() : axisLabelContainerSize,
|
|
30695
|
+
height: isHorizontal ? axisLabelContainerSize : axisLabelContainerBounds.height(),
|
|
30696
|
+
pickable: !1
|
|
30697
|
+
});
|
|
30698
|
+
bgRect.name = AXIS_ELEMENT_NAME.axisLabelBackground, bgRect.id = this._getNodeId("axis-label-background"), labelContainer.insertBefore(bgRect, labelContainer.firstChild);
|
|
30699
|
+
}
|
|
30700
|
+
if (isValid(this.attribute.label.containerAlign)) {
|
|
30701
|
+
let start;
|
|
30702
|
+
"left" === orient ? start = axisLabelContainerBounds.x2 : "right" === orient ? start = axisLabelContainerBounds.x1 : "top" === orient ? start = axisLabelContainerBounds.y2 : "bottom" === orient && (start = axisLabelContainerBounds.y1), alignAxisLabels(labelShapes, start, axisLabelContainerSize, orient, this.attribute.label.containerAlign);
|
|
30703
|
+
}
|
|
30704
|
+
}
|
|
30705
|
+
_getAxisLabelLimitLength(limitSize, layerCount) {
|
|
30706
|
+
var _a, _b, _c;
|
|
30707
|
+
const {
|
|
30708
|
+
label: label,
|
|
30709
|
+
title: title,
|
|
30710
|
+
line: line,
|
|
30711
|
+
tick: tick
|
|
30712
|
+
} = this.attribute,
|
|
30713
|
+
labelSpace = null !== (_a = label.space) && void 0 !== _a ? _a : 4;
|
|
30714
|
+
let limitLength = limitSize,
|
|
30715
|
+
titleHeight = 0,
|
|
30716
|
+
titleSpacing = 0;
|
|
30717
|
+
const axisLineWidth = (null == line ? void 0 : line.visible) ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0,
|
|
30718
|
+
tickLength = (null == tick ? void 0 : tick.visible) ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0;
|
|
30719
|
+
if (null == title ? void 0 : title.visible) {
|
|
30720
|
+
titleHeight = measureTextSize(title.text, title.textStyle).height;
|
|
30721
|
+
const padding = normalizePadding(title.padding);
|
|
30722
|
+
titleSpacing = title.space + padding[0] + padding[2];
|
|
30723
|
+
}
|
|
30724
|
+
return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength;
|
|
30725
|
+
}
|
|
29865
30726
|
}
|
|
29866
30727
|
LineAxis.defaultAttributes = DEFAULT_AXIS_THEME;
|
|
29867
30728
|
|
|
@@ -30015,7 +30876,7 @@
|
|
|
30015
30876
|
}(LegendStateValue || (LegendStateValue = {}));
|
|
30016
30877
|
var LegendEvent;
|
|
30017
30878
|
!function (LegendEvent) {
|
|
30018
|
-
LegendEvent.legendItemHover = "legendItemHover", LegendEvent.legendItemUnHover = "legendItemUnHover", LegendEvent.legendItemClick = "legendItemClick";
|
|
30879
|
+
LegendEvent.legendItemHover = "legendItemHover", LegendEvent.legendItemUnHover = "legendItemUnHover", LegendEvent.legendItemClick = "legendItemClick", LegendEvent.legendItemAttributeUpdate = "legendItemAttributeUpdate";
|
|
30019
30880
|
}(LegendEvent || (LegendEvent = {}));
|
|
30020
30881
|
var LEGEND_ELEMENT_NAME;
|
|
30021
30882
|
!function (LEGEND_ELEMENT_NAME) {
|
|
@@ -30114,11 +30975,12 @@
|
|
|
30114
30975
|
const target = e.target;
|
|
30115
30976
|
if (null === (_a = null == target ? void 0 : target.name) || void 0 === _a ? void 0 : _a.startsWith(LEGEND_ELEMENT_NAME.item)) {
|
|
30116
30977
|
const legendItem = target.delegate;
|
|
30117
|
-
|
|
30118
|
-
|
|
30978
|
+
let attributeUpdate = !1;
|
|
30979
|
+
(legendItem.hasState(LegendStateValue.unSelectedHover) || legendItem.hasState(LegendStateValue.selectedHover)) && (attributeUpdate = !0), legendItem.removeState(LegendStateValue.unSelectedHover), legendItem.removeState(LegendStateValue.selectedHover), legendItem.getChildren()[0].getChildren().forEach(child => {
|
|
30980
|
+
attributeUpdate || !child.hasState(LegendStateValue.unSelectedHover) && !child.hasState(LegendStateValue.selectedHover) || (attributeUpdate = !0), child.removeState(LegendStateValue.unSelectedHover), child.removeState(LegendStateValue.selectedHover);
|
|
30119
30981
|
});
|
|
30120
30982
|
const focusButton = legendItem.getChildren()[0].find(node => node.name === LEGEND_ELEMENT_NAME.focus, !1);
|
|
30121
|
-
focusButton && focusButton.setAttribute("visible", !1), this._dispatchEvent(LegendEvent.legendItemUnHover, legendItem);
|
|
30983
|
+
focusButton && focusButton.setAttribute("visible", !1), attributeUpdate && this._dispatchEvent(LegendEvent.legendItemAttributeUpdate, legendItem), this._dispatchEvent(LegendEvent.legendItemUnHover, legendItem);
|
|
30122
30984
|
}
|
|
30123
30985
|
}, this._onClick = e => {
|
|
30124
30986
|
var _a, _b, _c, _d, _e;
|
|
@@ -30306,10 +31168,18 @@
|
|
|
30306
31168
|
}, null == valueAttr ? void 0 : valueAttr.style), {
|
|
30307
31169
|
text: valueAttr.formatMethod ? valueAttr.formatMethod(value, item, index) : value
|
|
30308
31170
|
}));
|
|
30309
|
-
this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, null == valueAttr ? void 0 : valueAttr.state), valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), this._itemWidthByUser
|
|
30310
|
-
|
|
30311
|
-
|
|
30312
|
-
|
|
31171
|
+
if (this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, null == valueAttr ? void 0 : valueAttr.state), valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), this._itemWidthByUser) {
|
|
31172
|
+
const layoutWidth = this._itemWidthByUser - parsedPadding[1] - parsedPadding[3] - shapeSize - shapeSpace - labelSpace - focusSpace - valueSpace,
|
|
31173
|
+
valueBounds = valueShape.AABBBounds,
|
|
31174
|
+
labelBounds = labelShape.AABBBounds,
|
|
31175
|
+
valueWidth = valueBounds.width(),
|
|
31176
|
+
labelWidth = labelBounds.width();
|
|
31177
|
+
labelWidth > layoutWidth ? (layoutWidth - valueWidth) / labelWidth > .4 ? labelShape.setAttribute("maxLineWidth", layoutWidth - valueWidth) : (valueShape.setAttribute("maxLineWidth", .5 * layoutWidth), labelShape.setAttribute("maxLineWidth", .5 * layoutWidth)) : valueShape.setAttribute("maxLineWidth", layoutWidth - labelWidth), valueAttr.alignRight && valueShape.setAttributes({
|
|
31178
|
+
textAlign: "right",
|
|
31179
|
+
x: this._itemWidthByUser - shapeSize / 2 - parsedPadding[1] - parsedPadding[3] - focusSpace - valueSpace
|
|
31180
|
+
});
|
|
31181
|
+
}
|
|
31182
|
+
focusStartX = valueShape.AABBBounds.x2 + valueSpace, innerGroup.add(valueShape);
|
|
30313
31183
|
} else this._itemWidthByUser && labelShape.setAttribute("maxLineWidth", this._itemWidthByUser - parsedPadding[1] - parsedPadding[3] - shapeSize - shapeSpace - focusSpace);
|
|
30314
31184
|
focusShape && (focusShape.setAttribute("x", focusStartX), innerGroup.add(focusShape));
|
|
30315
31185
|
const innerGroupBounds = innerGroup.AABBBounds,
|
|
@@ -30414,18 +31284,20 @@
|
|
|
30414
31284
|
}
|
|
30415
31285
|
_setLegendItemState(legendItem, stateName) {
|
|
30416
31286
|
let keepCurrentStates = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
|
30417
|
-
|
|
30418
|
-
|
|
30419
|
-
|
|
31287
|
+
let attributeUpdate = !1;
|
|
31288
|
+
legendItem.hasState(stateName) || (attributeUpdate = !0), legendItem.addState(stateName, keepCurrentStates), legendItem.getChildren()[0].getChildren().forEach(child => {
|
|
31289
|
+
child.name !== LEGEND_ELEMENT_NAME.focus && (attributeUpdate || child.hasState(stateName) || (attributeUpdate = !0), child.addState(stateName, keepCurrentStates));
|
|
31290
|
+
}), attributeUpdate && this._dispatchEvent(LegendEvent.legendItemAttributeUpdate, legendItem);
|
|
30420
31291
|
}
|
|
30421
31292
|
_removeLegendItemState(legendItem, stateNames) {
|
|
31293
|
+
let attributeUpdate = !1;
|
|
30422
31294
|
stateNames.forEach(name => {
|
|
30423
|
-
legendItem.removeState(name);
|
|
31295
|
+
!attributeUpdate && legendItem.hasState(name) && (attributeUpdate = !0), legendItem.removeState(name);
|
|
30424
31296
|
}), legendItem.getChildren()[0].getChildren().forEach(child => {
|
|
30425
31297
|
child.name !== LEGEND_ELEMENT_NAME.focus && stateNames.forEach(name => {
|
|
30426
|
-
child.removeState(name);
|
|
31298
|
+
!attributeUpdate && child.hasState(name) && (attributeUpdate = !0), child.removeState(name);
|
|
30427
31299
|
});
|
|
30428
|
-
});
|
|
31300
|
+
}), attributeUpdate && this._dispatchEvent(LegendEvent.legendItemAttributeUpdate, legendItem);
|
|
30429
31301
|
}
|
|
30430
31302
|
_getSelectedLegends() {
|
|
30431
31303
|
var _a;
|
|
@@ -30589,12 +31461,6 @@
|
|
|
30589
31461
|
}
|
|
30590
31462
|
return range;
|
|
30591
31463
|
}
|
|
30592
|
-
calculateVisibleDomain(range) {
|
|
30593
|
-
if (this._rangeFactor && 2 === range.length) {
|
|
30594
|
-
return [this.invert(range[0]), this.invert(range[1])];
|
|
30595
|
-
}
|
|
30596
|
-
return this.domain();
|
|
30597
|
-
}
|
|
30598
31464
|
rangeFactor(_, slience) {
|
|
30599
31465
|
return _ ? (2 === _.length && _.every(r => r >= 0 && r <= 1) && (this._wholeRange = null, this._rangeFactor = _), this) : this._rangeFactor;
|
|
30600
31466
|
}
|
|
@@ -30618,10 +31484,16 @@
|
|
|
30618
31484
|
clone() {
|
|
30619
31485
|
return new OrdinalScale().domain(this._domain).range(this._ordinalRange).unknown(this._unknown);
|
|
30620
31486
|
}
|
|
31487
|
+
calculateVisibleDomain(range) {
|
|
31488
|
+
if (this._rangeFactor && 2 === range.length) {
|
|
31489
|
+
return [this.invert(range[0]), this.invert(range[1])];
|
|
31490
|
+
}
|
|
31491
|
+
return this._domain;
|
|
31492
|
+
}
|
|
30621
31493
|
scale(d) {
|
|
30622
|
-
const
|
|
30623
|
-
|
|
30624
|
-
|
|
31494
|
+
const key = `${d}`,
|
|
31495
|
+
special = this._getSpecifiedValue(key);
|
|
31496
|
+
if (void 0 !== special) return special;
|
|
30625
31497
|
let i = this._index.get(key);
|
|
30626
31498
|
if (!i) {
|
|
30627
31499
|
if (this._unknown !== implicit) return this._unknown;
|
|
@@ -30728,7 +31600,7 @@
|
|
|
30728
31600
|
return super.range(reverse ? values.reverse() : values), this;
|
|
30729
31601
|
}
|
|
30730
31602
|
calculateVisibleDomain(range) {
|
|
30731
|
-
const domain = this.
|
|
31603
|
+
const domain = this._domain;
|
|
30732
31604
|
if (this._rangeFactor && domain.length) {
|
|
30733
31605
|
const d0 = this._getInvertIndex(range[0]),
|
|
30734
31606
|
d1 = this._getInvertIndex(range[1]);
|
|
@@ -30748,7 +31620,7 @@
|
|
|
30748
31620
|
ticks() {
|
|
30749
31621
|
let count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
|
|
30750
31622
|
const d = this.calculateVisibleDomain(this._range);
|
|
30751
|
-
if (-1 === count) return d;
|
|
31623
|
+
if (-1 === count) return d.slice();
|
|
30752
31624
|
return ticks$2(0, d.length - 1, count, !1).map(i => d[i]);
|
|
30753
31625
|
}
|
|
30754
31626
|
tickData() {
|
|
@@ -30839,14 +31711,25 @@
|
|
|
30839
31711
|
let untransformer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : identity$2;
|
|
30840
31712
|
super(), this._unknown = void 0, this.transformer = transformer, this.untransformer = untransformer, this._forceAlign = !0, this._domain = [0, 1], this._range = [0, 1], this._clamp = identity$2, this._piecewise = bimap, this._interpolate = interpolate;
|
|
30841
31713
|
}
|
|
31714
|
+
calculateVisibleDomain(range) {
|
|
31715
|
+
var _a;
|
|
31716
|
+
if (this._rangeFactor && 2 === range.length) {
|
|
31717
|
+
return [this.invert(range[0]), this.invert(range[1])];
|
|
31718
|
+
}
|
|
31719
|
+
return null !== (_a = this._niceDomain) && void 0 !== _a ? _a : this._domain;
|
|
31720
|
+
}
|
|
30842
31721
|
scale(x) {
|
|
30843
|
-
|
|
31722
|
+
var _a;
|
|
31723
|
+
return x = Number(x), Number.isNaN(x) || this._domainValidator && !this._domainValidator(x) ? this._unknown : (this._output || (this._output = this._piecewise((null !== (_a = this._niceDomain) && void 0 !== _a ? _a : this._domain).map(this.transformer), this._calculateRange(this._range), this._interpolate)), this._output(this.transformer(this._clamp(x))));
|
|
30844
31724
|
}
|
|
30845
31725
|
invert(y) {
|
|
30846
|
-
|
|
31726
|
+
var _a;
|
|
31727
|
+
return this._input || (this._input = this._piecewise(this._calculateRange(this._range), (null !== (_a = this._niceDomain) && void 0 !== _a ? _a : this._domain).map(this.transformer), interpolateNumber)), this._clamp(this.untransformer(this._input(y)));
|
|
30847
31728
|
}
|
|
30848
31729
|
domain(_, slience) {
|
|
30849
|
-
|
|
31730
|
+
var _a;
|
|
31731
|
+
if (!_) return (null !== (_a = this._niceDomain) && void 0 !== _a ? _a : this._domain).slice();
|
|
31732
|
+
this._domainValidator = null, this._niceType = null, this._niceDomain = null;
|
|
30850
31733
|
const nextDomain = Array.from(_, toNumber);
|
|
30851
31734
|
return this._domain = nextDomain, this.rescale(slience);
|
|
30852
31735
|
}
|
|
@@ -30860,18 +31743,20 @@
|
|
|
30860
31743
|
return this._range = nextRange, this._interpolate = interpolateNumberRound, this.rescale(slience);
|
|
30861
31744
|
}
|
|
30862
31745
|
rescale(slience) {
|
|
31746
|
+
var _a;
|
|
30863
31747
|
if (slience) return this;
|
|
30864
|
-
const
|
|
31748
|
+
const domain = null !== (_a = this._niceDomain) && void 0 !== _a ? _a : this._domain,
|
|
31749
|
+
domainLength = domain.length,
|
|
30865
31750
|
rangeLength = this._range.length;
|
|
30866
31751
|
let n = Math.min(domainLength, rangeLength);
|
|
30867
31752
|
if (domainLength && domainLength < rangeLength && this._forceAlign) {
|
|
30868
31753
|
const deltaStep = rangeLength - domainLength + 1,
|
|
30869
|
-
last =
|
|
30870
|
-
delta = domainLength >= 2 ? (last -
|
|
30871
|
-
for (let i = 1; i <= deltaStep; i++)
|
|
31754
|
+
last = domain[domainLength - 1],
|
|
31755
|
+
delta = domainLength >= 2 ? (last - domain[domainLength - 2]) / deltaStep : 0;
|
|
31756
|
+
for (let i = 1; i <= deltaStep; i++) domain[domainLength - 2 + i] = last - delta * (deltaStep - i);
|
|
30872
31757
|
n = rangeLength;
|
|
30873
31758
|
}
|
|
30874
|
-
return void 0 === this._clamp && (this._clamp = clamper(
|
|
31759
|
+
return void 0 === this._clamp && (this._clamp = clamper(domain[0], domain[n - 1])), this._piecewise = n > 2 ? polymap : bimap, this._output = this._input = null, this._wholeRange = null, this;
|
|
30875
31760
|
}
|
|
30876
31761
|
clamp(_, f, slience) {
|
|
30877
31762
|
return arguments.length ? (this._clamp = f || (_ ? void 0 : identity$2), this.rescale(slience)) : this._clamp !== identity$2;
|
|
@@ -30901,20 +31786,34 @@
|
|
|
30901
31786
|
|
|
30902
31787
|
const e10$1 = Math.sqrt(50),
|
|
30903
31788
|
e5$1 = Math.sqrt(10),
|
|
30904
|
-
e2$1 = Math.sqrt(2)
|
|
30905
|
-
|
|
31789
|
+
e2$1 = Math.sqrt(2),
|
|
31790
|
+
niceNumbers = [1, 2, 5, 10];
|
|
31791
|
+
const calculateTicksOfSingleValue = (value, tickCount, noDecimals) => {
|
|
31792
|
+
let step = 1,
|
|
31793
|
+
start = value;
|
|
31794
|
+
const middleIndex = Math.floor((tickCount - 1) / 2),
|
|
31795
|
+
absVal = Math.abs(value);
|
|
31796
|
+
return value >= 0 && value <= Number.MIN_VALUE ? start = 0 : value < 0 && value >= -Number.MIN_VALUE ? start = -(tickCount - 1) : !noDecimals && absVal < 1 ? step = getNickStep(absVal).step : (noDecimals || absVal > 1) && (start = Math.floor(value) - middleIndex * step), step > 0 ? (value > 0 ? start = Math.max(start, 0) : value < 0 && (start = Math.min(start, -(tickCount - 1) * step)), range(0, tickCount).map(index => start + index * step)) : value > 0 ? calculateTicksByStep(0, -(tickCount - 1) / step, step) : calculateTicksByStep((tickCount - 1) / step, 0, step);
|
|
31797
|
+
};
|
|
31798
|
+
const d3Ticks = memoize((start, stop, count, options) => {
|
|
30906
31799
|
let reverse,
|
|
30907
31800
|
n,
|
|
30908
31801
|
ticks,
|
|
30909
31802
|
step,
|
|
30910
31803
|
i = -1;
|
|
30911
|
-
if (count = +count, (start = +start) === (stop = +stop)) return [];
|
|
31804
|
+
if (count = +count, (start = +start) === (stop = +stop)) return [start];
|
|
30912
31805
|
if (Math.abs(start - stop) <= Number.MIN_VALUE && count > 0) return [start];
|
|
30913
|
-
if ((reverse = stop < start) && (n = start, start = stop, stop = n), step = tickIncrement(start, stop, count), !isFinite(step)) return [];
|
|
31806
|
+
if ((reverse = stop < start) && (n = start, start = stop, stop = n), step = tickIncrement(start, stop, count).step, !isFinite(step)) return [];
|
|
30914
31807
|
if (step > 0) {
|
|
30915
31808
|
let r0 = Math.round(start / step),
|
|
30916
31809
|
r1 = Math.round(stop / step);
|
|
30917
31810
|
for (r0 * step < start && ++r0, r1 * step > stop && --r1, ticks = new Array(n = r1 - r0 + 1); ++i < n;) ticks[i] = (r0 + i) * step;
|
|
31811
|
+
} else if (step < 0 && (null == options ? void 0 : options.noDecimals)) {
|
|
31812
|
+
step = 1;
|
|
31813
|
+
const r0 = Math.ceil(start),
|
|
31814
|
+
r1 = Math.floor(stop);
|
|
31815
|
+
if (!(r0 <= r1)) return [];
|
|
31816
|
+
for (ticks = new Array(n = r1 - r0 + 1); ++i < n;) ticks[i] = r0 + i;
|
|
30918
31817
|
} else {
|
|
30919
31818
|
step = -step;
|
|
30920
31819
|
let r0 = Math.round(start * step),
|
|
@@ -30922,13 +31821,79 @@
|
|
|
30922
31821
|
for (r0 / step < start && ++r0, r1 / step > stop && --r1, ticks = new Array(n = r1 - r0 + 1); ++i < n;) ticks[i] = (r0 + i) / step;
|
|
30923
31822
|
}
|
|
30924
31823
|
return reverse && ticks.reverse(), ticks;
|
|
30925
|
-
}
|
|
30926
|
-
|
|
30927
|
-
|
|
30928
|
-
|
|
31824
|
+
});
|
|
31825
|
+
const calculateTicksByStep = (start, stop, step) => {
|
|
31826
|
+
let n,
|
|
31827
|
+
ticks,
|
|
31828
|
+
i = -1;
|
|
31829
|
+
if (step > 0) {
|
|
31830
|
+
let r0 = Math.floor(start / step),
|
|
31831
|
+
r1 = Math.ceil(stop / step);
|
|
31832
|
+
for ((r0 + 1) * step < start && ++r0, (r1 - 1) * step > stop && --r1, ticks = new Array(n = r1 - r0 + 1); ++i < n;) ticks[i] = (r0 + i) * step;
|
|
31833
|
+
} else {
|
|
31834
|
+
step = -step;
|
|
31835
|
+
let r0 = Math.floor(start * step),
|
|
31836
|
+
r1 = Math.ceil(stop * step);
|
|
31837
|
+
for ((r0 + 1) / step < start && ++r0, (r1 - 1) / step > stop && --r1, ticks = new Array(n = r1 - r0 + 1); ++i < n;) ticks[i] = (r0 + i) / step;
|
|
31838
|
+
}
|
|
31839
|
+
return ticks;
|
|
31840
|
+
};
|
|
31841
|
+
const appendTicksToCount = (ticks, count, step) => {
|
|
31842
|
+
let n;
|
|
31843
|
+
const firstTick = ticks[0],
|
|
31844
|
+
lastTick = ticks[ticks.length - 1],
|
|
31845
|
+
appendCount = count - ticks.length;
|
|
31846
|
+
if (lastTick <= 0) {
|
|
31847
|
+
const headTicks = [];
|
|
31848
|
+
for (n = appendCount; n >= 1; n--) headTicks.push(firstTick - n * step);
|
|
31849
|
+
return headTicks.concat(ticks);
|
|
31850
|
+
}
|
|
31851
|
+
if (firstTick >= 0) {
|
|
31852
|
+
for (n = 1; n <= appendCount; n++) ticks.push(lastTick + n * step);
|
|
31853
|
+
return ticks;
|
|
31854
|
+
}
|
|
31855
|
+
let headTicks = [];
|
|
31856
|
+
const tailTicks = [];
|
|
31857
|
+
for (n = 1; n <= appendCount; n++) n % 2 == 0 ? headTicks = [firstTick - Math.floor(n / 2) * step].concat(headTicks) : tailTicks.push(lastTick + Math.ceil(n / 2) * step);
|
|
31858
|
+
return headTicks.concat(ticks).concat(tailTicks);
|
|
31859
|
+
};
|
|
31860
|
+
const ticks$1 = memoize((start, stop, count, options) => {
|
|
31861
|
+
let reverse, ticks, n;
|
|
31862
|
+
if (count = +count, (start = +start) === (stop = +stop)) return calculateTicksOfSingleValue(start, count, null == options ? void 0 : options.noDecimals);
|
|
31863
|
+
if (Math.abs(start - stop) <= Number.MIN_VALUE && count > 0) return calculateTicksOfSingleValue(start, count, null == options ? void 0 : options.noDecimals);
|
|
31864
|
+
(reverse = stop < start) && (n = start, start = stop, stop = n);
|
|
31865
|
+
const stepRes = tickIncrement(start, stop, count);
|
|
31866
|
+
let step = stepRes.step;
|
|
31867
|
+
if (!isFinite(step)) return [];
|
|
31868
|
+
if (step > 0) {
|
|
31869
|
+
let cur = 1;
|
|
31870
|
+
const {
|
|
31871
|
+
power: power,
|
|
31872
|
+
gap: gap
|
|
31873
|
+
} = stepRes,
|
|
31874
|
+
delatStep = 10 === gap ? 2 * 10 ** power : 1 * 10 ** power;
|
|
31875
|
+
for (; cur <= 5 && (ticks = calculateTicksByStep(start, stop, step), ticks.length > count + 1) && count > 2;) step += delatStep, cur += 1;
|
|
31876
|
+
count > 2 && ticks.length < count - 1 && (ticks = appendTicksToCount(ticks, count, step));
|
|
31877
|
+
} else (null == options ? void 0 : options.noDecimals) && step < 0 && (step = 1), ticks = calculateTicksByStep(start, stop, step);
|
|
31878
|
+
return reverse && ticks.reverse(), ticks;
|
|
31879
|
+
});
|
|
31880
|
+
const getNickStep = step => {
|
|
31881
|
+
const power = Math.floor(Math.log(step) / Math.LN10),
|
|
30929
31882
|
error = step / 10 ** power;
|
|
30930
|
-
let gap =
|
|
30931
|
-
return error >= e10$1 ? gap =
|
|
31883
|
+
let gap = niceNumbers[0];
|
|
31884
|
+
return error >= e10$1 ? gap = niceNumbers[3] : error >= e5$1 ? gap = niceNumbers[2] : error >= e2$1 && (gap = niceNumbers[1]), power >= 0 ? {
|
|
31885
|
+
step: gap * 10 ** power,
|
|
31886
|
+
gap: gap,
|
|
31887
|
+
power: power
|
|
31888
|
+
} : {
|
|
31889
|
+
step: -(10 ** -power) / gap,
|
|
31890
|
+
gap: gap,
|
|
31891
|
+
power: power
|
|
31892
|
+
};
|
|
31893
|
+
};
|
|
31894
|
+
function tickIncrement(start, stop, count) {
|
|
31895
|
+
const step = (stop - start) / Math.max(0, count);
|
|
31896
|
+
return getNickStep(step);
|
|
30932
31897
|
}
|
|
30933
31898
|
function forceTicks(start, stop, count) {
|
|
30934
31899
|
let step;
|
|
@@ -30961,7 +31926,7 @@
|
|
|
30961
31926
|
stop = d[i1],
|
|
30962
31927
|
maxIter = 10;
|
|
30963
31928
|
for (stop < start && (step = start, start = stop, stop = step, step = i0, i0 = i1, i1 = step); maxIter-- > 0;) {
|
|
30964
|
-
if (step = tickIncrement(start, stop, count), step === prestep) return d[i0] = start, d[i1] = stop, d;
|
|
31929
|
+
if (step = tickIncrement(start, stop, count).step, step === prestep) return d[i0] = start, d[i1] = stop, d;
|
|
30965
31930
|
if (step > 0) start = Math.floor(start / step) * step, stop = Math.ceil(stop / step) * step;else {
|
|
30966
31931
|
if (!(step < 0)) break;
|
|
30967
31932
|
start = Math.ceil(start * step) / step, stop = Math.floor(stop * step) / step;
|
|
@@ -30969,6 +31934,20 @@
|
|
|
30969
31934
|
prestep = step;
|
|
30970
31935
|
}
|
|
30971
31936
|
}
|
|
31937
|
+
function parseNiceOptions(originalDomain, option) {
|
|
31938
|
+
const hasForceMin = isNumber(option.forceMin),
|
|
31939
|
+
hasForceMax = isNumber(option.forceMax);
|
|
31940
|
+
let niceType = null;
|
|
31941
|
+
const niceMinMax = [];
|
|
31942
|
+
let niceDomain = null;
|
|
31943
|
+
const domainValidator = hasForceMin && hasForceMax ? x => x >= option.forceMin && x <= option.forceMax : hasForceMin ? x => x >= option.forceMin : hasForceMax ? x => x <= option.forceMax : null;
|
|
31944
|
+
return hasForceMin ? niceMinMax[0] = option.forceMin : isNumber(option.min) && option.min <= Math.min(originalDomain[0], originalDomain[originalDomain.length - 1]) && (niceMinMax[0] = option.min), hasForceMax ? niceMinMax[1] = option.forceMax : isNumber(option.max) && option.max >= Math.max(originalDomain[0], originalDomain[originalDomain.length - 1]) && (niceMinMax[1] = option.max), isNumber(niceMinMax[0]) && isNumber(niceMinMax[1]) ? (niceDomain = originalDomain.slice(), niceDomain[0] = niceMinMax[0], niceDomain[niceDomain.length - 1] = niceMinMax[1]) : niceType = isNumber(niceMinMax[0]) || isNumber(niceMinMax[1]) ? isNumber(niceMinMax[0]) ? "max" : "min" : "all", {
|
|
31945
|
+
niceType: niceType,
|
|
31946
|
+
niceDomain: niceDomain,
|
|
31947
|
+
niceMinMax: niceMinMax,
|
|
31948
|
+
domainValidator: domainValidator
|
|
31949
|
+
};
|
|
31950
|
+
}
|
|
30972
31951
|
|
|
30973
31952
|
class LinearScale extends ContinuousScale {
|
|
30974
31953
|
constructor() {
|
|
@@ -30980,10 +31959,34 @@
|
|
|
30980
31959
|
tickFormat() {
|
|
30981
31960
|
return () => {};
|
|
30982
31961
|
}
|
|
30983
|
-
|
|
31962
|
+
d3Ticks() {
|
|
30984
31963
|
let count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
|
|
31964
|
+
let options = arguments.length > 1 ? arguments[1] : undefined;
|
|
30985
31965
|
const d = this.calculateVisibleDomain(this._range);
|
|
30986
|
-
return
|
|
31966
|
+
return d3Ticks(d[0], d[d.length - 1], count, options);
|
|
31967
|
+
}
|
|
31968
|
+
ticks() {
|
|
31969
|
+
let count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
|
|
31970
|
+
let options = arguments.length > 1 ? arguments[1] : undefined;
|
|
31971
|
+
var _a;
|
|
31972
|
+
if (this._rangeFactor && (this._rangeFactor[0] > 0 || this._rangeFactor[1] < 1) && 2 === this._range.length || !this._niceType) return this.d3Ticks(count, options);
|
|
31973
|
+
const curNiceDomain = null !== (_a = this._niceDomain) && void 0 !== _a ? _a : this._domain,
|
|
31974
|
+
originalDomain = this._domain,
|
|
31975
|
+
start = curNiceDomain[0],
|
|
31976
|
+
stop = curNiceDomain[curNiceDomain.length - 1];
|
|
31977
|
+
let ticksResult = ticks$1(originalDomain[0], originalDomain[originalDomain.length - 1], count, options);
|
|
31978
|
+
if (!ticksResult.length) return ticksResult;
|
|
31979
|
+
if (ticksResult[0] !== start && "max" === this._niceType || ticksResult[ticksResult.length - 1] !== stop && "min" === this._niceType) {
|
|
31980
|
+
const newNiceDomain = curNiceDomain.slice();
|
|
31981
|
+
"min" === this._niceType ? newNiceDomain[0] = ticksResult[0] : newNiceDomain[newNiceDomain.length - 1] = ticksResult[ticksResult.length - 1], this._niceDomain = newNiceDomain, this.rescale();
|
|
31982
|
+
const min = Math.min(newNiceDomain[0], newNiceDomain[newNiceDomain.length - 1]),
|
|
31983
|
+
max = Math.max(newNiceDomain[0], newNiceDomain[newNiceDomain.length - 1]);
|
|
31984
|
+
ticksResult = ticksResult.filter(entry => entry >= min && entry <= max);
|
|
31985
|
+
} else if ("all" !== this._niceType || ticksResult[0] === start && ticksResult[ticksResult.length - 1] === stop) this._domainValidator && (ticksResult = ticksResult.filter(this._domainValidator));else {
|
|
31986
|
+
const newNiceDomain = curNiceDomain.slice();
|
|
31987
|
+
newNiceDomain[0] = ticksResult[0], newNiceDomain[newNiceDomain.length - 1] = ticksResult[ticksResult.length - 1], this._niceDomain = newNiceDomain, this.rescale();
|
|
31988
|
+
}
|
|
31989
|
+
return ticksResult;
|
|
30987
31990
|
}
|
|
30988
31991
|
forceTicks() {
|
|
30989
31992
|
let count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
|
|
@@ -30996,20 +31999,33 @@
|
|
|
30996
31999
|
}
|
|
30997
32000
|
nice() {
|
|
30998
32001
|
let count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
|
|
30999
|
-
|
|
31000
|
-
|
|
32002
|
+
let option = arguments.length > 1 ? arguments[1] : undefined;
|
|
32003
|
+
var _a, _b;
|
|
32004
|
+
const originalDomain = this._domain;
|
|
32005
|
+
let niceMinMax = [];
|
|
32006
|
+
if (option) {
|
|
32007
|
+
const res = parseNiceOptions(originalDomain, option);
|
|
32008
|
+
if (niceMinMax = res.niceMinMax, this._domainValidator = res.domainValidator, this._niceType = res.niceType, res.niceDomain) return this._niceDomain = res.niceDomain, this.rescale(), this;
|
|
32009
|
+
} else this._niceType = "all";
|
|
32010
|
+
if (this._niceType) {
|
|
32011
|
+
const niceDomain = niceLinear(originalDomain.slice(), count);
|
|
32012
|
+
"min" === this._niceType ? niceDomain[niceDomain.length - 1] = null !== (_a = niceMinMax[1]) && void 0 !== _a ? _a : niceDomain[niceDomain.length - 1] : "max" === this._niceType && (niceDomain[0] = null !== (_b = niceMinMax[0]) && void 0 !== _b ? _b : niceDomain[0]), this._niceDomain = niceDomain, this.rescale();
|
|
32013
|
+
}
|
|
32014
|
+
return this;
|
|
31001
32015
|
}
|
|
31002
32016
|
niceMin() {
|
|
31003
32017
|
let count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
|
|
32018
|
+
this._niceType = "min";
|
|
31004
32019
|
const maxD = this._domain[this._domain.length - 1],
|
|
31005
32020
|
niceDomain = niceLinear(this.domain(), count);
|
|
31006
|
-
return niceDomain && (niceDomain[niceDomain.length - 1] = maxD, this.
|
|
32021
|
+
return niceDomain && (niceDomain[niceDomain.length - 1] = maxD, this._niceDomain = niceDomain, this.rescale()), this;
|
|
31007
32022
|
}
|
|
31008
32023
|
niceMax() {
|
|
31009
32024
|
let count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
|
|
32025
|
+
this._niceType = "max";
|
|
31010
32026
|
const minD = this._domain[0],
|
|
31011
|
-
niceDomain = niceLinear(this.
|
|
31012
|
-
return niceDomain && (niceDomain[0] = minD, this.
|
|
32027
|
+
niceDomain = niceLinear(this._domain.slice(), count);
|
|
32028
|
+
return niceDomain && (niceDomain[0] = minD, this._niceDomain = niceDomain, this.rescale()), this;
|
|
31013
32029
|
}
|
|
31014
32030
|
}
|
|
31015
32031
|
|
|
@@ -31295,6 +32311,7 @@
|
|
|
31295
32311
|
}
|
|
31296
32312
|
}
|
|
31297
32313
|
return {
|
|
32314
|
+
orient: spec.orient,
|
|
31298
32315
|
select: spec.select,
|
|
31299
32316
|
hover: spec.hover,
|
|
31300
32317
|
line: transformAxisLineStyle(spec.domainLine),
|
|
@@ -31308,7 +32325,8 @@
|
|
|
31308
32325
|
return spec.label.formatMethod(datum.rawValue, datum);
|
|
31309
32326
|
}
|
|
31310
32327
|
: null,
|
|
31311
|
-
state: transformStateStyle(spec.label.state)
|
|
32328
|
+
state: transformStateStyle(spec.label.state),
|
|
32329
|
+
containerAlign: spec.label.containerAlign
|
|
31312
32330
|
},
|
|
31313
32331
|
tick: {
|
|
31314
32332
|
visible: spec.tick.visible,
|
|
@@ -34821,7 +35839,7 @@
|
|
|
34821
35839
|
for (let i = 0; i < sortFields.length; i++) {
|
|
34822
35840
|
const sortInfo = sortFields[i];
|
|
34823
35841
|
let v = 0;
|
|
34824
|
-
if ("ordinal" === sortInfo.type ? (void 0 === sortInfo.sortIndex[
|
|
35842
|
+
if ("ordinal" === sortInfo.type ? (void 0 === sortInfo.sortIndex[b[sortInfo.key]] && (sortInfo.sortIndex[b[sortInfo.key]] = sortInfo.sortIndexCount++), void 0 === sortInfo.sortIndex[a[sortInfo.key]] && (sortInfo.sortIndex[a[sortInfo.key]] = sortInfo.sortIndexCount++), v = sortInfo.sortIndex[a[sortInfo.key]] - sortInfo.sortIndex[b[sortInfo.key]]) : "linear" === sortInfo.type && (v = a[sortInfo.key] - b[sortInfo.key]), sortInfo.sortReverse && (v = -v), 0 !== v) return v;
|
|
34825
35843
|
}
|
|
34826
35844
|
return 0;
|
|
34827
35845
|
}
|
|
@@ -35624,20 +36642,16 @@
|
|
|
35624
36642
|
}), _this.isRunning = !1, !1 !== (null == opt ? void 0 : opt.emitMessage) && _this.target.emit("change", []), _this;
|
|
35625
36643
|
}, this.markRunning = () => {
|
|
35626
36644
|
this.isRunning = !0, this.target.emit("markRunning", []);
|
|
35627
|
-
}, name = (null == options ? void 0 : options.name) ? options.name : getUUID("dataview"), this.name = name, (null == options ? void 0 : options.history) && (this.history = options.history), this.dataSet.setDataView(name, this), (null == options ? void 0 : options.fields)
|
|
35628
|
-
type: "fields",
|
|
35629
|
-
options: {
|
|
35630
|
-
fields: options.fields
|
|
35631
|
-
}
|
|
35632
|
-
}, !1));
|
|
36645
|
+
}, name = (null == options ? void 0 : options.name) ? options.name : getUUID("dataview"), this.name = name, (null == options ? void 0 : options.history) && (this.history = options.history), this.dataSet.setDataView(name, this), this.setFields(null == options ? void 0 : options.fields);
|
|
35633
36646
|
}
|
|
35634
36647
|
parse(data, options) {
|
|
35635
36648
|
let emit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
|
36649
|
+
var _a;
|
|
35636
36650
|
this.isRunning = !0, emit && this.target.emit("beforeParse", []);
|
|
35637
36651
|
const cloneData = this.cloneParseData(data, options);
|
|
35638
|
-
if (options) {
|
|
36652
|
+
if (null == options ? void 0 : options.type) {
|
|
35639
36653
|
this.parseOption = options, options = cloneDeep(options);
|
|
35640
|
-
const parserData = this.dataSet.getParser(options.type
|
|
36654
|
+
const parserData = (null !== (_a = this.dataSet.getParser(options.type)) && void 0 !== _a ? _a : this.dataSet.getParser("bytejson"))(cloneData, options.options, this);
|
|
35641
36655
|
this.rawData = cloneData, this.parserData = parserData, this.history && this.historyData.push(cloneData, parserData), this.latestData = parserData;
|
|
35642
36656
|
} else this.parserData = cloneData, this.rawData = cloneData, this.history && this.historyData.push(cloneData), this.latestData = cloneData;
|
|
35643
36657
|
return this.isRunning = !1, emit && this.target.emit("afterParse", []), this;
|
|
@@ -35645,12 +36659,13 @@
|
|
|
35645
36659
|
transform(options) {
|
|
35646
36660
|
let execute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
35647
36661
|
if (this.isRunning = !0, options && options.type) {
|
|
36662
|
+
let pushOption = !0;
|
|
35648
36663
|
if ("fields" === options.type) {
|
|
35649
36664
|
this._fields = options.options.fields;
|
|
35650
36665
|
const index = this.transformsArr.findIndex(_op => _op.type === options.type);
|
|
35651
|
-
index >= 0 && this.transformsArr.
|
|
36666
|
+
index >= 0 && (pushOption = !1, this.transformsArr[index].options.fields = this._fields);
|
|
35652
36667
|
}
|
|
35653
|
-
if (this.transformsArr.push(options), execute) {
|
|
36668
|
+
if (pushOption && this.transformsArr.push(options), execute) {
|
|
35654
36669
|
const lastTag = this.isLastTransform(options);
|
|
35655
36670
|
options = cloneDeep(options), this.executeTransform(options), lastTag && this.diffLastData();
|
|
35656
36671
|
}
|
|
@@ -35717,8 +36732,8 @@
|
|
|
35717
36732
|
this._diffRank = next;
|
|
35718
36733
|
}
|
|
35719
36734
|
cloneParseData(data, options) {
|
|
35720
|
-
let clone = !
|
|
35721
|
-
return
|
|
36735
|
+
let clone = !1;
|
|
36736
|
+
return data instanceof DataView || !0 !== (null == options ? void 0 : options.clone) || (clone = !0), clone ? cloneDeep(data) : data;
|
|
35722
36737
|
}
|
|
35723
36738
|
parseNewData(data, options) {
|
|
35724
36739
|
this.parse(data, options || this.parseOption), this.reRunAllTransform();
|
|
@@ -35731,6 +36746,17 @@
|
|
|
35731
36746
|
var _a;
|
|
35732
36747
|
return this._fields ? this._fields : "dataview" === (null === (_a = this.parseOption) || void 0 === _a ? void 0 : _a.type) && 1 === this.rawData.length && this.rawData[0].getFields ? this.rawData[0].getFields() : null;
|
|
35733
36748
|
}
|
|
36749
|
+
setFields(f) {
|
|
36750
|
+
let foreMerge = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
36751
|
+
this._fields = f && foreMerge ? merge$2({}, this._fields, f) : f;
|
|
36752
|
+
const fieldsOption = this.transformsArr.find(_op => "fields" === _op.type);
|
|
36753
|
+
!isNil(this._fields) && isNil(fieldsOption) ? (this.dataSet.registerTransform("fields", fields), this.transform({
|
|
36754
|
+
type: "fields",
|
|
36755
|
+
options: {
|
|
36756
|
+
fields: this._fields
|
|
36757
|
+
}
|
|
36758
|
+
}, !1)) : fieldsOption && (fieldsOption.options.fields = this._fields);
|
|
36759
|
+
}
|
|
35734
36760
|
destroy() {
|
|
35735
36761
|
this.dataSet.removeDataView(this.name), this.resetDiff(), this.latestData = null, this.rawData = null, this.parserData = null, this.transformsArr = null, this.target = null;
|
|
35736
36762
|
}
|
|
@@ -40485,6 +41511,10 @@
|
|
|
40485
41511
|
if (bottomColumn) {
|
|
40486
41512
|
updateColunmWidth(bottomColumn, detaX, autoRowHeight, 'bottom', scene);
|
|
40487
41513
|
}
|
|
41514
|
+
const rightBottomColumn = scene.getColGroupInRightBottomCorner(col);
|
|
41515
|
+
if (rightBottomColumn) {
|
|
41516
|
+
updateColunmWidth(bottomColumn, detaX, autoRowHeight, 'right-bottom', scene);
|
|
41517
|
+
}
|
|
40488
41518
|
if (col < scene.frozenColCount) {
|
|
40489
41519
|
scene.cornerHeaderGroup.forEachChildrenSkipChild((column, index) => {
|
|
40490
41520
|
if (column.col > col) {
|
|
@@ -40523,6 +41553,13 @@
|
|
|
40523
41553
|
}
|
|
40524
41554
|
});
|
|
40525
41555
|
}
|
|
41556
|
+
if (rightBottomColumn) {
|
|
41557
|
+
scene.rightBottomCornerGroup.forEachChildrenSkipChild((column, index) => {
|
|
41558
|
+
if (column.col > col) {
|
|
41559
|
+
column.setAttribute('x', column.attribute.x + detaX);
|
|
41560
|
+
}
|
|
41561
|
+
});
|
|
41562
|
+
}
|
|
40526
41563
|
scene.table.setColWidth(col, rowHeaderOrBodyColumn.attribute.width, true);
|
|
40527
41564
|
}
|
|
40528
41565
|
function updateColunmWidth(columnGroup, detaX, autoRowHeight, mode, scene) {
|
|
@@ -40570,6 +41607,11 @@
|
|
|
40570
41607
|
colGroup = scene.getColGroupInLeftBottomCorner(col);
|
|
40571
41608
|
oldContainerHeight = scene.leftBottomCornerGroup.attribute.height ?? 0;
|
|
40572
41609
|
}
|
|
41610
|
+
else if (mode === 'right-bottom') {
|
|
41611
|
+
row = scene.table.rowCount - scene.table.bottomFrozenRowCount;
|
|
41612
|
+
colGroup = scene.getColGroupInRightBottomCorner(col);
|
|
41613
|
+
oldContainerHeight = scene.rightBottomCornerGroup.attribute.height ?? 0;
|
|
41614
|
+
}
|
|
40573
41615
|
let y = 0;
|
|
40574
41616
|
colGroup.forEachChildren((cellGroup) => {
|
|
40575
41617
|
if (cellGroup.role !== 'cell') {
|
|
@@ -41160,7 +42202,10 @@
|
|
|
41160
42202
|
}
|
|
41161
42203
|
}
|
|
41162
42204
|
|
|
41163
|
-
function getColX(col, table) {
|
|
42205
|
+
function getColX(col, table, isRightFrozen) {
|
|
42206
|
+
if (isRightFrozen) {
|
|
42207
|
+
return table.tableNoFrameWidth - table.getColsWidth(col, table.colCount - 1);
|
|
42208
|
+
}
|
|
41164
42209
|
let colX = table.getColsWidth(0, col);
|
|
41165
42210
|
if (col >= table.frozenColCount) {
|
|
41166
42211
|
colX -= table.scrollLeft;
|
|
@@ -41406,8 +42451,8 @@
|
|
|
41406
42451
|
this.columnResizeLabel.setAttribute('visible', false);
|
|
41407
42452
|
this.columnResizeLabel.hideAll();
|
|
41408
42453
|
}
|
|
41409
|
-
showResizeCol(col, y) {
|
|
41410
|
-
const colX = getColX(col, this.table);
|
|
42454
|
+
showResizeCol(col, y, isRightFrozen) {
|
|
42455
|
+
const colX = getColX(col, this.table, isRightFrozen);
|
|
41411
42456
|
this.columnResizeLine.setAttributes({
|
|
41412
42457
|
visible: true,
|
|
41413
42458
|
x: colX,
|
|
@@ -41432,8 +42477,8 @@
|
|
|
41432
42477
|
});
|
|
41433
42478
|
this.columnResizeLabel.lastChild.setAttribute('text', `${this.table.getColWidth(col)}px`);
|
|
41434
42479
|
}
|
|
41435
|
-
updateResizeCol(col, y) {
|
|
41436
|
-
const colX = getColX(col, this.table);
|
|
42480
|
+
updateResizeCol(col, y, isRightFrozen) {
|
|
42481
|
+
const colX = getColX(col, this.table, isRightFrozen);
|
|
41437
42482
|
this.columnResizeLine.setAttributes({
|
|
41438
42483
|
x: colX,
|
|
41439
42484
|
points: [
|
|
@@ -41463,14 +42508,14 @@
|
|
|
41463
42508
|
updateMoveCol(backX, lineX, backY, lineY) {
|
|
41464
42509
|
this.cellMover.update(backX, lineX, backY, lineY);
|
|
41465
42510
|
}
|
|
41466
|
-
setFrozenColumnShadow(col) {
|
|
42511
|
+
setFrozenColumnShadow(col, isRightFrozen) {
|
|
41467
42512
|
if (col < 0) {
|
|
41468
42513
|
this.frozenShadowLine.setAttributes({
|
|
41469
42514
|
visible: false
|
|
41470
42515
|
});
|
|
41471
42516
|
}
|
|
41472
42517
|
else {
|
|
41473
|
-
const colX = this.table
|
|
42518
|
+
const colX = getColX(col, this.table, isRightFrozen);
|
|
41474
42519
|
this.frozenShadowLine.setAttributes({
|
|
41475
42520
|
visible: true,
|
|
41476
42521
|
x: colX,
|
|
@@ -42785,11 +43830,12 @@
|
|
|
42785
43830
|
if (attribute.label.formatMethod) {
|
|
42786
43831
|
text = attribute.label.formatMethod(text);
|
|
42787
43832
|
}
|
|
42788
|
-
|
|
43833
|
+
const { width, height } = table.measureText(text, {
|
|
42789
43834
|
fontSize: attribute.label?.style?.fontSize,
|
|
42790
43835
|
fontWeight: attribute.label?.style?.fontWeight,
|
|
42791
43836
|
fontFamily: attribute.label?.style?.fontFamily
|
|
42792
|
-
})
|
|
43837
|
+
});
|
|
43838
|
+
labelWidth = Math.max(labelWidth, getSizeAfterResize(width, height, attribute.label?.style?.angle).width);
|
|
42793
43839
|
});
|
|
42794
43840
|
}
|
|
42795
43841
|
else {
|
|
@@ -42802,32 +43848,29 @@
|
|
|
42802
43848
|
if (attribute.label.formatMethod) {
|
|
42803
43849
|
text = attribute.label.formatMethod(text);
|
|
42804
43850
|
}
|
|
42805
|
-
|
|
43851
|
+
const { width, height } = table.measureText(text, {
|
|
42806
43852
|
fontSize: attribute.label?.style?.fontSize,
|
|
42807
43853
|
fontWeight: attribute.label?.style?.fontWeight,
|
|
42808
43854
|
fontFamily: attribute.label?.style?.fontFamily
|
|
42809
|
-
})
|
|
43855
|
+
});
|
|
43856
|
+
labelWidth = Math.max(labelWidth, getSizeAfterResize(width, height, attribute.label?.style?.angle).width + 2);
|
|
42810
43857
|
});
|
|
42811
43858
|
}
|
|
42812
43859
|
labelWidth += attribute.label.space ?? 4;
|
|
42813
43860
|
}
|
|
42814
43861
|
let titleWidth = 0;
|
|
42815
43862
|
if (attribute.title.visible && attribute.title.text) {
|
|
43863
|
+
const { width, height } = table.measureText(attribute.title.text, {
|
|
43864
|
+
fontSize: attribute.label?.style?.fontSize,
|
|
43865
|
+
fontWeight: attribute.label?.style?.fontWeight,
|
|
43866
|
+
fontFamily: attribute.label?.style?.fontFamily
|
|
43867
|
+
});
|
|
43868
|
+
const size = getSizeAfterResize(width, height, attribute.label?.style?.angle);
|
|
42816
43869
|
if ((config.orient === 'left' || config.orient === 'right') && attribute.title.autoRotate) {
|
|
42817
|
-
titleWidth =
|
|
42818
|
-
table.measureText(attribute.title.text, {
|
|
42819
|
-
fontSize: attribute.title?.style?.fontSize,
|
|
42820
|
-
fontWeight: attribute.title?.style?.fontWeight,
|
|
42821
|
-
fontFamily: attribute.title?.style?.fontFamily
|
|
42822
|
-
}).height + 2;
|
|
43870
|
+
titleWidth = size.height + 2;
|
|
42823
43871
|
}
|
|
42824
43872
|
else {
|
|
42825
|
-
titleWidth =
|
|
42826
|
-
table.measureText(attribute.title.text, {
|
|
42827
|
-
fontSize: attribute.title?.style?.fontSize,
|
|
42828
|
-
fontWeight: attribute.title?.style?.fontWeight,
|
|
42829
|
-
fontFamily: attribute.title?.style?.fontFamily
|
|
42830
|
-
}).width + 2;
|
|
43873
|
+
titleWidth = size.width + 2;
|
|
42831
43874
|
}
|
|
42832
43875
|
titleWidth += attribute.title.space ?? 4;
|
|
42833
43876
|
}
|
|
@@ -42844,10 +43887,12 @@
|
|
|
42844
43887
|
if (attribute.label.formatMethod) {
|
|
42845
43888
|
text = attribute.label.formatMethod(text);
|
|
42846
43889
|
}
|
|
42847
|
-
|
|
43890
|
+
const { width, height } = table.measureText(text, {
|
|
42848
43891
|
fontSize: attribute.label?.style?.fontSize,
|
|
43892
|
+
fontWeight: attribute.label?.style?.fontWeight,
|
|
42849
43893
|
fontFamily: attribute.label?.style?.fontFamily
|
|
42850
|
-
})
|
|
43894
|
+
});
|
|
43895
|
+
labelHeight = Math.max(labelHeight, getSizeAfterResize(width, height, attribute.label?.style?.angle).height);
|
|
42851
43896
|
});
|
|
42852
43897
|
}
|
|
42853
43898
|
else {
|
|
@@ -42860,29 +43905,29 @@
|
|
|
42860
43905
|
if (attribute.label.formatMethod) {
|
|
42861
43906
|
text = attribute.label.formatMethod(text);
|
|
42862
43907
|
}
|
|
42863
|
-
|
|
43908
|
+
const { width, height } = table.measureText(text, {
|
|
42864
43909
|
fontSize: attribute.label?.style?.fontSize,
|
|
43910
|
+
fontWeight: attribute.label?.style?.fontWeight,
|
|
42865
43911
|
fontFamily: attribute.label?.style?.fontFamily
|
|
42866
|
-
})
|
|
43912
|
+
});
|
|
43913
|
+
labelHeight = Math.max(labelHeight, getSizeAfterResize(width, height, attribute.label?.style?.angle).height + 2);
|
|
42867
43914
|
});
|
|
42868
43915
|
}
|
|
42869
43916
|
labelHeight += attribute.label.space ?? 4;
|
|
42870
43917
|
}
|
|
42871
43918
|
let titleHeight = 0;
|
|
42872
43919
|
if (attribute.title.visible && attribute.title.text) {
|
|
43920
|
+
const { width, height } = table.measureText(attribute.title.text, {
|
|
43921
|
+
fontSize: attribute.label?.style?.fontSize,
|
|
43922
|
+
fontWeight: attribute.label?.style?.fontWeight,
|
|
43923
|
+
fontFamily: attribute.label?.style?.fontFamily
|
|
43924
|
+
});
|
|
43925
|
+
const size = getSizeAfterResize(width, height, attribute.label?.style?.angle);
|
|
42873
43926
|
if ((config.orient === 'bottom' || config.orient === 'top') && attribute.title.autoRotate) {
|
|
42874
|
-
titleHeight =
|
|
42875
|
-
table.measureText(attribute.title.text, {
|
|
42876
|
-
fontSize: attribute.title?.style?.fontSize,
|
|
42877
|
-
fontFamily: attribute.title?.style?.fontFamily
|
|
42878
|
-
}).width + 2;
|
|
43927
|
+
titleHeight = size.width + 2;
|
|
42879
43928
|
}
|
|
42880
43929
|
else {
|
|
42881
|
-
titleHeight =
|
|
42882
|
-
table.measureText(attribute.title.text, {
|
|
42883
|
-
fontSize: attribute.title?.style?.fontSize,
|
|
42884
|
-
fontFamily: attribute.title?.style?.fontFamily
|
|
42885
|
-
}).height + 2;
|
|
43930
|
+
titleHeight = size.height + 2;
|
|
42886
43931
|
}
|
|
42887
43932
|
titleHeight += attribute.title.space ?? 4;
|
|
42888
43933
|
}
|
|
@@ -42894,6 +43939,39 @@
|
|
|
42894
43939
|
}
|
|
42895
43940
|
return Number(number.toPrecision(1)).toString();
|
|
42896
43941
|
}
|
|
43942
|
+
function getSizeAfterResize(width, height, angle = 0) {
|
|
43943
|
+
const theta = (angle * Math.PI) / 180;
|
|
43944
|
+
const p1 = { x: -width / 2, y: -height / 2 };
|
|
43945
|
+
const p2 = { x: width / 2, y: -height / 2 };
|
|
43946
|
+
const p3 = { x: width / 2, y: height / 2 };
|
|
43947
|
+
const p4 = { x: -width / 2, y: height / 2 };
|
|
43948
|
+
const p1Rotated = {
|
|
43949
|
+
x: p1.x * Math.cos(theta) - p1.y * Math.sin(theta),
|
|
43950
|
+
y: p1.x * Math.sin(theta) + p1.y * Math.cos(theta)
|
|
43951
|
+
};
|
|
43952
|
+
const p2Rotated = {
|
|
43953
|
+
x: p2.x * Math.cos(theta) - p2.y * Math.sin(theta),
|
|
43954
|
+
y: p2.x * Math.sin(theta) + p2.y * Math.cos(theta)
|
|
43955
|
+
};
|
|
43956
|
+
const p3Rotated = {
|
|
43957
|
+
x: p3.x * Math.cos(theta) - p3.y * Math.sin(theta),
|
|
43958
|
+
y: p3.x * Math.sin(theta) + p3.y * Math.cos(theta)
|
|
43959
|
+
};
|
|
43960
|
+
const p4Rotated = {
|
|
43961
|
+
x: p4.x * Math.cos(theta) - p4.y * Math.sin(theta),
|
|
43962
|
+
y: p4.x * Math.sin(theta) + p4.y * Math.cos(theta)
|
|
43963
|
+
};
|
|
43964
|
+
const bounds = {
|
|
43965
|
+
minX: Math.min(p1Rotated.x, p2Rotated.x, p3Rotated.x, p4Rotated.x),
|
|
43966
|
+
maxX: Math.max(p1Rotated.x, p2Rotated.x, p3Rotated.x, p4Rotated.x),
|
|
43967
|
+
minY: Math.min(p1Rotated.y, p2Rotated.y, p3Rotated.y, p4Rotated.y),
|
|
43968
|
+
maxY: Math.max(p1Rotated.y, p2Rotated.y, p3Rotated.y, p4Rotated.y)
|
|
43969
|
+
};
|
|
43970
|
+
return {
|
|
43971
|
+
width: bounds.maxX - bounds.minX,
|
|
43972
|
+
height: bounds.maxY - bounds.minY
|
|
43973
|
+
};
|
|
43974
|
+
}
|
|
42897
43975
|
|
|
42898
43976
|
function computeColsWidth(table, colStart, colEnd, update) {
|
|
42899
43977
|
typeof window !== 'undefined' ? window.performance.now() : 0;
|
|
@@ -42981,54 +44059,12 @@
|
|
|
42981
44059
|
}
|
|
42982
44060
|
}
|
|
42983
44061
|
function computeColWidth(col, startRow, endRow, table, forceCompute) {
|
|
42984
|
-
const
|
|
42985
|
-
|
|
42986
|
-
|
|
42987
|
-
if (table.widthMode === 'standard') {
|
|
42988
|
-
if (table.isRowHeader(col, 0) || table.isCornerHeader(col, 0)) {
|
|
42989
|
-
const defaultWidth = Array.isArray(table.defaultHeaderColWidth)
|
|
42990
|
-
? table.defaultHeaderColWidth[col] ?? table.defaultColWidth
|
|
42991
|
-
: table.defaultHeaderColWidth;
|
|
42992
|
-
if (defaultWidth === 'auto') {
|
|
42993
|
-
width = 'auto';
|
|
42994
|
-
}
|
|
42995
|
-
else {
|
|
42996
|
-
return defaultWidth;
|
|
42997
|
-
}
|
|
42998
|
-
}
|
|
42999
|
-
if (width !== 'auto') {
|
|
43000
|
-
if (typeof width === 'string') {
|
|
43001
|
-
return toPx(width, table.internalProps.calcWidthContext);
|
|
43002
|
-
}
|
|
43003
|
-
else if (width) {
|
|
43004
|
-
return width;
|
|
43005
|
-
}
|
|
43006
|
-
return table.defaultColWidth;
|
|
43007
|
-
}
|
|
43008
|
-
}
|
|
43009
|
-
else if (table.widthMode === 'adaptive' &&
|
|
43010
|
-
col === 0 &&
|
|
43011
|
-
width !== 'auto' &&
|
|
43012
|
-
layoutMap?.showHeader) {
|
|
43013
|
-
if (typeof width === 'string') {
|
|
43014
|
-
return toPx(width, table.internalProps.calcWidthContext);
|
|
43015
|
-
}
|
|
43016
|
-
else if (width) {
|
|
43017
|
-
return width;
|
|
43018
|
-
}
|
|
43019
|
-
}
|
|
44062
|
+
const width = getColWidthDefinedWidthResizedWidth(col, table);
|
|
44063
|
+
if (typeof width === 'number') {
|
|
44064
|
+
return width;
|
|
43020
44065
|
}
|
|
43021
|
-
else if (width !== 'auto' &&
|
|
43022
|
-
|
|
43023
|
-
return toPx(width, table.internalProps.calcWidthContext);
|
|
43024
|
-
}
|
|
43025
|
-
else if (width) {
|
|
43026
|
-
return width;
|
|
43027
|
-
}
|
|
43028
|
-
const defaultWidth = table.getColWidthDefine(col);
|
|
43029
|
-
if (defaultWidth !== 'auto') {
|
|
43030
|
-
return table.getColWidth(col);
|
|
43031
|
-
}
|
|
44066
|
+
else if (width !== 'auto' && typeof width === 'string') {
|
|
44067
|
+
return toPx(width, table.internalProps.calcWidthContext);
|
|
43032
44068
|
}
|
|
43033
44069
|
return computeAutoColWidth(width, col, startRow, endRow, forceCompute, table);
|
|
43034
44070
|
}
|
|
@@ -43206,6 +44242,13 @@
|
|
|
43206
44242
|
height: table.getRowHeight(row)
|
|
43207
44243
|
};
|
|
43208
44244
|
}
|
|
44245
|
+
function getColWidthDefinedWidthResizedWidth(col, table) {
|
|
44246
|
+
const widthDefined = table.getColWidthDefined(col);
|
|
44247
|
+
if (table.internalProps._widthResizedColMap.has(col)) {
|
|
44248
|
+
return table.getColWidth(col);
|
|
44249
|
+
}
|
|
44250
|
+
return widthDefined;
|
|
44251
|
+
}
|
|
43209
44252
|
|
|
43210
44253
|
const utilTextMark = new WrapText({
|
|
43211
44254
|
autoWrapText: true
|
|
@@ -44072,11 +45115,7 @@
|
|
|
44072
45115
|
const { leftBottomCornerGroup, rightTopCornerGroup, rightBottomCornerGroup } = proxy.table.scenegraph;
|
|
44073
45116
|
proxy.setParamsForRow();
|
|
44074
45117
|
proxy.setParamsForColumn();
|
|
44075
|
-
proxy.table.internalProps._colWidthsMap.clear();
|
|
44076
|
-
proxy.table._clearColRangeWidthsMap();
|
|
44077
45118
|
computeColsWidth(proxy.table, 0, Math.min(proxy.firstScreenColLimit, proxy.table.colCount - 1));
|
|
44078
|
-
proxy.table.internalProps._rowHeightsMap.clear();
|
|
44079
|
-
proxy.table._clearRowRangeHeightsMap();
|
|
44080
45119
|
computeRowsHeight(proxy.table, 0, Math.min(proxy.firstScreenRowLimit, proxy.table.rowCount - 1));
|
|
44081
45120
|
if (proxy.table.rightFrozenColCount > 0 && proxy.table.colCount - 1 > proxy.firstScreenColLimit) {
|
|
44082
45121
|
computeColsWidth(proxy.table, proxy.table.colCount - 1 - proxy.table.rightFrozenColCount + 1, proxy.table.colCount - 1);
|
|
@@ -46087,6 +47126,15 @@
|
|
|
46087
47126
|
});
|
|
46088
47127
|
}
|
|
46089
47128
|
|
|
47129
|
+
function updateContainerChildrenX(containerGroup) {
|
|
47130
|
+
let x = 0;
|
|
47131
|
+
containerGroup.forEachChildrenSkipChild((column, index) => {
|
|
47132
|
+
column.setAttribute('x', x);
|
|
47133
|
+
x += column.attribute.width;
|
|
47134
|
+
});
|
|
47135
|
+
return x;
|
|
47136
|
+
}
|
|
47137
|
+
|
|
46090
47138
|
container.load(splitModule);
|
|
46091
47139
|
class Scenegraph {
|
|
46092
47140
|
proxy;
|
|
@@ -46556,6 +47604,7 @@
|
|
|
46556
47604
|
this.table.isPivotChart() && updateChartState(this, datum);
|
|
46557
47605
|
}
|
|
46558
47606
|
updateAutoColWidth(col) {
|
|
47607
|
+
this.table.internalProps._widthResizedColMap.delete(col);
|
|
46559
47608
|
const oldWidth = this.table.getColWidth(col);
|
|
46560
47609
|
const newWidth = computeColWidth(col, 0, this.table.rowCount - 1, this.table, true);
|
|
46561
47610
|
if (newWidth !== oldWidth) {
|
|
@@ -46861,29 +47910,24 @@
|
|
|
46861
47910
|
moveHeaderPosition(colSource, rowSource, colTarget, rowTarget, this.table);
|
|
46862
47911
|
}
|
|
46863
47912
|
updateContainer() {
|
|
46864
|
-
|
|
46865
|
-
this.
|
|
46866
|
-
|
|
46867
|
-
|
|
46868
|
-
|
|
46869
|
-
|
|
46870
|
-
this.
|
|
46871
|
-
|
|
46872
|
-
|
|
46873
|
-
});
|
|
46874
|
-
let colHeaderX = 0;
|
|
46875
|
-
this.colHeaderGroup.forEachChildrenSkipChild((column, index) => {
|
|
46876
|
-
column.setAttribute('x', colHeaderX);
|
|
46877
|
-
colHeaderX += column.attribute.width;
|
|
46878
|
-
});
|
|
46879
|
-
let bodyX = 0;
|
|
46880
|
-
this.bodyGroup.forEachChildrenSkipChild((column, index) => {
|
|
46881
|
-
column.setAttribute('x', bodyX);
|
|
46882
|
-
bodyX += column.attribute.width;
|
|
46883
|
-
});
|
|
47913
|
+
const cornerX = updateContainerChildrenX(this.cornerHeaderGroup);
|
|
47914
|
+
const rowHeaderX = updateContainerChildrenX(this.rowHeaderGroup);
|
|
47915
|
+
const colHeaderX = updateContainerChildrenX(this.colHeaderGroup);
|
|
47916
|
+
const bodyX = updateContainerChildrenX(this.bodyGroup);
|
|
47917
|
+
const rightX = updateContainerChildrenX(this.rightFrozenGroup);
|
|
47918
|
+
updateContainerChildrenX(this.bottomFrozenGroup);
|
|
47919
|
+
updateContainerChildrenX(this.leftBottomCornerGroup);
|
|
47920
|
+
updateContainerChildrenX(this.rightTopCornerGroup);
|
|
47921
|
+
updateContainerChildrenX(this.rightBottomCornerGroup);
|
|
46884
47922
|
this.cornerHeaderGroup.setDeltaWidth(cornerX - this.cornerHeaderGroup.attribute.width);
|
|
47923
|
+
this.leftBottomCornerGroup.setDeltaWidth(cornerX - this.leftBottomCornerGroup.attribute.width);
|
|
46885
47924
|
this.colHeaderGroup.setDeltaWidth(colHeaderX - this.colHeaderGroup.attribute.width);
|
|
47925
|
+
this.rightFrozenGroup.setDeltaWidth(colHeaderX - this.rightFrozenGroup.attribute.width);
|
|
46886
47926
|
this.rowHeaderGroup.setDeltaWidth(rowHeaderX - this.rowHeaderGroup.attribute.width);
|
|
47927
|
+
this.bottomFrozenGroup.setDeltaWidth(rowHeaderX - this.bottomFrozenGroup.attribute.width);
|
|
47928
|
+
this.rightFrozenGroup.setDeltaWidth(rightX - this.rightFrozenGroup.attribute.width);
|
|
47929
|
+
this.rightTopCornerGroup.setDeltaWidth(rightX - this.rightTopCornerGroup.attribute.width);
|
|
47930
|
+
this.rightBottomCornerGroup.setDeltaWidth(rightX - this.rightBottomCornerGroup.attribute.width);
|
|
46887
47931
|
this.bodyGroup.setDeltaWidth(bodyX - this.bodyGroup.attribute.width);
|
|
46888
47932
|
this.colHeaderGroup.setAttribute('x', this.cornerHeaderGroup.attribute.width);
|
|
46889
47933
|
this.bottomFrozenGroup.setAttribute('x', this.rowHeaderGroup.attribute.width);
|
|
@@ -46915,11 +47959,26 @@
|
|
|
46915
47959
|
getResizeColAt(abstractX, abstractY, cellGroup, offset = ResizeColumnHotSpotSize / 2) {
|
|
46916
47960
|
if (!cellGroup) ;
|
|
46917
47961
|
else {
|
|
47962
|
+
let cell;
|
|
46918
47963
|
if (abstractX < cellGroup.globalAABBBounds.x1 + offset) {
|
|
46919
|
-
|
|
47964
|
+
cell = { col: cellGroup.col - 1, row: cellGroup.row, x: cellGroup.globalAABBBounds.x1 };
|
|
46920
47965
|
}
|
|
46921
|
-
if (cellGroup.globalAABBBounds.x2 - offset < abstractX) {
|
|
46922
|
-
|
|
47966
|
+
else if (cellGroup.globalAABBBounds.x2 - offset < abstractX) {
|
|
47967
|
+
cell = { col: cellGroup.col, row: cellGroup.row, x: cellGroup.globalAABBBounds.x2 };
|
|
47968
|
+
}
|
|
47969
|
+
if (cell &&
|
|
47970
|
+
this.table.rightFrozenColCount > 0 &&
|
|
47971
|
+
cell.col === this.table.colCount - this.table.rightFrozenColCount - 1 &&
|
|
47972
|
+
this.table.tableNoFrameWidth -
|
|
47973
|
+
this.table.getFrozenColsWidth() -
|
|
47974
|
+
this.table.getRightFrozenColsWidth() +
|
|
47975
|
+
this.table.scrollLeft <
|
|
47976
|
+
this.bodyGroup.attribute.width) {
|
|
47977
|
+
cell.col = cell.col + 1;
|
|
47978
|
+
cell.rightFrozen = true;
|
|
47979
|
+
}
|
|
47980
|
+
if (cell) {
|
|
47981
|
+
return cell;
|
|
46923
47982
|
}
|
|
46924
47983
|
}
|
|
46925
47984
|
return { col: -1, row: -1 };
|
|
@@ -47360,14 +48419,17 @@
|
|
|
47360
48419
|
order: 'normal'
|
|
47361
48420
|
};
|
|
47362
48421
|
}
|
|
47363
|
-
table.
|
|
48422
|
+
const sortEventReturns = table.fireListeners(TABLE_EVENT_TYPE.SORT_CLICK, tableState);
|
|
48423
|
+
if (sortEventReturns.includes(false)) {
|
|
48424
|
+
return;
|
|
48425
|
+
}
|
|
48426
|
+
table.internalProps.sortState = tableState;
|
|
47364
48427
|
table.stateManeger.setSortState(tableState);
|
|
47365
48428
|
if (headerC?.sort) {
|
|
47366
48429
|
executeSort(tableState, table, headerC);
|
|
47367
48430
|
}
|
|
47368
48431
|
table.scenegraph.sortCell();
|
|
47369
48432
|
table.stateManeger.updateSelectPos(-1, -1);
|
|
47370
|
-
table.fireListeners(TABLE_EVENT_TYPE.SORT_CLICK, tableState);
|
|
47371
48433
|
}
|
|
47372
48434
|
function executeSort(newState, table, headerDefine) {
|
|
47373
48435
|
let hd;
|
|
@@ -47824,6 +48886,135 @@
|
|
|
47824
48886
|
};
|
|
47825
48887
|
}
|
|
47826
48888
|
|
|
48889
|
+
function updateResizeColumn(xInTable, yInTable, state) {
|
|
48890
|
+
xInTable = Math.ceil(xInTable);
|
|
48891
|
+
yInTable = Math.ceil(yInTable);
|
|
48892
|
+
let detaX = state.columnResize.isRightFrozen ? state.columnResize.x - xInTable : xInTable - state.columnResize.x;
|
|
48893
|
+
if (Math.abs(detaX) < 1) {
|
|
48894
|
+
return;
|
|
48895
|
+
}
|
|
48896
|
+
const widthCache = state.table.getColWidth(state.columnResize.col);
|
|
48897
|
+
let width = widthCache;
|
|
48898
|
+
width += detaX;
|
|
48899
|
+
const minWidth = state.table.getMinColWidth(state.columnResize.col);
|
|
48900
|
+
const maxWidth = state.table.getMaxColWidth(state.columnResize.col);
|
|
48901
|
+
if (width < minWidth || width > maxWidth) {
|
|
48902
|
+
if (widthCache === minWidth || widthCache === maxWidth) {
|
|
48903
|
+
return;
|
|
48904
|
+
}
|
|
48905
|
+
else if (widthCache - minWidth > maxWidth - widthCache) {
|
|
48906
|
+
detaX = maxWidth - widthCache;
|
|
48907
|
+
}
|
|
48908
|
+
else {
|
|
48909
|
+
detaX = minWidth - widthCache;
|
|
48910
|
+
}
|
|
48911
|
+
}
|
|
48912
|
+
detaX = Math.ceil(detaX);
|
|
48913
|
+
if (state.columnResize.col < state.table.rowHeaderLevelCount ||
|
|
48914
|
+
state.columnResize.col >= state.table.colCount - state.table.rightFrozenColCount) {
|
|
48915
|
+
updateResizeColForColumn(detaX, state);
|
|
48916
|
+
}
|
|
48917
|
+
else if (state.table.internalProps.columnResizeType === 'indicator') {
|
|
48918
|
+
updateResizeColForIndicator(detaX, state);
|
|
48919
|
+
}
|
|
48920
|
+
else if (state.table.internalProps.columnResizeType === 'indicatorGroup') {
|
|
48921
|
+
updateResizeColForIndicatorGroup(detaX, state);
|
|
48922
|
+
}
|
|
48923
|
+
else if (state.table.internalProps.columnResizeType === 'all') {
|
|
48924
|
+
updateResizeColForAll(detaX, state);
|
|
48925
|
+
}
|
|
48926
|
+
else {
|
|
48927
|
+
updateResizeColForColumn(detaX, state);
|
|
48928
|
+
}
|
|
48929
|
+
state.columnResize.x = xInTable;
|
|
48930
|
+
state.table.scenegraph.component.updateResizeCol(state.columnResize.col, yInTable, state.columnResize.isRightFrozen);
|
|
48931
|
+
if (state.columnResize.col < state.table.frozenColCount &&
|
|
48932
|
+
!state.table.isPivotTable() &&
|
|
48933
|
+
!state.table.transpose) {
|
|
48934
|
+
state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1, state.columnResize.isRightFrozen);
|
|
48935
|
+
}
|
|
48936
|
+
state.table.scenegraph.updateNextFrame();
|
|
48937
|
+
}
|
|
48938
|
+
function updateResizeColForColumn(detaX, state) {
|
|
48939
|
+
if (state.table.widthMode === 'adaptive' && state.columnResize.col < state.table.colCount - 1) {
|
|
48940
|
+
const rightColWidth = state.table.getColWidth(state.columnResize.col + 1);
|
|
48941
|
+
if (rightColWidth - detaX < 0) {
|
|
48942
|
+
detaX = rightColWidth;
|
|
48943
|
+
}
|
|
48944
|
+
state.table.scenegraph.updateColWidth(state.columnResize.col, detaX);
|
|
48945
|
+
state.table.scenegraph.updateColWidth(state.columnResize.col + 1, -detaX);
|
|
48946
|
+
state.table.internalProps._widthResizedColMap.add(state.columnResize.col);
|
|
48947
|
+
state.table.internalProps._widthResizedColMap.add(state.columnResize.col + 1);
|
|
48948
|
+
}
|
|
48949
|
+
else {
|
|
48950
|
+
state.table.scenegraph.updateColWidth(state.columnResize.col, detaX);
|
|
48951
|
+
state.table.internalProps._widthResizedColMap.add(state.columnResize.col);
|
|
48952
|
+
}
|
|
48953
|
+
}
|
|
48954
|
+
function updateResizeColForAll(detaX, state) {
|
|
48955
|
+
const layout = state.table.internalProps.layoutMap;
|
|
48956
|
+
for (let col = state.table.options.frozenColCount; col < state.table.colCount - state.table.rightFrozenColCount; col++) {
|
|
48957
|
+
if (!(state.table.internalProps.transpose || (state.table.isPivotTable() && !layout.indicatorsAsCol))) {
|
|
48958
|
+
const cellDefine = layout.getBody(col, state.table.columnHeaderLevelCount);
|
|
48959
|
+
if (cellDefine?.disableColumnResize) {
|
|
48960
|
+
continue;
|
|
48961
|
+
}
|
|
48962
|
+
}
|
|
48963
|
+
state.table.scenegraph.updateColWidth(col, detaX);
|
|
48964
|
+
state.table.internalProps._widthResizedColMap.add(col);
|
|
48965
|
+
}
|
|
48966
|
+
}
|
|
48967
|
+
function updateResizeColForIndicator(detaX, state) {
|
|
48968
|
+
const layout = state.table.internalProps.layoutMap;
|
|
48969
|
+
let resizeIndicatorKey;
|
|
48970
|
+
let resizeDimensionKey;
|
|
48971
|
+
let resizeDimensionValue;
|
|
48972
|
+
if (layout.indicatorsAsCol) {
|
|
48973
|
+
resizeIndicatorKey = layout.getIndicatorKey(state.columnResize.col, state.table.columnHeaderLevelCount);
|
|
48974
|
+
}
|
|
48975
|
+
else {
|
|
48976
|
+
const headerPaths = layout.getCellHeaderPaths(state.columnResize.col, state.table.columnHeaderLevelCount - 1);
|
|
48977
|
+
const headerPath = headerPaths.colHeaderPaths[headerPaths.colHeaderPaths.length - 1];
|
|
48978
|
+
resizeDimensionKey = headerPath.dimensionKey;
|
|
48979
|
+
resizeDimensionValue = headerPath.value;
|
|
48980
|
+
}
|
|
48981
|
+
for (let col = state.table.rowHeaderLevelCount; col < state.table.colCount - state.table.rightFrozenColCount; col++) {
|
|
48982
|
+
const indicatorKey = layout.getIndicatorKey(col, state.table.columnHeaderLevelCount);
|
|
48983
|
+
if (layout.indicatorsAsCol && indicatorKey === resizeIndicatorKey) {
|
|
48984
|
+
state.table.scenegraph.updateColWidth(col, detaX);
|
|
48985
|
+
state.table.internalProps._widthResizedColMap.add(col);
|
|
48986
|
+
}
|
|
48987
|
+
else if (!layout.indicatorsAsCol) {
|
|
48988
|
+
const headerPaths = layout.getCellHeaderPaths(col, state.table.columnHeaderLevelCount - 1);
|
|
48989
|
+
const headerPath = headerPaths?.colHeaderPaths[headerPaths.colHeaderPaths.length - 1];
|
|
48990
|
+
if (headerPath && resizeDimensionKey === headerPath.dimensionKey && resizeDimensionValue === headerPath.value) {
|
|
48991
|
+
state.table.scenegraph.updateColWidth(col, detaX);
|
|
48992
|
+
state.table.internalProps._widthResizedColMap.add(col);
|
|
48993
|
+
}
|
|
48994
|
+
}
|
|
48995
|
+
}
|
|
48996
|
+
}
|
|
48997
|
+
function updateResizeColForIndicatorGroup(detaX, state) {
|
|
48998
|
+
const layout = state.table.internalProps.layoutMap;
|
|
48999
|
+
const headerPaths = layout.getCellHeaderPaths(state.columnResize.col, state.table.columnHeaderLevelCount);
|
|
49000
|
+
const node = layout.getHeadNode(headerPaths.colHeaderPaths.slice(0, headerPaths.colHeaderPaths.length - 1));
|
|
49001
|
+
const startCol = node.startInTotal + state.table.frozenColCount;
|
|
49002
|
+
const endCol = node.startInTotal + state.table.frozenColCount + node.size - 1;
|
|
49003
|
+
const totalColWidth = state.table.getColsWidth(startCol, endCol);
|
|
49004
|
+
const moveX = detaX;
|
|
49005
|
+
for (let col = startCol; col <= endCol; col++) {
|
|
49006
|
+
if (!(state.table.internalProps.transpose || (state.table.isPivotTable() && !layout.indicatorsAsCol))) {
|
|
49007
|
+
const cellDefine = layout.getBody(col, state.table.columnHeaderLevelCount);
|
|
49008
|
+
if (cellDefine?.disableColumnResize) {
|
|
49009
|
+
continue;
|
|
49010
|
+
}
|
|
49011
|
+
}
|
|
49012
|
+
const prevWidth = state.table.getColWidth(col);
|
|
49013
|
+
state.table.scenegraph.updateColWidth(col, (prevWidth / totalColWidth) * moveX);
|
|
49014
|
+
state.table.internalProps._widthResizedColMap.add(col);
|
|
49015
|
+
}
|
|
49016
|
+
}
|
|
49017
|
+
|
|
47827
49018
|
class StateManeger {
|
|
47828
49019
|
table;
|
|
47829
49020
|
interactionState;
|
|
@@ -48094,63 +49285,17 @@
|
|
|
48094
49285
|
this.table.scenegraph.component.hideResizeCol();
|
|
48095
49286
|
this.table.scenegraph.updateNextFrame();
|
|
48096
49287
|
}
|
|
48097
|
-
startResizeCol(col, x, y) {
|
|
49288
|
+
startResizeCol(col, x, y, isRightFrozen) {
|
|
48098
49289
|
this.columnResize.resizing = true;
|
|
48099
49290
|
this.columnResize.col = col;
|
|
48100
49291
|
this.columnResize.x = x;
|
|
48101
|
-
this.
|
|
49292
|
+
this.columnResize.isRightFrozen = isRightFrozen;
|
|
49293
|
+
this.table.scenegraph.component.showResizeCol(col, y, isRightFrozen);
|
|
48102
49294
|
this.table.stateManeger.updateSelectPos(-1, -1);
|
|
48103
49295
|
this.table.scenegraph.updateNextFrame();
|
|
48104
49296
|
}
|
|
48105
49297
|
updateResizeCol(xInTable, yInTable) {
|
|
48106
|
-
xInTable
|
|
48107
|
-
yInTable = Math.ceil(yInTable);
|
|
48108
|
-
let detaX = xInTable - this.columnResize.x;
|
|
48109
|
-
if (Math.abs(detaX) < 1) {
|
|
48110
|
-
return;
|
|
48111
|
-
}
|
|
48112
|
-
let widthCache = this.table.colWidthsMap.get(this.columnResize.col);
|
|
48113
|
-
if (typeof widthCache === 'number') {
|
|
48114
|
-
widthCache = widthCache;
|
|
48115
|
-
}
|
|
48116
|
-
else {
|
|
48117
|
-
widthCache = this.table.getColWidth(this.columnResize.col);
|
|
48118
|
-
}
|
|
48119
|
-
let width = widthCache;
|
|
48120
|
-
width += detaX;
|
|
48121
|
-
const minWidth = this.table.getMinColWidth(this.columnResize.col);
|
|
48122
|
-
const maxWidth = this.table.getMaxColWidth(this.columnResize.col);
|
|
48123
|
-
if (width < minWidth || width > maxWidth) {
|
|
48124
|
-
if (widthCache === minWidth || widthCache === maxWidth) {
|
|
48125
|
-
return;
|
|
48126
|
-
}
|
|
48127
|
-
else if (widthCache - minWidth > maxWidth - widthCache) {
|
|
48128
|
-
detaX = maxWidth - widthCache;
|
|
48129
|
-
}
|
|
48130
|
-
else {
|
|
48131
|
-
detaX = minWidth - widthCache;
|
|
48132
|
-
}
|
|
48133
|
-
}
|
|
48134
|
-
detaX = Math.ceil(detaX);
|
|
48135
|
-
if (this.table.widthMode === 'adaptive' && this.columnResize.col < this.table.colCount - 1) {
|
|
48136
|
-
const rightColWidth = this.table.getColWidth(this.columnResize.col + 1);
|
|
48137
|
-
if (rightColWidth - detaX < 0) {
|
|
48138
|
-
detaX = rightColWidth;
|
|
48139
|
-
}
|
|
48140
|
-
this.table.scenegraph.updateColWidth(this.columnResize.col, detaX);
|
|
48141
|
-
this.table.scenegraph.updateColWidth(this.columnResize.col + 1, -detaX);
|
|
48142
|
-
}
|
|
48143
|
-
else {
|
|
48144
|
-
this.table.scenegraph.updateColWidth(this.columnResize.col, detaX);
|
|
48145
|
-
}
|
|
48146
|
-
this.columnResize.x = xInTable;
|
|
48147
|
-
this.table.scenegraph.component.updateResizeCol(this.columnResize.col, yInTable);
|
|
48148
|
-
if (this.columnResize.col < this.table.frozenColCount &&
|
|
48149
|
-
!this.table.isPivotTable() &&
|
|
48150
|
-
!this.table.transpose) {
|
|
48151
|
-
this.table.scenegraph.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
|
|
48152
|
-
}
|
|
48153
|
-
this.table.scenegraph.updateNextFrame();
|
|
49298
|
+
updateResizeColumn(xInTable, yInTable, this);
|
|
48154
49299
|
}
|
|
48155
49300
|
startMoveCol(col, row, x, y) {
|
|
48156
49301
|
startMoveCol(col, row, x, y, this);
|
|
@@ -48592,6 +49737,9 @@
|
|
|
48592
49737
|
table.stateManeger.updateDrillState(undefined, undefined, false, false, -1, -1);
|
|
48593
49738
|
}
|
|
48594
49739
|
});
|
|
49740
|
+
table.on(TABLE_EVENT_TYPE.MOUSELEAVE_TABLE, (e) => {
|
|
49741
|
+
table.stateManeger.updateDrillState(undefined, undefined, false, false, -1, -1);
|
|
49742
|
+
});
|
|
48595
49743
|
}
|
|
48596
49744
|
function drillClick(table) {
|
|
48597
49745
|
table.fireListeners(PIVOT_TABLE_EVENT_TYPE.DRILLMENU_CLICK, table.stateManeger.drill);
|
|
@@ -48673,6 +49821,7 @@
|
|
|
48673
49821
|
return null;
|
|
48674
49822
|
}
|
|
48675
49823
|
|
|
49824
|
+
let LastPointerXY;
|
|
48676
49825
|
function bindTableGroupListener(eventManeger) {
|
|
48677
49826
|
const table = eventManeger.table;
|
|
48678
49827
|
const stateManeger = table.stateManeger;
|
|
@@ -48698,6 +49847,9 @@
|
|
|
48698
49847
|
}
|
|
48699
49848
|
});
|
|
48700
49849
|
table.scenegraph.tableGroup.addEventListener('pointermove', (e) => {
|
|
49850
|
+
const lastX = LastPointerXY?.x ?? e.x;
|
|
49851
|
+
const lastY = LastPointerXY?.y ?? e.y;
|
|
49852
|
+
LastPointerXY = { x: e.x, y: e.y };
|
|
48701
49853
|
if (eventManeger.touchSetTimeout) {
|
|
48702
49854
|
clearTimeout(eventManeger.touchSetTimeout);
|
|
48703
49855
|
eventManeger.touchSetTimeout = undefined;
|
|
@@ -48706,7 +49858,8 @@
|
|
|
48706
49858
|
if (stateManeger.interactionState === InteractionState.scrolling) {
|
|
48707
49859
|
return;
|
|
48708
49860
|
}
|
|
48709
|
-
if (stateManeger.interactionState === InteractionState.grabing
|
|
49861
|
+
if (stateManeger.interactionState === InteractionState.grabing &&
|
|
49862
|
+
Math.abs(lastX - e.x) + Math.abs(lastY - e.y) >= 1) {
|
|
48710
49863
|
if (stateManeger.isResizeCol()) ;
|
|
48711
49864
|
else if (stateManeger.isMoveCol()) {
|
|
48712
49865
|
eventManeger.dealColumnMover(eventArgsSet);
|
|
@@ -48844,6 +49997,7 @@
|
|
|
48844
49997
|
eventManeger.dealTableSelect();
|
|
48845
49998
|
});
|
|
48846
49999
|
table.scenegraph.tableGroup.addEventListener('pointerdown', (e) => {
|
|
50000
|
+
LastPointerXY = { x: e.x, y: e.y };
|
|
48847
50001
|
if (e.button !== 0) {
|
|
48848
50002
|
return;
|
|
48849
50003
|
}
|
|
@@ -49637,7 +50791,7 @@
|
|
|
49637
50791
|
const resizeCol = this.table.scenegraph.getResizeColAt(eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y, eventArgs.targetCell);
|
|
49638
50792
|
if (this.table._canResizeColumn(resizeCol.col, resizeCol.row) && resizeCol.col >= 0) {
|
|
49639
50793
|
if (update) {
|
|
49640
|
-
this.table.stateManeger.startResizeCol(resizeCol.col, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y);
|
|
50794
|
+
this.table.stateManeger.startResizeCol(resizeCol.col, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y, resizeCol.rightFrozen);
|
|
49641
50795
|
}
|
|
49642
50796
|
return true;
|
|
49643
50797
|
}
|
|
@@ -51446,6 +52600,9 @@
|
|
|
51446
52600
|
this._unbindFromCell();
|
|
51447
52601
|
}
|
|
51448
52602
|
});
|
|
52603
|
+
table.on(TABLE_EVENT_TYPE.MOUSELEAVE_TABLE, e => {
|
|
52604
|
+
this._unbindFromCell();
|
|
52605
|
+
});
|
|
51449
52606
|
table.on(TABLE_EVENT_TYPE.SCROLL, e => {
|
|
51450
52607
|
const info = this._attachInfo;
|
|
51451
52608
|
if (info?.tooltipOptions && info?.range?.start) {
|
|
@@ -52337,7 +53494,7 @@
|
|
|
52337
53494
|
return TABLE_EVENT_TYPE;
|
|
52338
53495
|
}
|
|
52339
53496
|
options;
|
|
52340
|
-
version = "0.10.
|
|
53497
|
+
version = "0.10.1-alpha.1";
|
|
52341
53498
|
pagerConf;
|
|
52342
53499
|
id = `VTable${Date.now()}`;
|
|
52343
53500
|
headerStyleCache;
|
|
@@ -52398,6 +53555,7 @@
|
|
|
52398
53555
|
internalProps._rowHeightsMap = new NumberMap();
|
|
52399
53556
|
internalProps._rowRangeHeightsMap = new Map();
|
|
52400
53557
|
internalProps._colRangeWidthsMap = new Map();
|
|
53558
|
+
internalProps._widthResizedColMap = new Set();
|
|
52401
53559
|
this.colWidthsMap = new NumberMap();
|
|
52402
53560
|
this.colContentWidthsMap = new NumberMap();
|
|
52403
53561
|
this.colWidthsLimit = {};
|
|
@@ -52735,17 +53893,7 @@
|
|
|
52735
53893
|
}
|
|
52736
53894
|
const cachedLowerColWidth = this._colRangeWidthsMap.get(`$${startCol}$${endCol - 1}`);
|
|
52737
53895
|
if (cachedLowerColWidth !== null && cachedLowerColWidth !== undefined) {
|
|
52738
|
-
const
|
|
52739
|
-
let adjustW;
|
|
52740
|
-
if (width) {
|
|
52741
|
-
adjustW =
|
|
52742
|
-
this.widthMode === 'adaptive' || this.transpose
|
|
52743
|
-
? Number(width)
|
|
52744
|
-
: this._adjustColWidth(endCol, this._colWidthDefineToPxWidth(width));
|
|
52745
|
-
}
|
|
52746
|
-
else {
|
|
52747
|
-
adjustW = this.getColWidth(endCol);
|
|
52748
|
-
}
|
|
53896
|
+
const adjustW = this.getColWidth(endCol);
|
|
52749
53897
|
const addWidth = cachedLowerColWidth + adjustW;
|
|
52750
53898
|
if (startCol >= 0 && endCol >= 0 && !Number.isNaN(addWidth)) {
|
|
52751
53899
|
this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(addWidth));
|
|
@@ -52756,21 +53904,6 @@
|
|
|
52756
53904
|
for (let col = startCol; col <= endCol; col++) {
|
|
52757
53905
|
w += this.getColWidth(col);
|
|
52758
53906
|
}
|
|
52759
|
-
this.colWidthsMap.each(startCol, endCol, (width, col) => {
|
|
52760
|
-
w +=
|
|
52761
|
-
(this.widthMode === 'adaptive' || this.transpose
|
|
52762
|
-
? Number(width)
|
|
52763
|
-
: this._adjustColWidth(col, this._colWidthDefineToPxWidth(width))) - this.getColWidth(col);
|
|
52764
|
-
});
|
|
52765
|
-
for (let col = startCol; col <= endCol; col++) {
|
|
52766
|
-
if (this.colWidthsMap.has(col)) {
|
|
52767
|
-
continue;
|
|
52768
|
-
}
|
|
52769
|
-
const adj = this._adjustColWidth(col, this.internalProps.defaultColWidth);
|
|
52770
|
-
if (adj !== this.internalProps.defaultColWidth) {
|
|
52771
|
-
w += adj - this.internalProps.defaultColWidth;
|
|
52772
|
-
}
|
|
52773
|
-
}
|
|
52774
53907
|
if (startCol >= 0 && endCol >= 0) {
|
|
52775
53908
|
this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(w));
|
|
52776
53909
|
}
|
|
@@ -52839,8 +53972,12 @@
|
|
|
52839
53972
|
}
|
|
52840
53973
|
return Math.round(h);
|
|
52841
53974
|
}
|
|
52842
|
-
|
|
52843
|
-
const
|
|
53975
|
+
getColWidthDefined(col) {
|
|
53976
|
+
const { layoutMap } = this.internalProps;
|
|
53977
|
+
if (this.widthMode === 'autoWidth') {
|
|
53978
|
+
return 'auto';
|
|
53979
|
+
}
|
|
53980
|
+
const { width } = layoutMap?.getColumnWidthDefined(col) ?? {};
|
|
52844
53981
|
if (typeof width === 'number' && width <= 0) {
|
|
52845
53982
|
return 0;
|
|
52846
53983
|
}
|
|
@@ -52853,14 +53990,17 @@
|
|
|
52853
53990
|
: this.defaultHeaderColWidth;
|
|
52854
53991
|
}
|
|
52855
53992
|
else if (this.isRightFrozenColumn(col, this.columnHeaderLevelCount)) {
|
|
52856
|
-
|
|
52857
|
-
|
|
52858
|
-
|
|
53993
|
+
if (this.isPivotTable()) {
|
|
53994
|
+
return Array.isArray(this.defaultHeaderColWidth)
|
|
53995
|
+
? this.defaultHeaderColWidth[this.rowHeaderLevelCount - this.rightFrozenColCount] ?? this.defaultColWidth
|
|
53996
|
+
: this.defaultHeaderColWidth;
|
|
53997
|
+
}
|
|
53998
|
+
return this.defaultColWidth;
|
|
52859
53999
|
}
|
|
52860
54000
|
return this.defaultColWidth;
|
|
52861
54001
|
}
|
|
52862
54002
|
getColWidth(col) {
|
|
52863
|
-
const width = this.
|
|
54003
|
+
const width = this.colWidthsMap.get(col);
|
|
52864
54004
|
if ((this.widthMode === 'adaptive' && typeof width === 'number') ||
|
|
52865
54005
|
(this.transpose && typeof width === 'number')) {
|
|
52866
54006
|
return this._colWidthDefineToPxWidth(width);
|
|
@@ -53332,6 +54472,7 @@
|
|
|
53332
54472
|
internalProps._rowHeightsMap = new NumberMap();
|
|
53333
54473
|
internalProps._rowRangeHeightsMap = new Map();
|
|
53334
54474
|
internalProps._colRangeWidthsMap = new Map();
|
|
54475
|
+
internalProps._widthResizedColMap = new Set();
|
|
53335
54476
|
this.colWidthsMap = new NumberMap();
|
|
53336
54477
|
this.colContentWidthsMap = new NumberMap();
|
|
53337
54478
|
this.colWidthsLimit = {};
|
|
@@ -53376,6 +54517,8 @@
|
|
|
53376
54517
|
}
|
|
53377
54518
|
this.headerStyleCache = new Map();
|
|
53378
54519
|
this.bodyStyleCache = new Map();
|
|
54520
|
+
this.clearColWidthCache();
|
|
54521
|
+
this.clearRowHeightCache();
|
|
53379
54522
|
}
|
|
53380
54523
|
getFrozenRowsHeight() {
|
|
53381
54524
|
const height = this.getRowsHeight(0, this.frozenRowCount - 1);
|
|
@@ -53628,11 +54771,14 @@
|
|
|
53628
54771
|
get theme() {
|
|
53629
54772
|
return this.internalProps.theme;
|
|
53630
54773
|
}
|
|
53631
|
-
|
|
53632
|
-
|
|
53633
|
-
this.internalProps.theme = t ? t : themes.DEFAULT;
|
|
54774
|
+
updateTheme(theme) {
|
|
54775
|
+
this.internalProps.theme = themes.of(theme ?? themes.DEFAULT);
|
|
53634
54776
|
this.options.theme = theme;
|
|
53635
|
-
this.
|
|
54777
|
+
this.scenegraph.clearCells();
|
|
54778
|
+
this.headerStyleCache = new Map();
|
|
54779
|
+
this.bodyStyleCache = new Map();
|
|
54780
|
+
this.scenegraph.createSceneGraph();
|
|
54781
|
+
this.render();
|
|
53636
54782
|
}
|
|
53637
54783
|
getBodyField(col, row) {
|
|
53638
54784
|
return this.internalProps.layoutMap.getBody(col, row).field;
|
|
@@ -53737,7 +54883,7 @@
|
|
|
53737
54883
|
const time = typeof window !== 'undefined' ? window.performance.now() : 0;
|
|
53738
54884
|
this.scenegraph.clearCells();
|
|
53739
54885
|
if (sort !== undefined) {
|
|
53740
|
-
this.sortState = sort;
|
|
54886
|
+
this.internalProps.sortState = sort;
|
|
53741
54887
|
this.stateManeger.setSortState(this.sortState);
|
|
53742
54888
|
}
|
|
53743
54889
|
if (records) {
|
|
@@ -53917,6 +55063,14 @@
|
|
|
53917
55063
|
clearCellStyleCache() {
|
|
53918
55064
|
this.headerStyleCache.clear();
|
|
53919
55065
|
}
|
|
55066
|
+
clearRowHeightCache() {
|
|
55067
|
+
this.internalProps._rowHeightsMap.clear();
|
|
55068
|
+
this._clearRowRangeHeightsMap();
|
|
55069
|
+
}
|
|
55070
|
+
clearColWidthCache() {
|
|
55071
|
+
this.internalProps._colWidthsMap.clear();
|
|
55072
|
+
this._clearColRangeWidthsMap();
|
|
55073
|
+
}
|
|
53920
55074
|
_canResizeColumn(col, row) {
|
|
53921
55075
|
if (!(col >= 0 && row >= 0)) {
|
|
53922
55076
|
return false;
|
|
@@ -54780,23 +55934,34 @@
|
|
|
54780
55934
|
let width = 0;
|
|
54781
55935
|
let maxWidth;
|
|
54782
55936
|
let minWidth;
|
|
54783
|
-
|
|
54784
|
-
|
|
54785
|
-
|
|
54786
|
-
|
|
54787
|
-
|
|
54788
|
-
|
|
54789
|
-
|
|
54790
|
-
|
|
54791
|
-
|
|
54792
|
-
|
|
54793
|
-
|
|
54794
|
-
|
|
54795
|
-
|
|
55937
|
+
if (col >= this.rowHeaderLevelCount) {
|
|
55938
|
+
let isAuto;
|
|
55939
|
+
this.columnObjects.forEach((obj, index) => {
|
|
55940
|
+
if (typeof obj.width === 'number') {
|
|
55941
|
+
width = Math.max(obj.width, width);
|
|
55942
|
+
}
|
|
55943
|
+
else if (obj.width === 'auto') {
|
|
55944
|
+
isAuto = true;
|
|
55945
|
+
}
|
|
55946
|
+
if (typeof obj.minWidth === 'number') {
|
|
55947
|
+
minWidth = Math.max(obj.minWidth, minWidth);
|
|
55948
|
+
}
|
|
55949
|
+
if (typeof obj.maxWidth === 'number') {
|
|
55950
|
+
maxWidth = Math.max(obj.maxWidth, maxWidth);
|
|
55951
|
+
}
|
|
55952
|
+
});
|
|
55953
|
+
width = width > 0 ? width : isAuto ? 'auto' : undefined;
|
|
55954
|
+
return { width, minWidth, maxWidth };
|
|
55955
|
+
}
|
|
55956
|
+
if (this.isRowHeader(col, 0)) {
|
|
55957
|
+
const defaultWidth = Array.isArray(this._table.defaultHeaderColWidth)
|
|
55958
|
+
? this._table.defaultHeaderColWidth[col] ?? this._table.defaultColWidth
|
|
55959
|
+
: this._table.defaultHeaderColWidth;
|
|
55960
|
+
if (defaultWidth === 'auto') {
|
|
55961
|
+
return { width: 'auto' };
|
|
54796
55962
|
}
|
|
54797
|
-
|
|
54798
|
-
|
|
54799
|
-
return { width, minWidth, maxWidth };
|
|
55963
|
+
return { width: defaultWidth };
|
|
55964
|
+
}
|
|
54800
55965
|
}
|
|
54801
55966
|
return this._columns[col];
|
|
54802
55967
|
}
|
|
@@ -55297,9 +56462,6 @@
|
|
|
55297
56462
|
get sortState() {
|
|
55298
56463
|
return this.internalProps.sortState;
|
|
55299
56464
|
}
|
|
55300
|
-
set sortState(sortState) {
|
|
55301
|
-
this.internalProps.sortState = sortState;
|
|
55302
|
-
}
|
|
55303
56465
|
get columns() {
|
|
55304
56466
|
return this.internalProps.columns;
|
|
55305
56467
|
}
|
|
@@ -55638,7 +56800,7 @@
|
|
|
55638
56800
|
}
|
|
55639
56801
|
return undefined;
|
|
55640
56802
|
}
|
|
55641
|
-
updateSortState(sortState) {
|
|
56803
|
+
updateSortState(sortState, executeSort = true) {
|
|
55642
56804
|
if (!sortState) {
|
|
55643
56805
|
if (this.internalProps.sortState) {
|
|
55644
56806
|
if (Array.isArray(this.internalProps.sortState)) {
|
|
@@ -55664,7 +56826,7 @@
|
|
|
55664
56826
|
else {
|
|
55665
56827
|
({ order, field, fieldKey } = this.internalProps.sortState);
|
|
55666
56828
|
}
|
|
55667
|
-
if (field) {
|
|
56829
|
+
if (field && executeSort) {
|
|
55668
56830
|
const sortFunc = this._getSortFuncFromHeaderOption(this.internalProps.columns, field, fieldKey);
|
|
55669
56831
|
let hd;
|
|
55670
56832
|
if (fieldKey) {
|
|
@@ -56483,9 +57645,6 @@
|
|
|
56483
57645
|
? 1
|
|
56484
57646
|
: 0;
|
|
56485
57647
|
}
|
|
56486
|
-
return this.getDimension(this.colDimensionKeys[this.colDimensionKeys.length - 1], 'column')?.multiDimension
|
|
56487
|
-
? 1
|
|
56488
|
-
: 0;
|
|
56489
57648
|
}
|
|
56490
57649
|
return 0;
|
|
56491
57650
|
}
|
|
@@ -56498,7 +57657,6 @@
|
|
|
56498
57657
|
? 1
|
|
56499
57658
|
: 0;
|
|
56500
57659
|
}
|
|
56501
|
-
return this.getDimension(this.rowDimensionKeys[this.rowDimensionKeys.length - 1], 'row')?.multiDimension ? 1 : 0;
|
|
56502
57660
|
}
|
|
56503
57661
|
return 0;
|
|
56504
57662
|
}
|
|
@@ -57202,6 +58360,54 @@
|
|
|
57202
58360
|
indicatorObject.chartInstance?.release();
|
|
57203
58361
|
});
|
|
57204
58362
|
}
|
|
58363
|
+
getHeadNode(dimensions) {
|
|
58364
|
+
if (!Array.isArray(dimensions)) {
|
|
58365
|
+
return undefined;
|
|
58366
|
+
}
|
|
58367
|
+
let rowArr = this.rowTree;
|
|
58368
|
+
let rowDimension;
|
|
58369
|
+
let colArr = this.columnTree;
|
|
58370
|
+
let colDimension;
|
|
58371
|
+
for (let i = 0; i < dimensions.length; i++) {
|
|
58372
|
+
const highlightDimension = dimensions[i];
|
|
58373
|
+
if ((highlightDimension.isPivotCorner || !highlightDimension.value) &&
|
|
58374
|
+
i === dimensions.length - 1) {
|
|
58375
|
+
return undefined;
|
|
58376
|
+
}
|
|
58377
|
+
let isCol = false;
|
|
58378
|
+
for (let j = 0; j < colArr.length; j++) {
|
|
58379
|
+
const dimension = colArr[j];
|
|
58380
|
+
if (((isValid$1(highlightDimension.dimensionKey) && dimension.dimensionKey === highlightDimension.dimensionKey) ||
|
|
58381
|
+
(isValid$1(highlightDimension.indicatorKey) && dimension.indicatorKey === highlightDimension.indicatorKey)) &&
|
|
58382
|
+
dimension.value === highlightDimension.value) {
|
|
58383
|
+
colArr = dimension.children;
|
|
58384
|
+
colDimension = dimension;
|
|
58385
|
+
isCol = true;
|
|
58386
|
+
break;
|
|
58387
|
+
}
|
|
58388
|
+
}
|
|
58389
|
+
if (isCol) {
|
|
58390
|
+
continue;
|
|
58391
|
+
}
|
|
58392
|
+
for (let k = 0; k < rowArr.length; k++) {
|
|
58393
|
+
const dimension = rowArr[k];
|
|
58394
|
+
if (((isValid$1(highlightDimension.dimensionKey) && dimension.dimensionKey === highlightDimension.dimensionKey) ||
|
|
58395
|
+
(isValid$1(highlightDimension.indicatorKey) && dimension.indicatorKey === highlightDimension.indicatorKey)) &&
|
|
58396
|
+
dimension.value === highlightDimension.value) {
|
|
58397
|
+
rowArr = dimension.children;
|
|
58398
|
+
rowDimension = dimension;
|
|
58399
|
+
break;
|
|
58400
|
+
}
|
|
58401
|
+
}
|
|
58402
|
+
}
|
|
58403
|
+
if (rowDimension) {
|
|
58404
|
+
return rowDimension;
|
|
58405
|
+
}
|
|
58406
|
+
else if (colDimension) {
|
|
58407
|
+
return colDimension;
|
|
58408
|
+
}
|
|
58409
|
+
return undefined;
|
|
58410
|
+
}
|
|
57205
58411
|
}
|
|
57206
58412
|
|
|
57207
58413
|
const EMPTY_HEADER = {
|
|
@@ -59846,6 +61052,7 @@
|
|
|
59846
61052
|
if (options.layout) {
|
|
59847
61053
|
Object.assign(options, options.layout);
|
|
59848
61054
|
}
|
|
61055
|
+
this.internalProps.columnResizeType = options.columnResizeType ?? 'column';
|
|
59849
61056
|
this.internalProps.dataConfig = options.dataConfig;
|
|
59850
61057
|
this.internalProps.enableDataAnalysis = options.enableDataAnalysis;
|
|
59851
61058
|
if (this.internalProps.enableDataAnalysis && (options.rows || options.columns)) {
|
|
@@ -59920,6 +61127,7 @@
|
|
|
59920
61127
|
updateOption(options, accelerateFirstScreen = false) {
|
|
59921
61128
|
const internalProps = this.internalProps;
|
|
59922
61129
|
super.updateOption(options);
|
|
61130
|
+
internalProps.columnResizeType = options.columnResizeType ?? 'column';
|
|
59923
61131
|
internalProps.dataConfig = options.dataConfig;
|
|
59924
61132
|
internalProps.enableDataAnalysis = options.enableDataAnalysis;
|
|
59925
61133
|
if (options?.rowHierarchyType === 'tree' &&
|
|
@@ -60297,6 +61505,7 @@
|
|
|
60297
61505
|
Object.assign(options, options.layout);
|
|
60298
61506
|
}
|
|
60299
61507
|
this.setCustomStateNameToSpec();
|
|
61508
|
+
this.internalProps.columnResizeType = options.columnResizeType ?? 'column';
|
|
60300
61509
|
this.internalProps.dataConfig = { isPivotChart: true };
|
|
60301
61510
|
this._axes = isArray$3(options.axes) ? options.axes : [];
|
|
60302
61511
|
if (options.rows || options.columns) {
|
|
@@ -60374,6 +61583,7 @@
|
|
|
60374
61583
|
const internalProps = this.internalProps;
|
|
60375
61584
|
super.updateOption(options);
|
|
60376
61585
|
this.setCustomStateNameToSpec();
|
|
61586
|
+
internalProps.columnResizeType = options.columnResizeType ?? 'column';
|
|
60377
61587
|
internalProps.dataConfig = {};
|
|
60378
61588
|
this._axes = isArray$3(options.axes) ? options.axes : [];
|
|
60379
61589
|
if (options.rows || options.columns) {
|
|
@@ -61565,7 +62775,7 @@
|
|
|
61565
62775
|
percentCalc: percentCalc
|
|
61566
62776
|
});
|
|
61567
62777
|
|
|
61568
|
-
const version = "0.10.
|
|
62778
|
+
const version = "0.10.1-alpha.1";
|
|
61569
62779
|
function getIcons() {
|
|
61570
62780
|
return get$1();
|
|
61571
62781
|
}
|