@visactor/vrender-core 0.16.0-alpha.1 → 0.16.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +425 -2315
- package/dist/index.min.js +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VRenderCore = {}));
|
|
5
|
-
})(this, (function (exports) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@visactor/vutils')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@visactor/vutils'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VRenderCore = {}, global.VUtils));
|
|
5
|
+
})(this, (function (exports, vutils) { 'use strict';
|
|
6
6
|
|
|
7
7
|
let idCounter = 0;
|
|
8
8
|
function id() {
|
|
@@ -774,110 +774,6 @@
|
|
|
774
774
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
775
775
|
}, _typeof(o);
|
|
776
776
|
}
|
|
777
|
-
function _classCallCheck(instance, Constructor) {
|
|
778
|
-
if (!(instance instanceof Constructor)) {
|
|
779
|
-
throw new TypeError("Cannot call a class as a function");
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
function _defineProperties(target, props) {
|
|
783
|
-
for (var i = 0; i < props.length; i++) {
|
|
784
|
-
var descriptor = props[i];
|
|
785
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
786
|
-
descriptor.configurable = true;
|
|
787
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
788
|
-
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
792
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
793
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
794
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
795
|
-
writable: false
|
|
796
|
-
});
|
|
797
|
-
return Constructor;
|
|
798
|
-
}
|
|
799
|
-
function _inherits(subClass, superClass) {
|
|
800
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
801
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
802
|
-
}
|
|
803
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
804
|
-
constructor: {
|
|
805
|
-
value: subClass,
|
|
806
|
-
writable: true,
|
|
807
|
-
configurable: true
|
|
808
|
-
}
|
|
809
|
-
});
|
|
810
|
-
Object.defineProperty(subClass, "prototype", {
|
|
811
|
-
writable: false
|
|
812
|
-
});
|
|
813
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
814
|
-
}
|
|
815
|
-
function _getPrototypeOf(o) {
|
|
816
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
817
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
818
|
-
};
|
|
819
|
-
return _getPrototypeOf(o);
|
|
820
|
-
}
|
|
821
|
-
function _setPrototypeOf(o, p) {
|
|
822
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
823
|
-
o.__proto__ = p;
|
|
824
|
-
return o;
|
|
825
|
-
};
|
|
826
|
-
return _setPrototypeOf(o, p);
|
|
827
|
-
}
|
|
828
|
-
function _isNativeReflectConstruct() {
|
|
829
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
830
|
-
if (Reflect.construct.sham) return false;
|
|
831
|
-
if (typeof Proxy === "function") return true;
|
|
832
|
-
try {
|
|
833
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
834
|
-
return true;
|
|
835
|
-
} catch (e) {
|
|
836
|
-
return false;
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
function _assertThisInitialized(self) {
|
|
840
|
-
if (self === void 0) {
|
|
841
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
842
|
-
}
|
|
843
|
-
return self;
|
|
844
|
-
}
|
|
845
|
-
function _possibleConstructorReturn(self, call) {
|
|
846
|
-
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
847
|
-
return call;
|
|
848
|
-
} else if (call !== void 0) {
|
|
849
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
850
|
-
}
|
|
851
|
-
return _assertThisInitialized(self);
|
|
852
|
-
}
|
|
853
|
-
function _createSuper(Derived) {
|
|
854
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
855
|
-
return function _createSuperInternal() {
|
|
856
|
-
var Super = _getPrototypeOf(Derived),
|
|
857
|
-
result;
|
|
858
|
-
if (hasNativeReflectConstruct) {
|
|
859
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
860
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
861
|
-
} else {
|
|
862
|
-
result = Super.apply(this, arguments);
|
|
863
|
-
}
|
|
864
|
-
return _possibleConstructorReturn(this, result);
|
|
865
|
-
};
|
|
866
|
-
}
|
|
867
|
-
function _toPrimitive(input, hint) {
|
|
868
|
-
if (typeof input !== "object" || input === null) return input;
|
|
869
|
-
var prim = input[Symbol.toPrimitive];
|
|
870
|
-
if (prim !== undefined) {
|
|
871
|
-
var res = prim.call(input, hint || "default");
|
|
872
|
-
if (typeof res !== "object") return res;
|
|
873
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
874
|
-
}
|
|
875
|
-
return (hint === "string" ? String : Number)(input);
|
|
876
|
-
}
|
|
877
|
-
function _toPropertyKey(arg) {
|
|
878
|
-
var key = _toPrimitive(arg, "string");
|
|
879
|
-
return typeof key === "symbol" ? key : String(key);
|
|
880
|
-
}
|
|
881
777
|
|
|
882
778
|
function __decorate(decorators, target, key, desc) {
|
|
883
779
|
var c = arguments.length,
|
|
@@ -2664,1793 +2560,7 @@
|
|
|
2664
2560
|
__metadata("design:paramtypes", [Object])
|
|
2665
2561
|
], exports.DefaultGlobal);
|
|
2666
2562
|
|
|
2667
|
-
|
|
2668
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2669
|
-
}
|
|
2670
|
-
|
|
2671
|
-
var eventemitter3 = {exports: {}};
|
|
2672
|
-
|
|
2673
|
-
(function (module) {
|
|
2674
|
-
|
|
2675
|
-
var has = Object.prototype.hasOwnProperty,
|
|
2676
|
-
prefix = '~';
|
|
2677
|
-
|
|
2678
|
-
/**
|
|
2679
|
-
* Constructor to create a storage for our `EE` objects.
|
|
2680
|
-
* An `Events` instance is a plain object whose properties are event names.
|
|
2681
|
-
*
|
|
2682
|
-
* @constructor
|
|
2683
|
-
* @private
|
|
2684
|
-
*/
|
|
2685
|
-
function Events() {}
|
|
2686
|
-
|
|
2687
|
-
//
|
|
2688
|
-
// We try to not inherit from `Object.prototype`. In some engines creating an
|
|
2689
|
-
// instance in this way is faster than calling `Object.create(null)` directly.
|
|
2690
|
-
// If `Object.create(null)` is not supported we prefix the event names with a
|
|
2691
|
-
// character to make sure that the built-in object properties are not
|
|
2692
|
-
// overridden or used as an attack vector.
|
|
2693
|
-
//
|
|
2694
|
-
if (Object.create) {
|
|
2695
|
-
Events.prototype = Object.create(null);
|
|
2696
|
-
|
|
2697
|
-
//
|
|
2698
|
-
// This hack is needed because the `__proto__` property is still inherited in
|
|
2699
|
-
// some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
|
|
2700
|
-
//
|
|
2701
|
-
if (!new Events().__proto__) prefix = false;
|
|
2702
|
-
}
|
|
2703
|
-
|
|
2704
|
-
/**
|
|
2705
|
-
* Representation of a single event listener.
|
|
2706
|
-
*
|
|
2707
|
-
* @param {Function} fn The listener function.
|
|
2708
|
-
* @param {*} context The context to invoke the listener with.
|
|
2709
|
-
* @param {Boolean} [once=false] Specify if the listener is a one-time listener.
|
|
2710
|
-
* @constructor
|
|
2711
|
-
* @private
|
|
2712
|
-
*/
|
|
2713
|
-
function EE(fn, context, once) {
|
|
2714
|
-
this.fn = fn;
|
|
2715
|
-
this.context = context;
|
|
2716
|
-
this.once = once || false;
|
|
2717
|
-
}
|
|
2718
|
-
|
|
2719
|
-
/**
|
|
2720
|
-
* Add a listener for a given event.
|
|
2721
|
-
*
|
|
2722
|
-
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
2723
|
-
* @param {(String|Symbol)} event The event name.
|
|
2724
|
-
* @param {Function} fn The listener function.
|
|
2725
|
-
* @param {*} context The context to invoke the listener with.
|
|
2726
|
-
* @param {Boolean} once Specify if the listener is a one-time listener.
|
|
2727
|
-
* @returns {EventEmitter}
|
|
2728
|
-
* @private
|
|
2729
|
-
*/
|
|
2730
|
-
function addListener(emitter, event, fn, context, once) {
|
|
2731
|
-
if (typeof fn !== 'function') {
|
|
2732
|
-
throw new TypeError('The listener must be a function');
|
|
2733
|
-
}
|
|
2734
|
-
var listener = new EE(fn, context || emitter, once),
|
|
2735
|
-
evt = prefix ? prefix + event : event;
|
|
2736
|
-
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);else emitter._events[evt] = [emitter._events[evt], listener];
|
|
2737
|
-
return emitter;
|
|
2738
|
-
}
|
|
2739
|
-
|
|
2740
|
-
/**
|
|
2741
|
-
* Clear event by name.
|
|
2742
|
-
*
|
|
2743
|
-
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
2744
|
-
* @param {(String|Symbol)} evt The Event name.
|
|
2745
|
-
* @private
|
|
2746
|
-
*/
|
|
2747
|
-
function clearEvent(emitter, evt) {
|
|
2748
|
-
if (--emitter._eventsCount === 0) emitter._events = new Events();else delete emitter._events[evt];
|
|
2749
|
-
}
|
|
2750
|
-
|
|
2751
|
-
/**
|
|
2752
|
-
* Minimal `EventEmitter` interface that is molded against the Node.js
|
|
2753
|
-
* `EventEmitter` interface.
|
|
2754
|
-
*
|
|
2755
|
-
* @constructor
|
|
2756
|
-
* @public
|
|
2757
|
-
*/
|
|
2758
|
-
function EventEmitter() {
|
|
2759
|
-
this._events = new Events();
|
|
2760
|
-
this._eventsCount = 0;
|
|
2761
|
-
}
|
|
2762
|
-
|
|
2763
|
-
/**
|
|
2764
|
-
* Return an array listing the events for which the emitter has registered
|
|
2765
|
-
* listeners.
|
|
2766
|
-
*
|
|
2767
|
-
* @returns {Array}
|
|
2768
|
-
* @public
|
|
2769
|
-
*/
|
|
2770
|
-
EventEmitter.prototype.eventNames = function eventNames() {
|
|
2771
|
-
var names = [],
|
|
2772
|
-
events,
|
|
2773
|
-
name;
|
|
2774
|
-
if (this._eventsCount === 0) return names;
|
|
2775
|
-
for (name in events = this._events) {
|
|
2776
|
-
if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
|
2777
|
-
}
|
|
2778
|
-
if (Object.getOwnPropertySymbols) {
|
|
2779
|
-
return names.concat(Object.getOwnPropertySymbols(events));
|
|
2780
|
-
}
|
|
2781
|
-
return names;
|
|
2782
|
-
};
|
|
2783
|
-
|
|
2784
|
-
/**
|
|
2785
|
-
* Return the listeners registered for a given event.
|
|
2786
|
-
*
|
|
2787
|
-
* @param {(String|Symbol)} event The event name.
|
|
2788
|
-
* @returns {Array} The registered listeners.
|
|
2789
|
-
* @public
|
|
2790
|
-
*/
|
|
2791
|
-
EventEmitter.prototype.listeners = function listeners(event) {
|
|
2792
|
-
var evt = prefix ? prefix + event : event,
|
|
2793
|
-
handlers = this._events[evt];
|
|
2794
|
-
if (!handlers) return [];
|
|
2795
|
-
if (handlers.fn) return [handlers.fn];
|
|
2796
|
-
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
|
|
2797
|
-
ee[i] = handlers[i].fn;
|
|
2798
|
-
}
|
|
2799
|
-
return ee;
|
|
2800
|
-
};
|
|
2801
|
-
|
|
2802
|
-
/**
|
|
2803
|
-
* Return the number of listeners listening to a given event.
|
|
2804
|
-
*
|
|
2805
|
-
* @param {(String|Symbol)} event The event name.
|
|
2806
|
-
* @returns {Number} The number of listeners.
|
|
2807
|
-
* @public
|
|
2808
|
-
*/
|
|
2809
|
-
EventEmitter.prototype.listenerCount = function listenerCount(event) {
|
|
2810
|
-
var evt = prefix ? prefix + event : event,
|
|
2811
|
-
listeners = this._events[evt];
|
|
2812
|
-
if (!listeners) return 0;
|
|
2813
|
-
if (listeners.fn) return 1;
|
|
2814
|
-
return listeners.length;
|
|
2815
|
-
};
|
|
2816
|
-
|
|
2817
|
-
/**
|
|
2818
|
-
* Calls each of the listeners registered for a given event.
|
|
2819
|
-
*
|
|
2820
|
-
* @param {(String|Symbol)} event The event name.
|
|
2821
|
-
* @returns {Boolean} `true` if the event had listeners, else `false`.
|
|
2822
|
-
* @public
|
|
2823
|
-
*/
|
|
2824
|
-
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
2825
|
-
var evt = prefix ? prefix + event : event;
|
|
2826
|
-
if (!this._events[evt]) return false;
|
|
2827
|
-
var listeners = this._events[evt],
|
|
2828
|
-
len = arguments.length,
|
|
2829
|
-
args,
|
|
2830
|
-
i;
|
|
2831
|
-
if (listeners.fn) {
|
|
2832
|
-
if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
|
|
2833
|
-
switch (len) {
|
|
2834
|
-
case 1:
|
|
2835
|
-
return listeners.fn.call(listeners.context), true;
|
|
2836
|
-
case 2:
|
|
2837
|
-
return listeners.fn.call(listeners.context, a1), true;
|
|
2838
|
-
case 3:
|
|
2839
|
-
return listeners.fn.call(listeners.context, a1, a2), true;
|
|
2840
|
-
case 4:
|
|
2841
|
-
return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
2842
|
-
case 5:
|
|
2843
|
-
return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
2844
|
-
case 6:
|
|
2845
|
-
return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
2846
|
-
}
|
|
2847
|
-
for (i = 1, args = new Array(len - 1); i < len; i++) {
|
|
2848
|
-
args[i - 1] = arguments[i];
|
|
2849
|
-
}
|
|
2850
|
-
listeners.fn.apply(listeners.context, args);
|
|
2851
|
-
} else {
|
|
2852
|
-
var length = listeners.length,
|
|
2853
|
-
j;
|
|
2854
|
-
for (i = 0; i < length; i++) {
|
|
2855
|
-
if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
|
|
2856
|
-
switch (len) {
|
|
2857
|
-
case 1:
|
|
2858
|
-
listeners[i].fn.call(listeners[i].context);
|
|
2859
|
-
break;
|
|
2860
|
-
case 2:
|
|
2861
|
-
listeners[i].fn.call(listeners[i].context, a1);
|
|
2862
|
-
break;
|
|
2863
|
-
case 3:
|
|
2864
|
-
listeners[i].fn.call(listeners[i].context, a1, a2);
|
|
2865
|
-
break;
|
|
2866
|
-
case 4:
|
|
2867
|
-
listeners[i].fn.call(listeners[i].context, a1, a2, a3);
|
|
2868
|
-
break;
|
|
2869
|
-
default:
|
|
2870
|
-
if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
|
|
2871
|
-
args[j - 1] = arguments[j];
|
|
2872
|
-
}
|
|
2873
|
-
listeners[i].fn.apply(listeners[i].context, args);
|
|
2874
|
-
}
|
|
2875
|
-
}
|
|
2876
|
-
}
|
|
2877
|
-
return true;
|
|
2878
|
-
};
|
|
2879
|
-
|
|
2880
|
-
/**
|
|
2881
|
-
* Add a listener for a given event.
|
|
2882
|
-
*
|
|
2883
|
-
* @param {(String|Symbol)} event The event name.
|
|
2884
|
-
* @param {Function} fn The listener function.
|
|
2885
|
-
* @param {*} [context=this] The context to invoke the listener with.
|
|
2886
|
-
* @returns {EventEmitter} `this`.
|
|
2887
|
-
* @public
|
|
2888
|
-
*/
|
|
2889
|
-
EventEmitter.prototype.on = function on(event, fn, context) {
|
|
2890
|
-
return addListener(this, event, fn, context, false);
|
|
2891
|
-
};
|
|
2892
|
-
|
|
2893
|
-
/**
|
|
2894
|
-
* Add a one-time listener for a given event.
|
|
2895
|
-
*
|
|
2896
|
-
* @param {(String|Symbol)} event The event name.
|
|
2897
|
-
* @param {Function} fn The listener function.
|
|
2898
|
-
* @param {*} [context=this] The context to invoke the listener with.
|
|
2899
|
-
* @returns {EventEmitter} `this`.
|
|
2900
|
-
* @public
|
|
2901
|
-
*/
|
|
2902
|
-
EventEmitter.prototype.once = function once(event, fn, context) {
|
|
2903
|
-
return addListener(this, event, fn, context, true);
|
|
2904
|
-
};
|
|
2905
|
-
|
|
2906
|
-
/**
|
|
2907
|
-
* Remove the listeners of a given event.
|
|
2908
|
-
*
|
|
2909
|
-
* @param {(String|Symbol)} event The event name.
|
|
2910
|
-
* @param {Function} fn Only remove the listeners that match this function.
|
|
2911
|
-
* @param {*} context Only remove the listeners that have this context.
|
|
2912
|
-
* @param {Boolean} once Only remove one-time listeners.
|
|
2913
|
-
* @returns {EventEmitter} `this`.
|
|
2914
|
-
* @public
|
|
2915
|
-
*/
|
|
2916
|
-
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
2917
|
-
var evt = prefix ? prefix + event : event;
|
|
2918
|
-
if (!this._events[evt]) return this;
|
|
2919
|
-
if (!fn) {
|
|
2920
|
-
clearEvent(this, evt);
|
|
2921
|
-
return this;
|
|
2922
|
-
}
|
|
2923
|
-
var listeners = this._events[evt];
|
|
2924
|
-
if (listeners.fn) {
|
|
2925
|
-
if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
|
|
2926
|
-
clearEvent(this, evt);
|
|
2927
|
-
}
|
|
2928
|
-
} else {
|
|
2929
|
-
for (var i = 0, events = [], length = listeners.length; i < length; i++) {
|
|
2930
|
-
if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
|
|
2931
|
-
events.push(listeners[i]);
|
|
2932
|
-
}
|
|
2933
|
-
}
|
|
2934
|
-
|
|
2935
|
-
//
|
|
2936
|
-
// Reset the array, or remove it completely if we have no more listeners.
|
|
2937
|
-
//
|
|
2938
|
-
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;else clearEvent(this, evt);
|
|
2939
|
-
}
|
|
2940
|
-
return this;
|
|
2941
|
-
};
|
|
2942
|
-
|
|
2943
|
-
/**
|
|
2944
|
-
* Remove all listeners, or those of the specified event.
|
|
2945
|
-
*
|
|
2946
|
-
* @param {(String|Symbol)} [event] The event name.
|
|
2947
|
-
* @returns {EventEmitter} `this`.
|
|
2948
|
-
* @public
|
|
2949
|
-
*/
|
|
2950
|
-
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
2951
|
-
var evt;
|
|
2952
|
-
if (event) {
|
|
2953
|
-
evt = prefix ? prefix + event : event;
|
|
2954
|
-
if (this._events[evt]) clearEvent(this, evt);
|
|
2955
|
-
} else {
|
|
2956
|
-
this._events = new Events();
|
|
2957
|
-
this._eventsCount = 0;
|
|
2958
|
-
}
|
|
2959
|
-
return this;
|
|
2960
|
-
};
|
|
2961
|
-
|
|
2962
|
-
//
|
|
2963
|
-
// Alias methods names because people roll like that.
|
|
2964
|
-
//
|
|
2965
|
-
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
2966
|
-
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
2967
|
-
|
|
2968
|
-
//
|
|
2969
|
-
// Expose the prefix.
|
|
2970
|
-
//
|
|
2971
|
-
EventEmitter.prefixed = prefix;
|
|
2972
|
-
|
|
2973
|
-
//
|
|
2974
|
-
// Allow `EventEmitter` to be imported as module namespace.
|
|
2975
|
-
//
|
|
2976
|
-
EventEmitter.EventEmitter = EventEmitter;
|
|
2977
|
-
|
|
2978
|
-
//
|
|
2979
|
-
// Expose the module.
|
|
2980
|
-
//
|
|
2981
|
-
{
|
|
2982
|
-
module.exports = EventEmitter;
|
|
2983
|
-
}
|
|
2984
|
-
})(eventemitter3);
|
|
2985
|
-
var eventemitter3Exports = eventemitter3.exports;
|
|
2986
|
-
var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
|
|
2987
|
-
|
|
2988
|
-
var isType = function isType(value, type) {
|
|
2989
|
-
return Object.prototype.toString.call(value) === "[object ".concat(type, "]");
|
|
2990
|
-
};
|
|
2991
|
-
var isType$1 = isType;
|
|
2992
|
-
|
|
2993
|
-
var isBoolean = function isBoolean(value) {
|
|
2994
|
-
var fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
2995
|
-
return fuzzy ? "boolean" == typeof value : !0 === value || !1 === value || isType$1(value, "Boolean");
|
|
2996
|
-
};
|
|
2997
|
-
var isBoolean$1 = isBoolean;
|
|
2998
|
-
|
|
2999
|
-
var isFunction = function isFunction(value) {
|
|
3000
|
-
return "function" == typeof value;
|
|
3001
|
-
};
|
|
3002
|
-
var isFunction$1 = isFunction;
|
|
3003
|
-
|
|
3004
|
-
var isNil = function isNil(value) {
|
|
3005
|
-
return null == value;
|
|
3006
|
-
};
|
|
3007
|
-
var isNil$1 = isNil;
|
|
3008
|
-
|
|
3009
|
-
var isValid = function isValid(value) {
|
|
3010
|
-
return null != value;
|
|
3011
|
-
};
|
|
3012
|
-
var isValid$1 = isValid;
|
|
3013
|
-
|
|
3014
|
-
var isObject = function isObject(value) {
|
|
3015
|
-
var type = _typeof(value);
|
|
3016
|
-
return null !== value && "object" === type || "function" === type;
|
|
3017
|
-
};
|
|
3018
|
-
var isObject$1 = isObject;
|
|
3019
|
-
|
|
3020
|
-
var isUndefined = function isUndefined(value) {
|
|
3021
|
-
return void 0 === value;
|
|
3022
|
-
};
|
|
3023
|
-
var isUndefined$1 = isUndefined;
|
|
3024
|
-
|
|
3025
|
-
var isString = function isString(value) {
|
|
3026
|
-
var fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
3027
|
-
var type = _typeof(value);
|
|
3028
|
-
return fuzzy ? "string" === type : "string" === type || isType$1(value, "String");
|
|
3029
|
-
};
|
|
3030
|
-
var isString$1 = isString;
|
|
3031
|
-
|
|
3032
|
-
var isArray = function isArray(value) {
|
|
3033
|
-
return Array.isArray ? Array.isArray(value) : isType$1(value, "Array");
|
|
3034
|
-
};
|
|
3035
|
-
var isArray$1 = isArray;
|
|
3036
|
-
|
|
3037
|
-
var isDate = function isDate(value) {
|
|
3038
|
-
return isType$1(value, "Date");
|
|
3039
|
-
};
|
|
3040
|
-
var isDate$1 = isDate;
|
|
3041
|
-
|
|
3042
|
-
var isNumber$1 = function isNumber(value) {
|
|
3043
|
-
var fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
3044
|
-
var type = _typeof(value);
|
|
3045
|
-
return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
|
|
3046
|
-
};
|
|
3047
|
-
var isNumber$2 = isNumber$1;
|
|
3048
|
-
|
|
3049
|
-
var isValidUrl = function isValidUrl(value) {
|
|
3050
|
-
return new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(value);
|
|
3051
|
-
};
|
|
3052
|
-
var isValidUrl$1 = isValidUrl;
|
|
3053
|
-
|
|
3054
|
-
var isRegExp = function isRegExp(value) {
|
|
3055
|
-
return isType$1(value, "RegExp");
|
|
3056
|
-
};
|
|
3057
|
-
var isRegExp$1 = isRegExp;
|
|
3058
|
-
|
|
3059
|
-
var isBase64 = function isBase64(value) {
|
|
3060
|
-
return new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(value);
|
|
3061
|
-
};
|
|
3062
|
-
var isBase64$1 = isBase64;
|
|
3063
|
-
|
|
3064
|
-
var get = function get(obj, path, defaultValue) {
|
|
3065
|
-
var paths = isString$1(path) ? path.split(".") : path;
|
|
3066
|
-
for (var p = 0; p < paths.length; p++) obj = obj ? obj[paths[p]] : void 0;
|
|
3067
|
-
return void 0 === obj ? defaultValue : obj;
|
|
3068
|
-
};
|
|
3069
|
-
var get$1 = get;
|
|
3070
|
-
|
|
3071
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty,
|
|
3072
|
-
has = function has(object, key) {
|
|
3073
|
-
return null != object && hasOwnProperty.call(object, key);
|
|
3074
|
-
};
|
|
3075
|
-
var has$1 = has;
|
|
3076
|
-
|
|
3077
|
-
function getRegExpFlags(re) {
|
|
3078
|
-
var flags = "";
|
|
3079
|
-
return re.global && (flags += "g"), re.ignoreCase && (flags += "i"), re.multiline && (flags += "m"), flags;
|
|
3080
|
-
}
|
|
3081
|
-
function clone(parent) {
|
|
3082
|
-
var circular = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
3083
|
-
var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
3084
|
-
var prototype = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : void 0;
|
|
3085
|
-
var allParents = [],
|
|
3086
|
-
allChildren = [];
|
|
3087
|
-
return void 0 === circular && (circular = !0), void 0 === depth && (depth = 1 / 0), function _clone(parent, depth) {
|
|
3088
|
-
if (null === parent) return null;
|
|
3089
|
-
if (0 === depth) return parent;
|
|
3090
|
-
var child;
|
|
3091
|
-
if ("object" != _typeof(parent)) return parent;
|
|
3092
|
-
if (isArray$1(parent) ? child = [] : isRegExp$1(parent) ? (child = new RegExp(parent.source, getRegExpFlags(parent)), parent.lastIndex && (child.lastIndex = parent.lastIndex)) : child = isDate$1(parent) ? new Date(parent.getTime()) : void 0 === prototype ? Object.create(Object.getPrototypeOf(parent)) : Object.create(prototype), circular) {
|
|
3093
|
-
var index = allParents.indexOf(parent);
|
|
3094
|
-
if (-1 !== index) return allChildren[index];
|
|
3095
|
-
allParents.push(parent), allChildren.push(child);
|
|
3096
|
-
}
|
|
3097
|
-
for (var i in parent) child[i] = _clone(parent[i], depth - 1);
|
|
3098
|
-
return child;
|
|
3099
|
-
}(parent, depth);
|
|
3100
|
-
}
|
|
3101
|
-
|
|
3102
|
-
function arrayEqual(a, b) {
|
|
3103
|
-
if (!isArray$1(a) || !isArray$1(b)) return !1;
|
|
3104
|
-
if (a.length !== b.length) return !1;
|
|
3105
|
-
for (var i = 0; i < a.length; i++) if (a[i] !== b[i]) return !1;
|
|
3106
|
-
return !0;
|
|
3107
|
-
}
|
|
3108
|
-
|
|
3109
|
-
var DEFAULT_ABSOLUTE_TOLERATE = 1e-10,
|
|
3110
|
-
DEFAULT_RELATIVE_TOLERATE = 1e-10;
|
|
3111
|
-
function isNumberClose(a, b) {
|
|
3112
|
-
var relTol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_RELATIVE_TOLERATE;
|
|
3113
|
-
var absTol = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_ABSOLUTE_TOLERATE;
|
|
3114
|
-
var abs = absTol,
|
|
3115
|
-
rel = relTol * Math.max(a, b);
|
|
3116
|
-
return Math.abs(a - b) <= Math.max(abs, rel);
|
|
3117
|
-
}
|
|
3118
|
-
|
|
3119
|
-
var clamp = function clamp(input, min, max) {
|
|
3120
|
-
return input < min ? min : input > max ? max : input;
|
|
3121
|
-
};
|
|
3122
|
-
var clamp$1 = clamp;
|
|
3123
|
-
|
|
3124
|
-
var epsilon = 1e-12;
|
|
3125
|
-
var pi = Math.PI;
|
|
3126
|
-
var halfPi$1 = pi / 2;
|
|
3127
|
-
var tau = 2 * pi;
|
|
3128
|
-
var pi2 = 2 * Math.PI;
|
|
3129
|
-
var abs = Math.abs;
|
|
3130
|
-
var atan2 = Math.atan2;
|
|
3131
|
-
var cos = Math.cos;
|
|
3132
|
-
var max = Math.max;
|
|
3133
|
-
var min = Math.min;
|
|
3134
|
-
var sin = Math.sin;
|
|
3135
|
-
var sqrt = Math.sqrt;
|
|
3136
|
-
var pow = Math.pow;
|
|
3137
|
-
function acos(x) {
|
|
3138
|
-
return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
|
|
3139
|
-
}
|
|
3140
|
-
function asin(x) {
|
|
3141
|
-
return x >= 1 ? halfPi$1 : x <= -1 ? -halfPi$1 : Math.asin(x);
|
|
3142
|
-
}
|
|
3143
|
-
function pointAt(x1, y1, x2, y2, t) {
|
|
3144
|
-
var x, y;
|
|
3145
|
-
return "number" == typeof x1 && "number" == typeof x2 && (x = (1 - t) * x1 + t * x2), "number" == typeof y1 && "number" == typeof y2 && (y = (1 - t) * y1 + t * y2), {
|
|
3146
|
-
x: x,
|
|
3147
|
-
y: y
|
|
3148
|
-
};
|
|
3149
|
-
}
|
|
3150
|
-
function crossProduct$1(dir1, dir2) {
|
|
3151
|
-
return dir1[0] * dir2[1] - dir1[1] * dir2[0];
|
|
3152
|
-
}
|
|
3153
|
-
function fuzzyEqualVec(a, b) {
|
|
3154
|
-
return abs(a[0] - b[0]) + abs(a[1] - b[1]) < 1e-12;
|
|
3155
|
-
}
|
|
3156
|
-
|
|
3157
|
-
var Point = /*#__PURE__*/function () {
|
|
3158
|
-
function Point() {
|
|
3159
|
-
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
3160
|
-
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3161
|
-
var x1 = arguments.length > 2 ? arguments[2] : undefined;
|
|
3162
|
-
var y1 = arguments.length > 3 ? arguments[3] : undefined;
|
|
3163
|
-
_classCallCheck(this, Point);
|
|
3164
|
-
this.x = 0, this.y = 0, this.x = x, this.y = y, this.x1 = x1, this.y1 = y1;
|
|
3165
|
-
}
|
|
3166
|
-
_createClass(Point, [{
|
|
3167
|
-
key: "clone",
|
|
3168
|
-
value: function clone() {
|
|
3169
|
-
return new Point(this.x, this.y);
|
|
3170
|
-
}
|
|
3171
|
-
}, {
|
|
3172
|
-
key: "copyFrom",
|
|
3173
|
-
value: function copyFrom(p) {
|
|
3174
|
-
return this.x = p.x, this.y = p.y, this.x1 = p.x1, this.y1 = p.y1, this.defined = p.defined, this.context = p.context, this;
|
|
3175
|
-
}
|
|
3176
|
-
}, {
|
|
3177
|
-
key: "set",
|
|
3178
|
-
value: function set(x, y) {
|
|
3179
|
-
return this.x = x, this.y = y, this;
|
|
3180
|
-
}
|
|
3181
|
-
}, {
|
|
3182
|
-
key: "add",
|
|
3183
|
-
value: function add(point) {
|
|
3184
|
-
return isNumber$2(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
|
|
3185
|
-
}
|
|
3186
|
-
}, {
|
|
3187
|
-
key: "sub",
|
|
3188
|
-
value: function sub(point) {
|
|
3189
|
-
return isNumber$2(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
|
|
3190
|
-
}
|
|
3191
|
-
}, {
|
|
3192
|
-
key: "multi",
|
|
3193
|
-
value: function multi(point) {
|
|
3194
|
-
throw new Error("暂不支持");
|
|
3195
|
-
}
|
|
3196
|
-
}, {
|
|
3197
|
-
key: "div",
|
|
3198
|
-
value: function div(point) {
|
|
3199
|
-
throw new Error("暂不支持");
|
|
3200
|
-
}
|
|
3201
|
-
}]);
|
|
3202
|
-
return Point;
|
|
3203
|
-
}();
|
|
3204
|
-
var PointService = /*#__PURE__*/function () {
|
|
3205
|
-
function PointService() {
|
|
3206
|
-
_classCallCheck(this, PointService);
|
|
3207
|
-
}
|
|
3208
|
-
_createClass(PointService, null, [{
|
|
3209
|
-
key: "distancePP",
|
|
3210
|
-
value: function distancePP(p1, p2) {
|
|
3211
|
-
return sqrt(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
|
|
3212
|
-
}
|
|
3213
|
-
}, {
|
|
3214
|
-
key: "distanceNN",
|
|
3215
|
-
value: function distanceNN(x, y, x1, y1) {
|
|
3216
|
-
return sqrt(pow(x - x1, 2) + pow(y - y1, 2));
|
|
3217
|
-
}
|
|
3218
|
-
}, {
|
|
3219
|
-
key: "distancePN",
|
|
3220
|
-
value: function distancePN(point, x, y) {
|
|
3221
|
-
return sqrt(pow(x - point.x, 2) + pow(y - point.y, 2));
|
|
3222
|
-
}
|
|
3223
|
-
}, {
|
|
3224
|
-
key: "pointAtPP",
|
|
3225
|
-
value: function pointAtPP(p1, p2, t) {
|
|
3226
|
-
return new Point((p2.x - p1.x) * t + p1.x, (p2.y - p1.y) * t + p1.y);
|
|
3227
|
-
}
|
|
3228
|
-
}]);
|
|
3229
|
-
return PointService;
|
|
3230
|
-
}();
|
|
3231
|
-
|
|
3232
|
-
function transformBoundsWithMatrix(out, bounds, matrix) {
|
|
3233
|
-
var x1 = bounds.x1,
|
|
3234
|
-
y1 = bounds.y1,
|
|
3235
|
-
x2 = bounds.x2,
|
|
3236
|
-
y2 = bounds.y2;
|
|
3237
|
-
return matrix.onlyTranslate() ? (out !== bounds && out.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2), out.translate(matrix.e, matrix.f), bounds) : (out.clear(), out.add(matrix.a * x1 + matrix.c * y1 + matrix.e, matrix.b * x1 + matrix.d * y1 + matrix.f), out.add(matrix.a * x2 + matrix.c * y1 + matrix.e, matrix.b * x2 + matrix.d * y1 + matrix.f), out.add(matrix.a * x2 + matrix.c * y2 + matrix.e, matrix.b * x2 + matrix.d * y2 + matrix.f), out.add(matrix.a * x1 + matrix.c * y2 + matrix.e, matrix.b * x1 + matrix.d * y2 + matrix.f), bounds);
|
|
3238
|
-
}
|
|
3239
|
-
var Bounds = /*#__PURE__*/function () {
|
|
3240
|
-
function Bounds(bounds) {
|
|
3241
|
-
_classCallCheck(this, Bounds);
|
|
3242
|
-
bounds ? this.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2) : this.clear();
|
|
3243
|
-
}
|
|
3244
|
-
_createClass(Bounds, [{
|
|
3245
|
-
key: "clone",
|
|
3246
|
-
value: function clone() {
|
|
3247
|
-
return new Bounds(this);
|
|
3248
|
-
}
|
|
3249
|
-
}, {
|
|
3250
|
-
key: "clear",
|
|
3251
|
-
value: function clear() {
|
|
3252
|
-
return this.x1 = +Number.MAX_VALUE, this.y1 = +Number.MAX_VALUE, this.x2 = -Number.MAX_VALUE, this.y2 = -Number.MAX_VALUE, this;
|
|
3253
|
-
}
|
|
3254
|
-
}, {
|
|
3255
|
-
key: "empty",
|
|
3256
|
-
value: function empty() {
|
|
3257
|
-
return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE;
|
|
3258
|
-
}
|
|
3259
|
-
}, {
|
|
3260
|
-
key: "equals",
|
|
3261
|
-
value: function equals(b) {
|
|
3262
|
-
return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2;
|
|
3263
|
-
}
|
|
3264
|
-
}, {
|
|
3265
|
-
key: "setValue",
|
|
3266
|
-
value: function setValue() {
|
|
3267
|
-
var x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
3268
|
-
var y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3269
|
-
var x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
3270
|
-
var y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
3271
|
-
return this.x1 = x1, this.y1 = y1, this.x2 = x2, this.y2 = y2, this;
|
|
3272
|
-
}
|
|
3273
|
-
}, {
|
|
3274
|
-
key: "set",
|
|
3275
|
-
value: function set() {
|
|
3276
|
-
var x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
3277
|
-
var y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3278
|
-
var x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
3279
|
-
var y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
3280
|
-
return x2 < x1 ? (this.x2 = x1, this.x1 = x2) : (this.x1 = x1, this.x2 = x2), y2 < y1 ? (this.y2 = y1, this.y1 = y2) : (this.y1 = y1, this.y2 = y2), this;
|
|
3281
|
-
}
|
|
3282
|
-
}, {
|
|
3283
|
-
key: "add",
|
|
3284
|
-
value: function add() {
|
|
3285
|
-
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
3286
|
-
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3287
|
-
return x < this.x1 && (this.x1 = x), y < this.y1 && (this.y1 = y), x > this.x2 && (this.x2 = x), y > this.y2 && (this.y2 = y), this;
|
|
3288
|
-
}
|
|
3289
|
-
}, {
|
|
3290
|
-
key: "expand",
|
|
3291
|
-
value: function expand() {
|
|
3292
|
-
var d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
3293
|
-
return isArray$1(d) ? (this.y1 -= d[0], this.x2 += d[1], this.y2 += d[2], this.x1 -= d[3]) : (this.x1 -= d, this.y1 -= d, this.x2 += d, this.y2 += d), this;
|
|
3294
|
-
}
|
|
3295
|
-
}, {
|
|
3296
|
-
key: "round",
|
|
3297
|
-
value: function round() {
|
|
3298
|
-
return this.x1 = Math.floor(this.x1), this.y1 = Math.floor(this.y1), this.x2 = Math.ceil(this.x2), this.y2 = Math.ceil(this.y2), this;
|
|
3299
|
-
}
|
|
3300
|
-
}, {
|
|
3301
|
-
key: "translate",
|
|
3302
|
-
value: function translate() {
|
|
3303
|
-
var dx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
3304
|
-
var dy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3305
|
-
return this.x1 += dx, this.x2 += dx, this.y1 += dy, this.y2 += dy, this;
|
|
3306
|
-
}
|
|
3307
|
-
}, {
|
|
3308
|
-
key: "rotate",
|
|
3309
|
-
value: function rotate() {
|
|
3310
|
-
var angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
3311
|
-
var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3312
|
-
var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
3313
|
-
var p = this.rotatedPoints(angle, x, y);
|
|
3314
|
-
return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]);
|
|
3315
|
-
}
|
|
3316
|
-
}, {
|
|
3317
|
-
key: "scale",
|
|
3318
|
-
value: function scale() {
|
|
3319
|
-
var sx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
3320
|
-
var sy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3321
|
-
var x = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
3322
|
-
var y = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
3323
|
-
var p = this.scalePoints(sx, sy, x, y);
|
|
3324
|
-
return this.clear().add(p[0], p[1]).add(p[2], p[3]);
|
|
3325
|
-
}
|
|
3326
|
-
}, {
|
|
3327
|
-
key: "union",
|
|
3328
|
-
value: function union(b) {
|
|
3329
|
-
return b.x1 < this.x1 && (this.x1 = b.x1), b.y1 < this.y1 && (this.y1 = b.y1), b.x2 > this.x2 && (this.x2 = b.x2), b.y2 > this.y2 && (this.y2 = b.y2), this;
|
|
3330
|
-
}
|
|
3331
|
-
}, {
|
|
3332
|
-
key: "intersect",
|
|
3333
|
-
value: function intersect(b) {
|
|
3334
|
-
return b.x1 > this.x1 && (this.x1 = b.x1), b.y1 > this.y1 && (this.y1 = b.y1), b.x2 < this.x2 && (this.x2 = b.x2), b.y2 < this.y2 && (this.y2 = b.y2), this;
|
|
3335
|
-
}
|
|
3336
|
-
}, {
|
|
3337
|
-
key: "encloses",
|
|
3338
|
-
value: function encloses(b) {
|
|
3339
|
-
return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2;
|
|
3340
|
-
}
|
|
3341
|
-
}, {
|
|
3342
|
-
key: "alignsWith",
|
|
3343
|
-
value: function alignsWith(b) {
|
|
3344
|
-
return b && (this.x1 === b.x1 || this.x2 === b.x2 || this.y1 === b.y1 || this.y2 === b.y2);
|
|
3345
|
-
}
|
|
3346
|
-
}, {
|
|
3347
|
-
key: "intersects",
|
|
3348
|
-
value: function intersects(b) {
|
|
3349
|
-
return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2);
|
|
3350
|
-
}
|
|
3351
|
-
}, {
|
|
3352
|
-
key: "contains",
|
|
3353
|
-
value: function contains() {
|
|
3354
|
-
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
3355
|
-
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3356
|
-
return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2);
|
|
3357
|
-
}
|
|
3358
|
-
}, {
|
|
3359
|
-
key: "containsPoint",
|
|
3360
|
-
value: function containsPoint(p) {
|
|
3361
|
-
return !(p.x < this.x1 || p.x > this.x2 || p.y < this.y1 || p.y > this.y2);
|
|
3362
|
-
}
|
|
3363
|
-
}, {
|
|
3364
|
-
key: "width",
|
|
3365
|
-
value: function width() {
|
|
3366
|
-
return this.empty() ? 0 : this.x2 - this.x1;
|
|
3367
|
-
}
|
|
3368
|
-
}, {
|
|
3369
|
-
key: "height",
|
|
3370
|
-
value: function height() {
|
|
3371
|
-
return this.empty() ? 0 : this.y2 - this.y1;
|
|
3372
|
-
}
|
|
3373
|
-
}, {
|
|
3374
|
-
key: "scaleX",
|
|
3375
|
-
value: function scaleX() {
|
|
3376
|
-
var s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
3377
|
-
return this.x1 *= s, this.x2 *= s, this;
|
|
3378
|
-
}
|
|
3379
|
-
}, {
|
|
3380
|
-
key: "scaleY",
|
|
3381
|
-
value: function scaleY() {
|
|
3382
|
-
var s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
3383
|
-
return this.y1 *= s, this.y2 *= s, this;
|
|
3384
|
-
}
|
|
3385
|
-
}, {
|
|
3386
|
-
key: "transformWithMatrix",
|
|
3387
|
-
value: function transformWithMatrix(matrix) {
|
|
3388
|
-
return transformBoundsWithMatrix(this, this, matrix), this;
|
|
3389
|
-
}
|
|
3390
|
-
}, {
|
|
3391
|
-
key: "copy",
|
|
3392
|
-
value: function copy(b) {
|
|
3393
|
-
return this.x1 = b.x1, this.y1 = b.y1, this.x2 = b.x2, this.y2 = b.y2, this;
|
|
3394
|
-
}
|
|
3395
|
-
}, {
|
|
3396
|
-
key: "rotatedPoints",
|
|
3397
|
-
value: function rotatedPoints(angle, x, y) {
|
|
3398
|
-
var x1 = this.x1,
|
|
3399
|
-
y1 = this.y1,
|
|
3400
|
-
x2 = this.x2,
|
|
3401
|
-
y2 = this.y2,
|
|
3402
|
-
cos = Math.cos(angle),
|
|
3403
|
-
sin = Math.sin(angle),
|
|
3404
|
-
cx = x - x * cos + y * sin,
|
|
3405
|
-
cy = y - x * sin - y * cos;
|
|
3406
|
-
return [cos * x1 - sin * y1 + cx, sin * x1 + cos * y1 + cy, cos * x1 - sin * y2 + cx, sin * x1 + cos * y2 + cy, cos * x2 - sin * y1 + cx, sin * x2 + cos * y1 + cy, cos * x2 - sin * y2 + cx, sin * x2 + cos * y2 + cy];
|
|
3407
|
-
}
|
|
3408
|
-
}, {
|
|
3409
|
-
key: "scalePoints",
|
|
3410
|
-
value: function scalePoints(sx, sy, x, y) {
|
|
3411
|
-
var x1 = this.x1,
|
|
3412
|
-
y1 = this.y1,
|
|
3413
|
-
x2 = this.x2,
|
|
3414
|
-
y2 = this.y2;
|
|
3415
|
-
return [sx * x1 + (1 - sx) * x, sy * y1 + (1 - sy) * y, sx * x2 + (1 - sx) * x, sy * y2 + (1 - sy) * y];
|
|
3416
|
-
}
|
|
3417
|
-
}]);
|
|
3418
|
-
return Bounds;
|
|
3419
|
-
}();
|
|
3420
|
-
var AABBBounds = /*#__PURE__*/function (_Bounds) {
|
|
3421
|
-
_inherits(AABBBounds, _Bounds);
|
|
3422
|
-
var _super = _createSuper(AABBBounds);
|
|
3423
|
-
function AABBBounds() {
|
|
3424
|
-
_classCallCheck(this, AABBBounds);
|
|
3425
|
-
return _super.apply(this, arguments);
|
|
3426
|
-
}
|
|
3427
|
-
return _createClass(AABBBounds);
|
|
3428
|
-
}(Bounds);
|
|
3429
|
-
|
|
3430
|
-
function degreeToRadian(degree) {
|
|
3431
|
-
return degree * (Math.PI / 180);
|
|
3432
|
-
}
|
|
3433
|
-
function radianToDegree(radian) {
|
|
3434
|
-
return 180 * radian / Math.PI;
|
|
3435
|
-
}
|
|
3436
|
-
var clampRadian = function clampRadian() {
|
|
3437
|
-
var angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
3438
|
-
if (angle < 0) for (; angle < -tau;) angle += tau;else if (angle > 0) for (; angle > tau;) angle -= tau;
|
|
3439
|
-
return angle;
|
|
3440
|
-
};
|
|
3441
|
-
var clampAngleByRadian = clampRadian;
|
|
3442
|
-
function getAngleByPoint(center, point) {
|
|
3443
|
-
return Math.atan2(point.y - center.y, point.x - center.x);
|
|
3444
|
-
}
|
|
3445
|
-
|
|
3446
|
-
var Matrix = /*#__PURE__*/function () {
|
|
3447
|
-
function Matrix() {
|
|
3448
|
-
var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
3449
|
-
var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3450
|
-
var c = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
3451
|
-
var d = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
3452
|
-
var e = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
3453
|
-
var f = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
3454
|
-
_classCallCheck(this, Matrix);
|
|
3455
|
-
this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f;
|
|
3456
|
-
}
|
|
3457
|
-
_createClass(Matrix, [{
|
|
3458
|
-
key: "equalToMatrix",
|
|
3459
|
-
value: function equalToMatrix(m2) {
|
|
3460
|
-
return !(this.e !== m2.e || this.f !== m2.f || this.a !== m2.a || this.d !== m2.d || this.b !== m2.b || this.c !== m2.c);
|
|
3461
|
-
}
|
|
3462
|
-
}, {
|
|
3463
|
-
key: "equalTo",
|
|
3464
|
-
value: function equalTo(a, b, c, d, e, f) {
|
|
3465
|
-
return !(this.e !== e || this.f !== f || this.a !== a || this.d !== d || this.b !== b || this.c !== c);
|
|
3466
|
-
}
|
|
3467
|
-
}, {
|
|
3468
|
-
key: "setValue",
|
|
3469
|
-
value: function setValue(a, b, c, d, e, f) {
|
|
3470
|
-
return this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f, this;
|
|
3471
|
-
}
|
|
3472
|
-
}, {
|
|
3473
|
-
key: "reset",
|
|
3474
|
-
value: function reset() {
|
|
3475
|
-
return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this;
|
|
3476
|
-
}
|
|
3477
|
-
}, {
|
|
3478
|
-
key: "getInverse",
|
|
3479
|
-
value: function getInverse() {
|
|
3480
|
-
var a = this.a,
|
|
3481
|
-
b = this.b,
|
|
3482
|
-
c = this.c,
|
|
3483
|
-
d = this.d,
|
|
3484
|
-
e = this.e,
|
|
3485
|
-
f = this.f,
|
|
3486
|
-
m = new Matrix(),
|
|
3487
|
-
dt = a * d - b * c;
|
|
3488
|
-
return m.a = d / dt, m.b = -b / dt, m.c = -c / dt, m.d = a / dt, m.e = (c * f - d * e) / dt, m.f = -(a * f - b * e) / dt, m;
|
|
3489
|
-
}
|
|
3490
|
-
}, {
|
|
3491
|
-
key: "rotate",
|
|
3492
|
-
value: function rotate(rad) {
|
|
3493
|
-
var c = Math.cos(rad),
|
|
3494
|
-
s = Math.sin(rad),
|
|
3495
|
-
m11 = this.a * c + this.c * s,
|
|
3496
|
-
m12 = this.b * c + this.d * s,
|
|
3497
|
-
m21 = this.a * -s + this.c * c,
|
|
3498
|
-
m22 = this.b * -s + this.d * c;
|
|
3499
|
-
return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this;
|
|
3500
|
-
}
|
|
3501
|
-
}, {
|
|
3502
|
-
key: "rotateByCenter",
|
|
3503
|
-
value: function rotateByCenter(rad, cx, cy) {
|
|
3504
|
-
var cos = Math.cos(rad),
|
|
3505
|
-
sin = Math.sin(rad),
|
|
3506
|
-
rotateM13 = (1 - cos) * cx + sin * cy,
|
|
3507
|
-
rotateM23 = (1 - cos) * cy - sin * cx,
|
|
3508
|
-
m11 = cos * this.a - sin * this.b,
|
|
3509
|
-
m21 = sin * this.a + cos * this.b,
|
|
3510
|
-
m12 = cos * this.c - sin * this.d,
|
|
3511
|
-
m22 = sin * this.c + cos * this.d,
|
|
3512
|
-
m13 = cos * this.e - sin * this.f + rotateM13,
|
|
3513
|
-
m23 = sin * this.e + cos * this.f + rotateM23;
|
|
3514
|
-
return this.a = m11, this.b = m21, this.c = m12, this.d = m22, this.e = m13, this.f = m23, this;
|
|
3515
|
-
}
|
|
3516
|
-
}, {
|
|
3517
|
-
key: "scale",
|
|
3518
|
-
value: function scale(sx, sy) {
|
|
3519
|
-
return this.a *= sx, this.b *= sx, this.c *= sy, this.d *= sy, this;
|
|
3520
|
-
}
|
|
3521
|
-
}, {
|
|
3522
|
-
key: "setScale",
|
|
3523
|
-
value: function setScale(sx, sy) {
|
|
3524
|
-
return this.b = this.b / this.a * sx, this.c = this.c / this.d * sy, this.a = sx, this.d = sy, this;
|
|
3525
|
-
}
|
|
3526
|
-
}, {
|
|
3527
|
-
key: "transform",
|
|
3528
|
-
value: function transform(a, b, c, d, e, f) {
|
|
3529
|
-
return this.multiply(a, b, c, d, e, f), this;
|
|
3530
|
-
}
|
|
3531
|
-
}, {
|
|
3532
|
-
key: "translate",
|
|
3533
|
-
value: function translate(x, y) {
|
|
3534
|
-
return this.e += this.a * x + this.c * y, this.f += this.b * x + this.d * y, this;
|
|
3535
|
-
}
|
|
3536
|
-
}, {
|
|
3537
|
-
key: "transpose",
|
|
3538
|
-
value: function transpose() {
|
|
3539
|
-
var a = this.a,
|
|
3540
|
-
b = this.b,
|
|
3541
|
-
c = this.c,
|
|
3542
|
-
d = this.d,
|
|
3543
|
-
e = this.e,
|
|
3544
|
-
f = this.f;
|
|
3545
|
-
return this.a = b, this.b = a, this.c = d, this.d = c, this.e = f, this.f = e, this;
|
|
3546
|
-
}
|
|
3547
|
-
}, {
|
|
3548
|
-
key: "multiply",
|
|
3549
|
-
value: function multiply(a2, b2, c2, d2, e2, f2) {
|
|
3550
|
-
var a1 = this.a,
|
|
3551
|
-
b1 = this.b,
|
|
3552
|
-
c1 = this.c,
|
|
3553
|
-
d1 = this.d,
|
|
3554
|
-
m11 = a1 * a2 + c1 * b2,
|
|
3555
|
-
m12 = b1 * a2 + d1 * b2,
|
|
3556
|
-
m21 = a1 * c2 + c1 * d2,
|
|
3557
|
-
m22 = b1 * c2 + d1 * d2,
|
|
3558
|
-
dx = a1 * e2 + c1 * f2 + this.e,
|
|
3559
|
-
dy = b1 * e2 + d1 * f2 + this.f;
|
|
3560
|
-
return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this.e = dx, this.f = dy, this;
|
|
3561
|
-
}
|
|
3562
|
-
}, {
|
|
3563
|
-
key: "interpolate",
|
|
3564
|
-
value: function interpolate(m2, t) {
|
|
3565
|
-
var m = new Matrix();
|
|
3566
|
-
return m.a = this.a + (m2.a - this.a) * t, m.b = this.b + (m2.b - this.b) * t, m.c = this.c + (m2.c - this.c) * t, m.d = this.d + (m2.d - this.d) * t, m.e = this.e + (m2.e - this.e) * t, m.f = this.f + (m2.f - this.f) * t, m;
|
|
3567
|
-
}
|
|
3568
|
-
}, {
|
|
3569
|
-
key: "transformPoint",
|
|
3570
|
-
value: function transformPoint(source, target) {
|
|
3571
|
-
var a = this.a,
|
|
3572
|
-
b = this.b,
|
|
3573
|
-
c = this.c,
|
|
3574
|
-
d = this.d,
|
|
3575
|
-
e = this.e,
|
|
3576
|
-
f = this.f,
|
|
3577
|
-
dt = a * d - b * c,
|
|
3578
|
-
nextA = d / dt,
|
|
3579
|
-
nextB = -b / dt,
|
|
3580
|
-
nextC = -c / dt,
|
|
3581
|
-
nextD = a / dt,
|
|
3582
|
-
nextE = (c * f - d * e) / dt,
|
|
3583
|
-
nextF = -(a * f - b * e) / dt,
|
|
3584
|
-
x = source.x,
|
|
3585
|
-
y = source.y;
|
|
3586
|
-
target.x = x * nextA + y * nextC + nextE, target.y = x * nextB + y * nextD + nextF;
|
|
3587
|
-
}
|
|
3588
|
-
}, {
|
|
3589
|
-
key: "onlyTranslate",
|
|
3590
|
-
value: function onlyTranslate() {
|
|
3591
|
-
var scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
3592
|
-
return this.a === scale && 0 === this.b && 0 === this.c && this.d === scale;
|
|
3593
|
-
}
|
|
3594
|
-
}, {
|
|
3595
|
-
key: "clone",
|
|
3596
|
-
value: function clone() {
|
|
3597
|
-
return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f);
|
|
3598
|
-
}
|
|
3599
|
-
}, {
|
|
3600
|
-
key: "toTransformAttrs",
|
|
3601
|
-
value: function toTransformAttrs() {
|
|
3602
|
-
var a = this.a,
|
|
3603
|
-
b = this.b,
|
|
3604
|
-
c = this.c,
|
|
3605
|
-
d = this.d,
|
|
3606
|
-
delta = a * d - b * c,
|
|
3607
|
-
result = {
|
|
3608
|
-
x: this.e,
|
|
3609
|
-
y: this.f,
|
|
3610
|
-
rotateDeg: 0,
|
|
3611
|
-
scaleX: 0,
|
|
3612
|
-
scaleY: 0,
|
|
3613
|
-
skewX: 0,
|
|
3614
|
-
skewY: 0
|
|
3615
|
-
};
|
|
3616
|
-
if (0 !== a || 0 !== b) {
|
|
3617
|
-
var r = Math.sqrt(a * a + b * b);
|
|
3618
|
-
result.rotateDeg = b > 0 ? Math.acos(a / r) : -Math.acos(a / r), result.scaleX = r, result.scaleY = delta / r, result.skewX = (a * c + b * d) / delta, result.skewY = 0;
|
|
3619
|
-
} else if (0 !== c || 0 !== d) {
|
|
3620
|
-
var s = Math.sqrt(c * c + d * d);
|
|
3621
|
-
result.rotateDeg = Math.PI / 2 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s)), result.scaleX = delta / s, result.scaleY = s, result.skewX = 0, result.skewY = (a * c + b * d) / delta;
|
|
3622
|
-
}
|
|
3623
|
-
return result.rotateDeg = radianToDegree(result.rotateDeg), result;
|
|
3624
|
-
}
|
|
3625
|
-
}]);
|
|
3626
|
-
return Matrix;
|
|
3627
|
-
}();
|
|
3628
|
-
function normalTransform(out, origin, x, y, scaleX, scaleY, angle, rotateCenter) {
|
|
3629
|
-
var oa = origin.a,
|
|
3630
|
-
ob = origin.b,
|
|
3631
|
-
oc = origin.c,
|
|
3632
|
-
od = origin.d,
|
|
3633
|
-
oe = origin.e,
|
|
3634
|
-
of = origin.f,
|
|
3635
|
-
cosTheta = cos(angle),
|
|
3636
|
-
sinTheta = sin(angle);
|
|
3637
|
-
var rotateCenterX, rotateCenterY;
|
|
3638
|
-
rotateCenter ? (rotateCenterX = rotateCenter[0], rotateCenterY = rotateCenter[1]) : (rotateCenterX = x, rotateCenterY = y);
|
|
3639
|
-
var offsetX = rotateCenterX - x,
|
|
3640
|
-
offsetY = rotateCenterY - y,
|
|
3641
|
-
a1 = oa * cosTheta + oc * sinTheta,
|
|
3642
|
-
b1 = ob * cosTheta + od * sinTheta,
|
|
3643
|
-
c1 = oc * cosTheta - oa * sinTheta,
|
|
3644
|
-
d1 = od * cosTheta - ob * sinTheta;
|
|
3645
|
-
out.a = scaleX * a1, out.b = scaleX * b1, out.c = scaleY * c1, out.d = scaleY * d1, out.e = oe + oa * rotateCenterX + oc * rotateCenterY - a1 * offsetX - c1 * offsetY, out.f = of + ob * rotateCenterX + od * rotateCenterY - b1 * offsetX - d1 * offsetY;
|
|
3646
|
-
}
|
|
3647
|
-
|
|
3648
|
-
function hslToRgb(h, s, l) {
|
|
3649
|
-
s /= 100, l /= 100;
|
|
3650
|
-
var c = (1 - Math.abs(2 * l - 1)) * s,
|
|
3651
|
-
x = c * (1 - Math.abs(h / 60 % 2 - 1)),
|
|
3652
|
-
m = l - c / 2;
|
|
3653
|
-
var r = 0,
|
|
3654
|
-
g = 0,
|
|
3655
|
-
b = 0;
|
|
3656
|
-
return 0 <= h && h < 60 ? (r = c, g = x, b = 0) : 60 <= h && h < 120 ? (r = x, g = c, b = 0) : 120 <= h && h < 180 ? (r = 0, g = c, b = x) : 180 <= h && h < 240 ? (r = 0, g = x, b = c) : 240 <= h && h < 300 ? (r = x, g = 0, b = c) : 300 <= h && h < 360 && (r = c, g = 0, b = x), r = Math.round(255 * (r + m)), g = Math.round(255 * (g + m)), b = Math.round(255 * (b + m)), {
|
|
3657
|
-
r: r,
|
|
3658
|
-
g: g,
|
|
3659
|
-
b: b
|
|
3660
|
-
};
|
|
3661
|
-
}
|
|
3662
|
-
|
|
3663
|
-
function rgbToHsl(r, g, b) {
|
|
3664
|
-
r /= 255, g /= 255, b /= 255;
|
|
3665
|
-
var cMin = Math.min(r, g, b),
|
|
3666
|
-
cMax = Math.max(r, g, b),
|
|
3667
|
-
delta = cMax - cMin;
|
|
3668
|
-
var h = 0,
|
|
3669
|
-
s = 0,
|
|
3670
|
-
l = 0;
|
|
3671
|
-
return h = 0 === delta ? 0 : cMax === r ? (g - b) / delta % 6 : cMax === g ? (b - r) / delta + 2 : (r - g) / delta + 4, h = Math.round(60 * h), h < 0 && (h += 360), l = (cMax + cMin) / 2, s = 0 === delta ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(100 * s).toFixed(1), l = +(100 * l).toFixed(1), {
|
|
3672
|
-
h: h,
|
|
3673
|
-
s: s,
|
|
3674
|
-
l: l
|
|
3675
|
-
};
|
|
3676
|
-
}
|
|
3677
|
-
|
|
3678
|
-
var REG_HEX = /^#([0-9a-f]{3,8})$/,
|
|
3679
|
-
DEFAULT_COLORS_OPACITY = {
|
|
3680
|
-
transparent: 4294967040
|
|
3681
|
-
};
|
|
3682
|
-
var DEFAULT_COLORS = {
|
|
3683
|
-
aliceblue: 15792383,
|
|
3684
|
-
antiquewhite: 16444375,
|
|
3685
|
-
aqua: 65535,
|
|
3686
|
-
aquamarine: 8388564,
|
|
3687
|
-
azure: 15794175,
|
|
3688
|
-
beige: 16119260,
|
|
3689
|
-
bisque: 16770244,
|
|
3690
|
-
black: 0,
|
|
3691
|
-
blanchedalmond: 16772045,
|
|
3692
|
-
blue: 255,
|
|
3693
|
-
blueviolet: 9055202,
|
|
3694
|
-
brown: 10824234,
|
|
3695
|
-
burlywood: 14596231,
|
|
3696
|
-
cadetblue: 6266528,
|
|
3697
|
-
chartreuse: 8388352,
|
|
3698
|
-
chocolate: 13789470,
|
|
3699
|
-
coral: 16744272,
|
|
3700
|
-
cornflowerblue: 6591981,
|
|
3701
|
-
cornsilk: 16775388,
|
|
3702
|
-
crimson: 14423100,
|
|
3703
|
-
cyan: 65535,
|
|
3704
|
-
darkblue: 139,
|
|
3705
|
-
darkcyan: 35723,
|
|
3706
|
-
darkgoldenrod: 12092939,
|
|
3707
|
-
darkgray: 11119017,
|
|
3708
|
-
darkgreen: 25600,
|
|
3709
|
-
darkgrey: 11119017,
|
|
3710
|
-
darkkhaki: 12433259,
|
|
3711
|
-
darkmagenta: 9109643,
|
|
3712
|
-
darkolivegreen: 5597999,
|
|
3713
|
-
darkorange: 16747520,
|
|
3714
|
-
darkorchid: 10040012,
|
|
3715
|
-
darkred: 9109504,
|
|
3716
|
-
darksalmon: 15308410,
|
|
3717
|
-
darkseagreen: 9419919,
|
|
3718
|
-
darkslateblue: 4734347,
|
|
3719
|
-
darkslategray: 3100495,
|
|
3720
|
-
darkslategrey: 3100495,
|
|
3721
|
-
darkturquoise: 52945,
|
|
3722
|
-
darkviolet: 9699539,
|
|
3723
|
-
deeppink: 16716947,
|
|
3724
|
-
deepskyblue: 49151,
|
|
3725
|
-
dimgray: 6908265,
|
|
3726
|
-
dimgrey: 6908265,
|
|
3727
|
-
dodgerblue: 2003199,
|
|
3728
|
-
firebrick: 11674146,
|
|
3729
|
-
floralwhite: 16775920,
|
|
3730
|
-
forestgreen: 2263842,
|
|
3731
|
-
fuchsia: 16711935,
|
|
3732
|
-
gainsboro: 14474460,
|
|
3733
|
-
ghostwhite: 16316671,
|
|
3734
|
-
gold: 16766720,
|
|
3735
|
-
goldenrod: 14329120,
|
|
3736
|
-
gray: 8421504,
|
|
3737
|
-
green: 32768,
|
|
3738
|
-
greenyellow: 11403055,
|
|
3739
|
-
grey: 8421504,
|
|
3740
|
-
honeydew: 15794160,
|
|
3741
|
-
hotpink: 16738740,
|
|
3742
|
-
indianred: 13458524,
|
|
3743
|
-
indigo: 4915330,
|
|
3744
|
-
ivory: 16777200,
|
|
3745
|
-
khaki: 15787660,
|
|
3746
|
-
lavender: 15132410,
|
|
3747
|
-
lavenderblush: 16773365,
|
|
3748
|
-
lawngreen: 8190976,
|
|
3749
|
-
lemonchiffon: 16775885,
|
|
3750
|
-
lightblue: 11393254,
|
|
3751
|
-
lightcoral: 15761536,
|
|
3752
|
-
lightcyan: 14745599,
|
|
3753
|
-
lightgoldenrodyellow: 16448210,
|
|
3754
|
-
lightgray: 13882323,
|
|
3755
|
-
lightgreen: 9498256,
|
|
3756
|
-
lightgrey: 13882323,
|
|
3757
|
-
lightpink: 16758465,
|
|
3758
|
-
lightsalmon: 16752762,
|
|
3759
|
-
lightseagreen: 2142890,
|
|
3760
|
-
lightskyblue: 8900346,
|
|
3761
|
-
lightslategray: 7833753,
|
|
3762
|
-
lightslategrey: 7833753,
|
|
3763
|
-
lightsteelblue: 11584734,
|
|
3764
|
-
lightyellow: 16777184,
|
|
3765
|
-
lime: 65280,
|
|
3766
|
-
limegreen: 3329330,
|
|
3767
|
-
linen: 16445670,
|
|
3768
|
-
magenta: 16711935,
|
|
3769
|
-
maroon: 8388608,
|
|
3770
|
-
mediumaquamarine: 6737322,
|
|
3771
|
-
mediumblue: 205,
|
|
3772
|
-
mediumorchid: 12211667,
|
|
3773
|
-
mediumpurple: 9662683,
|
|
3774
|
-
mediumseagreen: 3978097,
|
|
3775
|
-
mediumslateblue: 8087790,
|
|
3776
|
-
mediumspringgreen: 64154,
|
|
3777
|
-
mediumturquoise: 4772300,
|
|
3778
|
-
mediumvioletred: 13047173,
|
|
3779
|
-
midnightblue: 1644912,
|
|
3780
|
-
mintcream: 16121850,
|
|
3781
|
-
mistyrose: 16770273,
|
|
3782
|
-
moccasin: 16770229,
|
|
3783
|
-
navajowhite: 16768685,
|
|
3784
|
-
navy: 128,
|
|
3785
|
-
oldlace: 16643558,
|
|
3786
|
-
olive: 8421376,
|
|
3787
|
-
olivedrab: 7048739,
|
|
3788
|
-
orange: 16753920,
|
|
3789
|
-
orangered: 16729344,
|
|
3790
|
-
orchid: 14315734,
|
|
3791
|
-
palegoldenrod: 15657130,
|
|
3792
|
-
palegreen: 10025880,
|
|
3793
|
-
paleturquoise: 11529966,
|
|
3794
|
-
palevioletred: 14381203,
|
|
3795
|
-
papayawhip: 16773077,
|
|
3796
|
-
peachpuff: 16767673,
|
|
3797
|
-
peru: 13468991,
|
|
3798
|
-
pink: 16761035,
|
|
3799
|
-
plum: 14524637,
|
|
3800
|
-
powderblue: 11591910,
|
|
3801
|
-
purple: 8388736,
|
|
3802
|
-
rebeccapurple: 6697881,
|
|
3803
|
-
red: 16711680,
|
|
3804
|
-
rosybrown: 12357519,
|
|
3805
|
-
royalblue: 4286945,
|
|
3806
|
-
saddlebrown: 9127187,
|
|
3807
|
-
salmon: 16416882,
|
|
3808
|
-
sandybrown: 16032864,
|
|
3809
|
-
seagreen: 3050327,
|
|
3810
|
-
seashell: 16774638,
|
|
3811
|
-
sienna: 10506797,
|
|
3812
|
-
silver: 12632256,
|
|
3813
|
-
skyblue: 8900331,
|
|
3814
|
-
slateblue: 6970061,
|
|
3815
|
-
slategray: 7372944,
|
|
3816
|
-
slategrey: 7372944,
|
|
3817
|
-
snow: 16775930,
|
|
3818
|
-
springgreen: 65407,
|
|
3819
|
-
steelblue: 4620980,
|
|
3820
|
-
tan: 13808780,
|
|
3821
|
-
teal: 32896,
|
|
3822
|
-
thistle: 14204888,
|
|
3823
|
-
tomato: 16737095,
|
|
3824
|
-
turquoise: 4251856,
|
|
3825
|
-
violet: 15631086,
|
|
3826
|
-
wheat: 16113331,
|
|
3827
|
-
white: 16777215,
|
|
3828
|
-
whitesmoke: 16119285,
|
|
3829
|
-
yellow: 16776960,
|
|
3830
|
-
yellowgreen: 10145074
|
|
3831
|
-
};
|
|
3832
|
-
function hex(value) {
|
|
3833
|
-
return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
|
|
3834
|
-
}
|
|
3835
|
-
function rgb(value) {
|
|
3836
|
-
return isNumber$2(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
|
|
3837
|
-
}
|
|
3838
|
-
function rgba(value) {
|
|
3839
|
-
return isNumber$2(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
|
|
3840
|
-
}
|
|
3841
|
-
function SRGBToLinear(c) {
|
|
3842
|
-
return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
|
|
3843
|
-
}
|
|
3844
|
-
function LinearToSRGB(c) {
|
|
3845
|
-
return c < .0031308 ? 12.92 * c : 1.055 * Math.pow(c, .41666) - .055;
|
|
3846
|
-
}
|
|
3847
|
-
var Color$1 = /*#__PURE__*/function () {
|
|
3848
|
-
function Color(value) {
|
|
3849
|
-
_classCallCheck(this, Color);
|
|
3850
|
-
var color = Color.parseColorString(value);
|
|
3851
|
-
color ? this.color = color : (console.warn("Warn: \u4F20\u5165".concat(value, "\u65E0\u6CD5\u89E3\u6790\u4E3AColor")), this.color = new RGB(255, 255, 255));
|
|
3852
|
-
}
|
|
3853
|
-
_createClass(Color, [{
|
|
3854
|
-
key: "toRGBA",
|
|
3855
|
-
value: function toRGBA() {
|
|
3856
|
-
return this.color.formatRgb();
|
|
3857
|
-
}
|
|
3858
|
-
}, {
|
|
3859
|
-
key: "toString",
|
|
3860
|
-
value: function toString() {
|
|
3861
|
-
return this.color.formatRgb();
|
|
3862
|
-
}
|
|
3863
|
-
}, {
|
|
3864
|
-
key: "toHex",
|
|
3865
|
-
value: function toHex() {
|
|
3866
|
-
return this.color.formatHex();
|
|
3867
|
-
}
|
|
3868
|
-
}, {
|
|
3869
|
-
key: "toHsl",
|
|
3870
|
-
value: function toHsl() {
|
|
3871
|
-
return this.color.formatHsl();
|
|
3872
|
-
}
|
|
3873
|
-
}, {
|
|
3874
|
-
key: "brighter",
|
|
3875
|
-
value: function brighter(k) {
|
|
3876
|
-
var _this$color = this.color,
|
|
3877
|
-
r = _this$color.r,
|
|
3878
|
-
g = _this$color.g,
|
|
3879
|
-
b = _this$color.b;
|
|
3880
|
-
return this.color.r = Math.max(0, Math.min(255, Math.floor(r * k))), this.color.g = Math.max(0, Math.min(255, Math.floor(g * k))), this.color.b = Math.max(0, Math.min(255, Math.floor(b * k))), this;
|
|
3881
|
-
}
|
|
3882
|
-
}, {
|
|
3883
|
-
key: "add",
|
|
3884
|
-
value: function add(color) {
|
|
3885
|
-
var _this$color2 = this.color,
|
|
3886
|
-
r = _this$color2.r,
|
|
3887
|
-
g = _this$color2.g,
|
|
3888
|
-
b = _this$color2.b;
|
|
3889
|
-
return this.color.r += Math.min(255, r + color.color.r), this.color.g += Math.min(255, g + color.color.g), this.color.b += Math.min(255, b + color.color.b), this;
|
|
3890
|
-
}
|
|
3891
|
-
}, {
|
|
3892
|
-
key: "sub",
|
|
3893
|
-
value: function sub(color) {
|
|
3894
|
-
return this.color.r = Math.max(0, this.color.r - color.color.r), this.color.g = Math.max(0, this.color.g - color.color.g), this.color.b = Math.max(0, this.color.b - color.color.b), this;
|
|
3895
|
-
}
|
|
3896
|
-
}, {
|
|
3897
|
-
key: "multiply",
|
|
3898
|
-
value: function multiply(color) {
|
|
3899
|
-
var _this$color3 = this.color,
|
|
3900
|
-
r = _this$color3.r,
|
|
3901
|
-
g = _this$color3.g,
|
|
3902
|
-
b = _this$color3.b;
|
|
3903
|
-
return this.color.r = Math.max(0, Math.min(255, Math.floor(r * color.color.r))), this.color.g = Math.max(0, Math.min(255, Math.floor(g * color.color.g))), this.color.b = Math.max(0, Math.min(255, Math.floor(b * color.color.b))), this;
|
|
3904
|
-
}
|
|
3905
|
-
}, {
|
|
3906
|
-
key: "getHSVBrightness",
|
|
3907
|
-
value: function getHSVBrightness() {
|
|
3908
|
-
return Math.max(this.color.r, this.color.g, this.color.b) / 255;
|
|
3909
|
-
}
|
|
3910
|
-
}, {
|
|
3911
|
-
key: "getHSLBrightness",
|
|
3912
|
-
value: function getHSLBrightness() {
|
|
3913
|
-
return .5 * (Math.max(this.color.r, this.color.g, this.color.b) / 255 + Math.min(this.color.r, this.color.g, this.color.b) / 255);
|
|
3914
|
-
}
|
|
3915
|
-
}, {
|
|
3916
|
-
key: "setHsl",
|
|
3917
|
-
value: function setHsl(h, s, l) {
|
|
3918
|
-
var opacity = this.color.opacity,
|
|
3919
|
-
hsl = rgbToHsl(this.color.r, this.color.g, this.color.b),
|
|
3920
|
-
rgb = hslToRgb(isNil$1(h) ? hsl.h : clamp$1(h, 0, 360), isNil$1(s) ? hsl.s : s >= 0 && s <= 1 ? 100 * s : s, isNil$1(l) ? hsl.l : l <= 1 && l >= 0 ? 100 * l : l);
|
|
3921
|
-
return this.color = new RGB(rgb.r, rgb.g, rgb.b, opacity), this;
|
|
3922
|
-
}
|
|
3923
|
-
}, {
|
|
3924
|
-
key: "setRGB",
|
|
3925
|
-
value: function setRGB(r, g, b) {
|
|
3926
|
-
return !isNil$1(r) && (this.color.r = r), !isNil$1(g) && (this.color.g = g), !isNil$1(b) && (this.color.b = b), this;
|
|
3927
|
-
}
|
|
3928
|
-
}, {
|
|
3929
|
-
key: "setHex",
|
|
3930
|
-
value: function setHex(value) {
|
|
3931
|
-
var formatValue = "".concat(value).trim().toLowerCase(),
|
|
3932
|
-
isHex = REG_HEX.exec(formatValue),
|
|
3933
|
-
hex = parseInt(isHex[1], 16),
|
|
3934
|
-
hexLength = isHex[1].length;
|
|
3935
|
-
return 3 === hexLength ? new RGB((hex >> 8 & 15) + ((hex >> 8 & 15) << 4), (hex >> 4 & 15) + ((hex >> 4 & 15) << 4), (15 & hex) + ((15 & hex) << 4), 1) : 6 === hexLength ? rgb(hex) : 8 === hexLength ? new RGB(hex >> 24 & 255, hex >> 16 & 255, hex >> 8 & 255, (255 & hex) / 255) : this;
|
|
3936
|
-
}
|
|
3937
|
-
}, {
|
|
3938
|
-
key: "setColorName",
|
|
3939
|
-
value: function setColorName(name) {
|
|
3940
|
-
var hex = DEFAULT_COLORS[name.toLowerCase()];
|
|
3941
|
-
return void 0 !== hex ? this.setHex(hex) : console.warn("THREE.Color: Unknown color " + name), this;
|
|
3942
|
-
}
|
|
3943
|
-
}, {
|
|
3944
|
-
key: "setScalar",
|
|
3945
|
-
value: function setScalar(scalar) {
|
|
3946
|
-
return this.color.r = scalar, this.color.g = scalar, this.color.b = scalar, this;
|
|
3947
|
-
}
|
|
3948
|
-
}, {
|
|
3949
|
-
key: "setOpacity",
|
|
3950
|
-
value: function setOpacity() {
|
|
3951
|
-
var o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
3952
|
-
return this.color.opacity = o, this;
|
|
3953
|
-
}
|
|
3954
|
-
}, {
|
|
3955
|
-
key: "getLuminance",
|
|
3956
|
-
value: function getLuminance() {
|
|
3957
|
-
return (.2126 * this.color.r + .7152 * this.color.g + .0722 * this.color.b) / 255;
|
|
3958
|
-
}
|
|
3959
|
-
}, {
|
|
3960
|
-
key: "getLuminance2",
|
|
3961
|
-
value: function getLuminance2() {
|
|
3962
|
-
return (.2627 * this.color.r + .678 * this.color.g + .0593 * this.color.b) / 255;
|
|
3963
|
-
}
|
|
3964
|
-
}, {
|
|
3965
|
-
key: "getLuminance3",
|
|
3966
|
-
value: function getLuminance3() {
|
|
3967
|
-
return (.299 * this.color.r + .587 * this.color.g + .114 * this.color.b) / 255;
|
|
3968
|
-
}
|
|
3969
|
-
}, {
|
|
3970
|
-
key: "clone",
|
|
3971
|
-
value: function clone() {
|
|
3972
|
-
return new Color(this.color.toString());
|
|
3973
|
-
}
|
|
3974
|
-
}, {
|
|
3975
|
-
key: "copyGammaToLinear",
|
|
3976
|
-
value: function copyGammaToLinear(color) {
|
|
3977
|
-
var gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
3978
|
-
return this.color.r = Math.pow(color.color.r, gammaFactor), this.color.g = Math.pow(color.color.g, gammaFactor), this.color.b = Math.pow(color.color.b, gammaFactor), this;
|
|
3979
|
-
}
|
|
3980
|
-
}, {
|
|
3981
|
-
key: "copyLinearToGamma",
|
|
3982
|
-
value: function copyLinearToGamma(color) {
|
|
3983
|
-
var gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
3984
|
-
var safeInverse = gammaFactor > 0 ? 1 / gammaFactor : 1;
|
|
3985
|
-
return this.color.r = Math.pow(color.color.r, safeInverse), this.color.g = Math.pow(color.color.g, safeInverse), this.color.b = Math.pow(color.color.b, safeInverse), this;
|
|
3986
|
-
}
|
|
3987
|
-
}, {
|
|
3988
|
-
key: "convertGammaToLinear",
|
|
3989
|
-
value: function convertGammaToLinear(gammaFactor) {
|
|
3990
|
-
return this.copyGammaToLinear(this, gammaFactor), this;
|
|
3991
|
-
}
|
|
3992
|
-
}, {
|
|
3993
|
-
key: "convertLinearToGamma",
|
|
3994
|
-
value: function convertLinearToGamma(gammaFactor) {
|
|
3995
|
-
return this.copyLinearToGamma(this, gammaFactor), this;
|
|
3996
|
-
}
|
|
3997
|
-
}, {
|
|
3998
|
-
key: "copySRGBToLinear",
|
|
3999
|
-
value: function copySRGBToLinear(color) {
|
|
4000
|
-
return this.color.r = SRGBToLinear(color.color.r), this.color.g = SRGBToLinear(color.color.g), this.color.b = SRGBToLinear(color.color.b), this;
|
|
4001
|
-
}
|
|
4002
|
-
}, {
|
|
4003
|
-
key: "copyLinearToSRGB",
|
|
4004
|
-
value: function copyLinearToSRGB(color) {
|
|
4005
|
-
return this.color.r = LinearToSRGB(color.color.r), this.color.g = LinearToSRGB(color.color.g), this.color.b = LinearToSRGB(color.color.b), this;
|
|
4006
|
-
}
|
|
4007
|
-
}, {
|
|
4008
|
-
key: "convertSRGBToLinear",
|
|
4009
|
-
value: function convertSRGBToLinear() {
|
|
4010
|
-
return this.copySRGBToLinear(this), this;
|
|
4011
|
-
}
|
|
4012
|
-
}, {
|
|
4013
|
-
key: "convertLinearToSRGB",
|
|
4014
|
-
value: function convertLinearToSRGB() {
|
|
4015
|
-
return this.copyLinearToSRGB(this), this;
|
|
4016
|
-
}
|
|
4017
|
-
}], [{
|
|
4018
|
-
key: "Brighter",
|
|
4019
|
-
value: function Brighter(source) {
|
|
4020
|
-
var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
4021
|
-
return 1 === b ? source : new Color(source).brighter(b).toRGBA();
|
|
4022
|
-
}
|
|
4023
|
-
}, {
|
|
4024
|
-
key: "SetOpacity",
|
|
4025
|
-
value: function SetOpacity(source) {
|
|
4026
|
-
var o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
4027
|
-
return 1 === o ? source : new Color(source).setOpacity(o).toRGBA();
|
|
4028
|
-
}
|
|
4029
|
-
}, {
|
|
4030
|
-
key: "getColorBrightness",
|
|
4031
|
-
value: function getColorBrightness(source) {
|
|
4032
|
-
var model = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "hsl";
|
|
4033
|
-
var color = source instanceof Color ? source : new Color(source);
|
|
4034
|
-
switch (model) {
|
|
4035
|
-
case "hsv":
|
|
4036
|
-
default:
|
|
4037
|
-
return color.getHSVBrightness();
|
|
4038
|
-
case "hsl":
|
|
4039
|
-
return color.getHSLBrightness();
|
|
4040
|
-
case "lum":
|
|
4041
|
-
return color.getLuminance();
|
|
4042
|
-
case "lum2":
|
|
4043
|
-
return color.getLuminance2();
|
|
4044
|
-
case "lum3":
|
|
4045
|
-
return color.getLuminance3();
|
|
4046
|
-
}
|
|
4047
|
-
}
|
|
4048
|
-
}, {
|
|
4049
|
-
key: "parseColorString",
|
|
4050
|
-
value: function parseColorString(value) {
|
|
4051
|
-
if (isValid$1(DEFAULT_COLORS_OPACITY[value])) return rgba(DEFAULT_COLORS_OPACITY[value]);
|
|
4052
|
-
if (isValid$1(DEFAULT_COLORS[value])) return rgb(DEFAULT_COLORS[value]);
|
|
4053
|
-
var formatValue = "".concat(value).trim().toLowerCase(),
|
|
4054
|
-
isHex = REG_HEX.exec(formatValue);
|
|
4055
|
-
if (isHex) {
|
|
4056
|
-
var _hex = parseInt(isHex[1], 16),
|
|
4057
|
-
hexLength = isHex[1].length;
|
|
4058
|
-
return 3 === hexLength ? new RGB((_hex >> 8 & 15) + ((_hex >> 8 & 15) << 4), (_hex >> 4 & 15) + ((_hex >> 4 & 15) << 4), (15 & _hex) + ((15 & _hex) << 4), 1) : 6 === hexLength ? rgb(_hex) : 8 === hexLength ? new RGB(_hex >> 24 & 255, _hex >> 16 & 255, _hex >> 8 & 255, (255 & _hex) / 255) : void 0;
|
|
4059
|
-
}
|
|
4060
|
-
if (/^(rgb|RGB|rgba|RGBA)/.test(formatValue)) {
|
|
4061
|
-
var aColor = formatValue.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g, "").split(",");
|
|
4062
|
-
return new RGB(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10), parseFloat(aColor[3]));
|
|
4063
|
-
}
|
|
4064
|
-
if (/^(hsl|HSL|hsla|HSLA)/.test(formatValue)) {
|
|
4065
|
-
var _aColor = formatValue.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g, "").split(","),
|
|
4066
|
-
_rgb = hslToRgb(parseInt(_aColor[0], 10), parseInt(_aColor[1], 10), parseInt(_aColor[2], 10));
|
|
4067
|
-
return new RGB(_rgb.r, _rgb.g, _rgb.b, parseFloat(_aColor[3]));
|
|
4068
|
-
}
|
|
4069
|
-
}
|
|
4070
|
-
}]);
|
|
4071
|
-
return Color;
|
|
4072
|
-
}();
|
|
4073
|
-
var RGB = /*#__PURE__*/function () {
|
|
4074
|
-
function RGB(r, g, b, opacity) {
|
|
4075
|
-
_classCallCheck(this, RGB);
|
|
4076
|
-
this.r = isNaN(+r) ? 255 : Math.max(0, Math.min(255, +r)), this.g = isNaN(+g) ? 255 : Math.max(0, Math.min(255, +g)), this.b = isNaN(+b) ? 255 : Math.max(0, Math.min(255, +b)), isValid$1(opacity) ? this.opacity = isNaN(+opacity) ? 1 : Math.max(0, Math.min(1, +opacity)) : this.opacity = 1;
|
|
4077
|
-
}
|
|
4078
|
-
_createClass(RGB, [{
|
|
4079
|
-
key: "formatHex",
|
|
4080
|
-
value: function formatHex() {
|
|
4081
|
-
return "#".concat(hex(this.r) + hex(this.g) + hex(this.b) + (1 === this.opacity ? "" : hex(255 * this.opacity)));
|
|
4082
|
-
}
|
|
4083
|
-
}, {
|
|
4084
|
-
key: "formatRgb",
|
|
4085
|
-
value: function formatRgb() {
|
|
4086
|
-
var opacity = this.opacity;
|
|
4087
|
-
return "".concat(1 === opacity ? "rgb(" : "rgba(").concat(this.r, ",").concat(this.g, ",").concat(this.b).concat(1 === opacity ? ")" : ",".concat(opacity, ")"));
|
|
4088
|
-
}
|
|
4089
|
-
}, {
|
|
4090
|
-
key: "formatHsl",
|
|
4091
|
-
value: function formatHsl() {
|
|
4092
|
-
var opacity = this.opacity,
|
|
4093
|
-
_rgbToHsl = rgbToHsl(this.r, this.g, this.b),
|
|
4094
|
-
h = _rgbToHsl.h,
|
|
4095
|
-
s = _rgbToHsl.s,
|
|
4096
|
-
l = _rgbToHsl.l;
|
|
4097
|
-
return "".concat(1 === opacity ? "hsl(" : "hsla(").concat(h, ",").concat(s, "%,").concat(l, "%").concat(1 === opacity ? ")" : ",".concat(opacity, ")"));
|
|
4098
|
-
}
|
|
4099
|
-
}, {
|
|
4100
|
-
key: "toString",
|
|
4101
|
-
value: function toString() {
|
|
4102
|
-
return this.formatHex();
|
|
4103
|
-
}
|
|
4104
|
-
}]);
|
|
4105
|
-
return RGB;
|
|
4106
|
-
}();
|
|
4107
|
-
|
|
4108
|
-
function hexToRgb(str) {
|
|
4109
|
-
var r = "",
|
|
4110
|
-
g = "",
|
|
4111
|
-
b = "";
|
|
4112
|
-
var strtIndex = "#" === str[0] ? 1 : 0;
|
|
4113
|
-
for (var i = strtIndex; i < str.length; i++) "#" !== str[i] && (i < strtIndex + 2 ? r += str[i] : i < strtIndex + 4 ? g += str[i] : i < strtIndex + 6 && (b += str[i]));
|
|
4114
|
-
return [parseInt(r, 16), parseInt(g, 16), parseInt(b, 16)];
|
|
4115
|
-
}
|
|
4116
|
-
|
|
4117
|
-
function rgbToHex(r, g, b) {
|
|
4118
|
-
return Number((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
4119
|
-
}
|
|
4120
|
-
|
|
4121
|
-
function interpolateRgb(colorA, colorB) {
|
|
4122
|
-
var redA = colorA.r,
|
|
4123
|
-
redB = colorB.r,
|
|
4124
|
-
greenA = colorA.g,
|
|
4125
|
-
greenB = colorB.g,
|
|
4126
|
-
blueA = colorA.b,
|
|
4127
|
-
blueB = colorB.b,
|
|
4128
|
-
opacityA = colorA.opacity,
|
|
4129
|
-
opacityB = colorB.opacity;
|
|
4130
|
-
return function (t) {
|
|
4131
|
-
var r = Math.round(redA * (1 - t) + redB * t),
|
|
4132
|
-
g = Math.round(greenA * (1 - t) + greenB * t),
|
|
4133
|
-
b = Math.round(blueA * (1 - t) + blueB * t);
|
|
4134
|
-
return new RGB(r, g, b, opacityA * (1 - t) + opacityB * t);
|
|
4135
|
-
};
|
|
4136
|
-
}
|
|
4137
|
-
|
|
4138
|
-
var ColorUtil = /*#__PURE__*/Object.freeze({
|
|
4139
|
-
__proto__: null,
|
|
4140
|
-
Color: Color$1,
|
|
4141
|
-
DEFAULT_COLORS: DEFAULT_COLORS,
|
|
4142
|
-
RGB: RGB,
|
|
4143
|
-
hexToRgb: hexToRgb,
|
|
4144
|
-
hslToRgb: hslToRgb,
|
|
4145
|
-
interpolateRgb: interpolateRgb,
|
|
4146
|
-
rgbToHex: rgbToHex,
|
|
4147
|
-
rgbToHsl: rgbToHsl
|
|
4148
|
-
});
|
|
4149
|
-
|
|
4150
|
-
function sub(out, v1, v2) {
|
|
4151
|
-
out[0] = v1[0] - v2[0], out[1] = v1[1] - v2[1];
|
|
4152
|
-
}
|
|
4153
|
-
var x11, x12, y11, y12, x21, x22, y21, y22;
|
|
4154
|
-
function isIntersect(left1, right1, left2, right2) {
|
|
4155
|
-
var _temp,
|
|
4156
|
-
min1 = left1[0],
|
|
4157
|
-
max1 = right1[0],
|
|
4158
|
-
min2 = left2[0],
|
|
4159
|
-
max2 = right2[0];
|
|
4160
|
-
return max1 < min1 && (_temp = max1, max1 = min1, min1 = _temp), max2 < min2 && (_temp = max2, max2 = min2, min2 = _temp), !(max1 < min2 || max2 < min1) && (min1 = left1[1], max1 = right1[1], min2 = left2[1], max2 = right2[1], max1 < min1 && (_temp = max1, max1 = min1, min1 = _temp), max2 < min2 && (_temp = max2, max2 = min2, min2 = _temp), !(max1 < min2 || max2 < min1));
|
|
4161
|
-
}
|
|
4162
|
-
function getIntersectPoint(left1, right1, left2, right2) {
|
|
4163
|
-
if (!isIntersect(left1, right1, left2, right2)) return !1;
|
|
4164
|
-
var dir1 = [0, 0],
|
|
4165
|
-
dir2 = [0, 0],
|
|
4166
|
-
tempVec = [0, 0];
|
|
4167
|
-
if (sub(dir1, right1, left1), sub(dir2, right2, left2), fuzzyEqualVec(dir1, dir2)) return !0;
|
|
4168
|
-
sub(tempVec, left2, left1);
|
|
4169
|
-
var t = crossProduct$1(tempVec, dir2) / crossProduct$1(dir1, dir2);
|
|
4170
|
-
return t >= 0 && t <= 1 && [left1[0] + dir1[0] * t, left1[1] + dir1[1] * t];
|
|
4171
|
-
}
|
|
4172
|
-
function getRectIntersect(bbox1, bbox2, format) {
|
|
4173
|
-
var _ref, _ref2, _ref3, _ref4;
|
|
4174
|
-
return null === bbox1 ? bbox2 : null === bbox2 ? bbox1 : (x11 = bbox1.x1, x12 = bbox1.x2, y11 = bbox1.y1, y12 = bbox1.y2, x21 = bbox2.x1, x22 = bbox2.x2, y21 = bbox2.y1, y22 = bbox2.y2, format && (x11 > x12 && (_ref = [x12, x11], x11 = _ref[0], x12 = _ref[1], _ref), y11 > y12 && (_ref2 = [y12, y11], y11 = _ref2[0], y12 = _ref2[1], _ref2), x21 > x22 && (_ref3 = [x22, x21], x21 = _ref3[0], x22 = _ref3[1], _ref3), y21 > y22 && (_ref4 = [y22, y21], y21 = _ref4[0], y22 = _ref4[1], _ref4)), x11 >= x22 || x12 <= x21 || y11 >= y22 || y12 <= y21 ? {
|
|
4175
|
-
x1: 0,
|
|
4176
|
-
y1: 0,
|
|
4177
|
-
x2: 0,
|
|
4178
|
-
y2: 0
|
|
4179
|
-
} : {
|
|
4180
|
-
x1: Math.max(x11, x21),
|
|
4181
|
-
y1: Math.max(y11, y21),
|
|
4182
|
-
x2: Math.min(x12, x22),
|
|
4183
|
-
y2: Math.min(y12, y22)
|
|
4184
|
-
});
|
|
4185
|
-
}
|
|
4186
|
-
var InnerBBox;
|
|
4187
|
-
!function (InnerBBox) {
|
|
4188
|
-
InnerBBox[InnerBBox.NONE = 0] = "NONE", InnerBBox[InnerBBox.BBOX1 = 1] = "BBOX1", InnerBBox[InnerBBox.BBOX2 = 2] = "BBOX2";
|
|
4189
|
-
}(InnerBBox || (InnerBBox = {}));
|
|
4190
|
-
function isRectIntersect(bbox1, bbox2, format) {
|
|
4191
|
-
var _ref9, _ref10, _ref11, _ref12;
|
|
4192
|
-
return !bbox1 || !bbox2 || (format ? (x11 = bbox1.x1, x12 = bbox1.x2, y11 = bbox1.y1, y12 = bbox1.y2, x21 = bbox2.x1, x22 = bbox2.x2, y21 = bbox2.y1, y22 = bbox2.y2, x11 > x12 && (_ref9 = [x12, x11], x11 = _ref9[0], x12 = _ref9[1], _ref9), y11 > y12 && (_ref10 = [y12, y11], y11 = _ref10[0], y12 = _ref10[1], _ref10), x21 > x22 && (_ref11 = [x22, x21], x21 = _ref11[0], x22 = _ref11[1], _ref11), y21 > y22 && (_ref12 = [y22, y21], y21 = _ref12[0], y22 = _ref12[1], _ref12), !(x11 > x22 || x12 < x21 || y11 > y22 || y12 < y21)) : !(bbox1.x1 > bbox2.x2 || bbox1.x2 < bbox2.x1 || bbox1.y1 > bbox2.y2 || bbox1.y2 < bbox2.y1));
|
|
4193
|
-
}
|
|
4194
|
-
|
|
4195
|
-
var eastAsianCharacterInfo = function eastAsianCharacterInfo(character) {
|
|
4196
|
-
var x = character.charCodeAt(0),
|
|
4197
|
-
y = 2 === character.length ? character.charCodeAt(1) : 0,
|
|
4198
|
-
codePoint = x;
|
|
4199
|
-
return 55296 <= x && x <= 56319 && 56320 <= y && y <= 57343 && (x &= 1023, y &= 1023, codePoint = x << 10 | y, codePoint += 65536), 12288 === codePoint || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 ? "F" : 8361 === codePoint || 65377 <= codePoint && codePoint <= 65470 || 65474 <= codePoint && codePoint <= 65479 || 65482 <= codePoint && codePoint <= 65487 || 65490 <= codePoint && codePoint <= 65495 || 65498 <= codePoint && codePoint <= 65500 || 65512 <= codePoint && codePoint <= 65518 ? "H" : 4352 <= codePoint && codePoint <= 4447 || 4515 <= codePoint && codePoint <= 4519 || 4602 <= codePoint && codePoint <= 4607 || 9001 <= codePoint && codePoint <= 9002 || 11904 <= codePoint && codePoint <= 11929 || 11931 <= codePoint && codePoint <= 12019 || 12032 <= codePoint && codePoint <= 12245 || 12272 <= codePoint && codePoint <= 12283 || 12289 <= codePoint && codePoint <= 12350 || 12353 <= codePoint && codePoint <= 12438 || 12441 <= codePoint && codePoint <= 12543 || 12549 <= codePoint && codePoint <= 12589 || 12593 <= codePoint && codePoint <= 12686 || 12688 <= codePoint && codePoint <= 12730 || 12736 <= codePoint && codePoint <= 12771 || 12784 <= codePoint && codePoint <= 12830 || 12832 <= codePoint && codePoint <= 12871 || 12880 <= codePoint && codePoint <= 13054 || 13056 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42124 || 42128 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 55216 <= codePoint && codePoint <= 55238 || 55243 <= codePoint && codePoint <= 55291 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65106 || 65108 <= codePoint && codePoint <= 65126 || 65128 <= codePoint && codePoint <= 65131 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127490 || 127504 <= codePoint && codePoint <= 127546 || 127552 <= codePoint && codePoint <= 127560 || 127568 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 194367 || 177984 <= codePoint && codePoint <= 196605 || 196608 <= codePoint && codePoint <= 262141 ? "W" : 32 <= codePoint && codePoint <= 126 || 162 <= codePoint && codePoint <= 163 || 165 <= codePoint && codePoint <= 166 || 172 === codePoint || 175 === codePoint || 10214 <= codePoint && codePoint <= 10221 || 10629 <= codePoint && codePoint <= 10630 ? "Na" : 161 === codePoint || 164 === codePoint || 167 <= codePoint && codePoint <= 168 || 170 === codePoint || 173 <= codePoint && codePoint <= 174 || 176 <= codePoint && codePoint <= 180 || 182 <= codePoint && codePoint <= 186 || 188 <= codePoint && codePoint <= 191 || 198 === codePoint || 208 === codePoint || 215 <= codePoint && codePoint <= 216 || 222 <= codePoint && codePoint <= 225 || 230 === codePoint || 232 <= codePoint && codePoint <= 234 || 236 <= codePoint && codePoint <= 237 || 240 === codePoint || 242 <= codePoint && codePoint <= 243 || 247 <= codePoint && codePoint <= 250 || 252 === codePoint || 254 === codePoint || 257 === codePoint || 273 === codePoint || 275 === codePoint || 283 === codePoint || 294 <= codePoint && codePoint <= 295 || 299 === codePoint || 305 <= codePoint && codePoint <= 307 || 312 === codePoint || 319 <= codePoint && codePoint <= 322 || 324 === codePoint || 328 <= codePoint && codePoint <= 331 || 333 === codePoint || 338 <= codePoint && codePoint <= 339 || 358 <= codePoint && codePoint <= 359 || 363 === codePoint || 462 === codePoint || 464 === codePoint || 466 === codePoint || 468 === codePoint || 470 === codePoint || 472 === codePoint || 474 === codePoint || 476 === codePoint || 593 === codePoint || 609 === codePoint || 708 === codePoint || 711 === codePoint || 713 <= codePoint && codePoint <= 715 || 717 === codePoint || 720 === codePoint || 728 <= codePoint && codePoint <= 731 || 733 === codePoint || 735 === codePoint || 768 <= codePoint && codePoint <= 879 || 913 <= codePoint && codePoint <= 929 || 931 <= codePoint && codePoint <= 937 || 945 <= codePoint && codePoint <= 961 || 963 <= codePoint && codePoint <= 969 || 1025 === codePoint || 1040 <= codePoint && codePoint <= 1103 || 1105 === codePoint || 8208 === codePoint || 8211 <= codePoint && codePoint <= 8214 || 8216 <= codePoint && codePoint <= 8217 || 8220 <= codePoint && codePoint <= 8221 || 8224 <= codePoint && codePoint <= 8226 || 8228 <= codePoint && codePoint <= 8231 || 8240 === codePoint || 8242 <= codePoint && codePoint <= 8243 || 8245 === codePoint || 8251 === codePoint || 8254 === codePoint || 8308 === codePoint || 8319 === codePoint || 8321 <= codePoint && codePoint <= 8324 || 8364 === codePoint || 8451 === codePoint || 8453 === codePoint || 8457 === codePoint || 8467 === codePoint || 8470 === codePoint || 8481 <= codePoint && codePoint <= 8482 || 8486 === codePoint || 8491 === codePoint || 8531 <= codePoint && codePoint <= 8532 || 8539 <= codePoint && codePoint <= 8542 || 8544 <= codePoint && codePoint <= 8555 || 8560 <= codePoint && codePoint <= 8569 || 8585 === codePoint || 8592 <= codePoint && codePoint <= 8601 || 8632 <= codePoint && codePoint <= 8633 || 8658 === codePoint || 8660 === codePoint || 8679 === codePoint || 8704 === codePoint || 8706 <= codePoint && codePoint <= 8707 || 8711 <= codePoint && codePoint <= 8712 || 8715 === codePoint || 8719 === codePoint || 8721 === codePoint || 8725 === codePoint || 8730 === codePoint || 8733 <= codePoint && codePoint <= 8736 || 8739 === codePoint || 8741 === codePoint || 8743 <= codePoint && codePoint <= 8748 || 8750 === codePoint || 8756 <= codePoint && codePoint <= 8759 || 8764 <= codePoint && codePoint <= 8765 || 8776 === codePoint || 8780 === codePoint || 8786 === codePoint || 8800 <= codePoint && codePoint <= 8801 || 8804 <= codePoint && codePoint <= 8807 || 8810 <= codePoint && codePoint <= 8811 || 8814 <= codePoint && codePoint <= 8815 || 8834 <= codePoint && codePoint <= 8835 || 8838 <= codePoint && codePoint <= 8839 || 8853 === codePoint || 8857 === codePoint || 8869 === codePoint || 8895 === codePoint || 8978 === codePoint || 9312 <= codePoint && codePoint <= 9449 || 9451 <= codePoint && codePoint <= 9547 || 9552 <= codePoint && codePoint <= 9587 || 9600 <= codePoint && codePoint <= 9615 || 9618 <= codePoint && codePoint <= 9621 || 9632 <= codePoint && codePoint <= 9633 || 9635 <= codePoint && codePoint <= 9641 || 9650 <= codePoint && codePoint <= 9651 || 9654 <= codePoint && codePoint <= 9655 || 9660 <= codePoint && codePoint <= 9661 || 9664 <= codePoint && codePoint <= 9665 || 9670 <= codePoint && codePoint <= 9672 || 9675 === codePoint || 9678 <= codePoint && codePoint <= 9681 || 9698 <= codePoint && codePoint <= 9701 || 9711 === codePoint || 9733 <= codePoint && codePoint <= 9734 || 9737 === codePoint || 9742 <= codePoint && codePoint <= 9743 || 9748 <= codePoint && codePoint <= 9749 || 9756 === codePoint || 9758 === codePoint || 9792 === codePoint || 9794 === codePoint || 9824 <= codePoint && codePoint <= 9825 || 9827 <= codePoint && codePoint <= 9829 || 9831 <= codePoint && codePoint <= 9834 || 9836 <= codePoint && codePoint <= 9837 || 9839 === codePoint || 9886 <= codePoint && codePoint <= 9887 || 9918 <= codePoint && codePoint <= 9919 || 9924 <= codePoint && codePoint <= 9933 || 9935 <= codePoint && codePoint <= 9953 || 9955 === codePoint || 9960 <= codePoint && codePoint <= 9983 || 10045 === codePoint || 10071 === codePoint || 10102 <= codePoint && codePoint <= 10111 || 11093 <= codePoint && codePoint <= 11097 || 12872 <= codePoint && codePoint <= 12879 || 57344 <= codePoint && codePoint <= 63743 || 65024 <= codePoint && codePoint <= 65039 || 65533 === codePoint || 127232 <= codePoint && codePoint <= 127242 || 127248 <= codePoint && codePoint <= 127277 || 127280 <= codePoint && codePoint <= 127337 || 127344 <= codePoint && codePoint <= 127386 || 917760 <= codePoint && codePoint <= 917999 || 983040 <= codePoint && codePoint <= 1048573 || 1048576 <= codePoint && codePoint <= 1114109 ? "A" : "N";
|
|
4200
|
-
};
|
|
4201
|
-
|
|
4202
|
-
function getContextFont$1(text) {
|
|
4203
|
-
var defaultAttr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4204
|
-
var _text$fontStyle = text.fontStyle,
|
|
4205
|
-
fontStyle = _text$fontStyle === void 0 ? defaultAttr.fontStyle : _text$fontStyle,
|
|
4206
|
-
_text$fontVariant = text.fontVariant,
|
|
4207
|
-
fontVariant = _text$fontVariant === void 0 ? defaultAttr.fontVariant : _text$fontVariant,
|
|
4208
|
-
_text$fontWeight = text.fontWeight,
|
|
4209
|
-
fontWeight = _text$fontWeight === void 0 ? defaultAttr.fontWeight : _text$fontWeight,
|
|
4210
|
-
_text$fontSize = text.fontSize,
|
|
4211
|
-
fontSize = _text$fontSize === void 0 ? defaultAttr.fontSize : _text$fontSize,
|
|
4212
|
-
_text$fontFamily = text.fontFamily,
|
|
4213
|
-
fontFamily = _text$fontFamily === void 0 ? defaultAttr.fontFamily : _text$fontFamily;
|
|
4214
|
-
return (fontStyle ? fontStyle + " " : "") + (fontVariant ? fontVariant + " " : "") + (fontWeight ? fontWeight + " " : "") + fontSize + "px " + (fontFamily || "sans-serif");
|
|
4215
|
-
}
|
|
4216
|
-
|
|
4217
|
-
var TextMeasure = /*#__PURE__*/function () {
|
|
4218
|
-
function TextMeasure(option, textSpec) {
|
|
4219
|
-
_classCallCheck(this, TextMeasure);
|
|
4220
|
-
this._numberCharSize = null, this._fullCharSize = null, this._letterCharSize = null, this._specialCharSizeMap = {}, this._canvas = null, this._context = null, this._contextSaved = !1, this._notSupportCanvas = !1, this._notSupportVRender = !1, this._userSpec = {}, this.specialCharSet = "-/: .,@%'\"~", this._option = option, this._userSpec = null != textSpec ? textSpec : {}, this.textSpec = this._initSpec(), isValid$1(option.specialCharSet) && (this.specialCharSet = option.specialCharSet), this._standardMethod = isValid$1(option.getTextBounds) ? this.fullMeasure.bind(this) : this.measureWithNaiveCanvas.bind(this);
|
|
4221
|
-
}
|
|
4222
|
-
_createClass(TextMeasure, [{
|
|
4223
|
-
key: "initContext",
|
|
4224
|
-
value: function initContext() {
|
|
4225
|
-
if (this._notSupportCanvas) return !1;
|
|
4226
|
-
if (isNil$1(this._canvas) && (isValid$1(this._option.getCanvasForMeasure) && (this._canvas = this._option.getCanvasForMeasure()), isNil$1(this._canvas) && "undefined" != typeof window && void 0 !== window.document && isValid$1(globalThis.document) && (this._canvas = globalThis.document.createElement("canvas"))), isNil$1(this._context) && isValid$1(this._canvas)) {
|
|
4227
|
-
var context = this._canvas.getContext("2d");
|
|
4228
|
-
isValid$1(context) && (context.save(), context.font = getContextFont$1(this.textSpec), this._contextSaved = !0, this._context = context);
|
|
4229
|
-
}
|
|
4230
|
-
return !isNil$1(this._context) || (this._notSupportCanvas = !0, !1);
|
|
4231
|
-
}
|
|
4232
|
-
}, {
|
|
4233
|
-
key: "_initSpec",
|
|
4234
|
-
value: function _initSpec() {
|
|
4235
|
-
var _a, _b, _c;
|
|
4236
|
-
var _this$_option$default = this._option.defaultFontParams,
|
|
4237
|
-
defaultFontParams = _this$_option$default === void 0 ? {} : _this$_option$default,
|
|
4238
|
-
_this$_userSpec = this._userSpec,
|
|
4239
|
-
_this$_userSpec$fontS = _this$_userSpec.fontStyle,
|
|
4240
|
-
fontStyle = _this$_userSpec$fontS === void 0 ? defaultFontParams.fontStyle : _this$_userSpec$fontS,
|
|
4241
|
-
_this$_userSpec$fontV = _this$_userSpec.fontVariant,
|
|
4242
|
-
fontVariant = _this$_userSpec$fontV === void 0 ? defaultFontParams.fontVariant : _this$_userSpec$fontV,
|
|
4243
|
-
_this$_userSpec$fontW = _this$_userSpec.fontWeight,
|
|
4244
|
-
fontWeight = _this$_userSpec$fontW === void 0 ? null !== (_a = defaultFontParams.fontWeight) && void 0 !== _a ? _a : "normal" : _this$_userSpec$fontW,
|
|
4245
|
-
_this$_userSpec$fontS2 = _this$_userSpec.fontSize,
|
|
4246
|
-
fontSize = _this$_userSpec$fontS2 === void 0 ? null !== (_b = defaultFontParams.fontSize) && void 0 !== _b ? _b : 12 : _this$_userSpec$fontS2,
|
|
4247
|
-
_this$_userSpec$fontF = _this$_userSpec.fontFamily,
|
|
4248
|
-
fontFamily = _this$_userSpec$fontF === void 0 ? null !== (_c = defaultFontParams.fontFamily) && void 0 !== _c ? _c : "sans-serif" : _this$_userSpec$fontF,
|
|
4249
|
-
align = _this$_userSpec.align,
|
|
4250
|
-
_this$_userSpec$textA = _this$_userSpec.textAlign,
|
|
4251
|
-
textAlign = _this$_userSpec$textA === void 0 ? null != align ? align : "center" : _this$_userSpec$textA,
|
|
4252
|
-
baseline = _this$_userSpec.baseline,
|
|
4253
|
-
_this$_userSpec$textB = _this$_userSpec.textBaseline,
|
|
4254
|
-
textBaseline = _this$_userSpec$textB === void 0 ? null != baseline ? baseline : "middle" : _this$_userSpec$textB,
|
|
4255
|
-
ellipsis = _this$_userSpec.ellipsis,
|
|
4256
|
-
limit = _this$_userSpec.limit,
|
|
4257
|
-
_this$_userSpec$lineH = _this$_userSpec.lineHeight,
|
|
4258
|
-
lineHeight = _this$_userSpec$lineH === void 0 ? fontSize : _this$_userSpec$lineH;
|
|
4259
|
-
return {
|
|
4260
|
-
fontStyle: fontStyle,
|
|
4261
|
-
fontVariant: fontVariant,
|
|
4262
|
-
fontFamily: fontFamily,
|
|
4263
|
-
fontSize: fontSize,
|
|
4264
|
-
fontWeight: fontWeight,
|
|
4265
|
-
textAlign: textAlign,
|
|
4266
|
-
textBaseline: textBaseline,
|
|
4267
|
-
ellipsis: ellipsis,
|
|
4268
|
-
limit: limit,
|
|
4269
|
-
lineHeight: lineHeight
|
|
4270
|
-
};
|
|
4271
|
-
}
|
|
4272
|
-
}, {
|
|
4273
|
-
key: "measure",
|
|
4274
|
-
value: function measure(text, method) {
|
|
4275
|
-
switch (method) {
|
|
4276
|
-
case "vrender":
|
|
4277
|
-
case "canopus":
|
|
4278
|
-
return this.fullMeasure(text);
|
|
4279
|
-
case "canvas":
|
|
4280
|
-
return this.measureWithNaiveCanvas(text);
|
|
4281
|
-
case "simple":
|
|
4282
|
-
return this.quickMeasureWithoutCanvas(text);
|
|
4283
|
-
default:
|
|
4284
|
-
return this.quickMeasure(text);
|
|
4285
|
-
}
|
|
4286
|
-
}
|
|
4287
|
-
}, {
|
|
4288
|
-
key: "fullMeasure",
|
|
4289
|
-
value: function fullMeasure(text) {
|
|
4290
|
-
if (isNil$1(text)) return {
|
|
4291
|
-
width: 0,
|
|
4292
|
-
height: 0
|
|
4293
|
-
};
|
|
4294
|
-
if (isNil$1(this._option.getTextBounds) || !this._notSupportVRender) return this.measureWithNaiveCanvas(text);
|
|
4295
|
-
var _this$textSpec = this.textSpec,
|
|
4296
|
-
fontFamily = _this$textSpec.fontFamily,
|
|
4297
|
-
fontSize = _this$textSpec.fontSize,
|
|
4298
|
-
fontWeight = _this$textSpec.fontWeight,
|
|
4299
|
-
textAlign = _this$textSpec.textAlign,
|
|
4300
|
-
textBaseline = _this$textSpec.textBaseline,
|
|
4301
|
-
ellipsis = _this$textSpec.ellipsis,
|
|
4302
|
-
limit = _this$textSpec.limit,
|
|
4303
|
-
lineHeight = _this$textSpec.lineHeight;
|
|
4304
|
-
var size;
|
|
4305
|
-
try {
|
|
4306
|
-
var bounds = this._option.getTextBounds({
|
|
4307
|
-
text: text,
|
|
4308
|
-
fontFamily: fontFamily,
|
|
4309
|
-
fontSize: fontSize,
|
|
4310
|
-
fontWeight: fontWeight,
|
|
4311
|
-
textAlign: textAlign,
|
|
4312
|
-
textBaseline: textBaseline,
|
|
4313
|
-
ellipsis: !!ellipsis,
|
|
4314
|
-
maxLineWidth: limit || 1 / 0,
|
|
4315
|
-
lineHeight: lineHeight
|
|
4316
|
-
});
|
|
4317
|
-
size = {
|
|
4318
|
-
width: bounds.width(),
|
|
4319
|
-
height: bounds.height()
|
|
4320
|
-
};
|
|
4321
|
-
} catch (e) {
|
|
4322
|
-
this._notSupportVRender = !0, size = this.measureWithNaiveCanvas(text);
|
|
4323
|
-
}
|
|
4324
|
-
return size;
|
|
4325
|
-
}
|
|
4326
|
-
}, {
|
|
4327
|
-
key: "measureWithNaiveCanvas",
|
|
4328
|
-
value: function measureWithNaiveCanvas(text) {
|
|
4329
|
-
return this._measureReduce(text, this._measureWithNaiveCanvas.bind(this));
|
|
4330
|
-
}
|
|
4331
|
-
}, {
|
|
4332
|
-
key: "_measureWithNaiveCanvas",
|
|
4333
|
-
value: function _measureWithNaiveCanvas(text) {
|
|
4334
|
-
if (!this.initContext()) return this._quickMeasureWithoutCanvas(text);
|
|
4335
|
-
var metrics = this._context.measureText(text),
|
|
4336
|
-
_this$textSpec2 = this.textSpec,
|
|
4337
|
-
fontSize = _this$textSpec2.fontSize,
|
|
4338
|
-
lineHeight = _this$textSpec2.lineHeight;
|
|
4339
|
-
return {
|
|
4340
|
-
width: metrics.width,
|
|
4341
|
-
height: null != lineHeight ? lineHeight : fontSize
|
|
4342
|
-
};
|
|
4343
|
-
}
|
|
4344
|
-
}, {
|
|
4345
|
-
key: "quickMeasure",
|
|
4346
|
-
value: function quickMeasure(text) {
|
|
4347
|
-
return this._measureReduce(text, this._quickMeasure.bind(this));
|
|
4348
|
-
}
|
|
4349
|
-
}, {
|
|
4350
|
-
key: "_quickMeasure",
|
|
4351
|
-
value: function _quickMeasure(text) {
|
|
4352
|
-
var totalSize = {
|
|
4353
|
-
width: 0,
|
|
4354
|
-
height: 0
|
|
4355
|
-
};
|
|
4356
|
-
for (var i = 0; i < text.length; i++) {
|
|
4357
|
-
var _char = text[i];
|
|
4358
|
-
var size = this._measureSpecialChar(_char);
|
|
4359
|
-
isNil$1(size) && TextMeasure.NUMBERS_CHAR_SET.includes(_char) && (size = this._measureNumberChar()), isNil$1(size) && ["F", "W"].includes(eastAsianCharacterInfo(_char)) && (size = this._measureFullSizeChar()), isNil$1(size) && (size = this._measureLetterChar()), totalSize.width += size.width, totalSize.height = Math.max(totalSize.height, size.height);
|
|
4360
|
-
}
|
|
4361
|
-
return totalSize;
|
|
4362
|
-
}
|
|
4363
|
-
}, {
|
|
4364
|
-
key: "quickMeasureWithoutCanvas",
|
|
4365
|
-
value: function quickMeasureWithoutCanvas(text) {
|
|
4366
|
-
return this._measureReduce(text, this._quickMeasureWithoutCanvas.bind(this));
|
|
4367
|
-
}
|
|
4368
|
-
}, {
|
|
4369
|
-
key: "_quickMeasureWithoutCanvas",
|
|
4370
|
-
value: function _quickMeasureWithoutCanvas(text) {
|
|
4371
|
-
var totalSize = {
|
|
4372
|
-
width: 0,
|
|
4373
|
-
height: 0
|
|
4374
|
-
},
|
|
4375
|
-
_this$textSpec3 = this.textSpec,
|
|
4376
|
-
fontSize = _this$textSpec3.fontSize,
|
|
4377
|
-
lineHeight = _this$textSpec3.lineHeight;
|
|
4378
|
-
for (var i = 0; i < text.length; i++) {
|
|
4379
|
-
var _char2 = text[i],
|
|
4380
|
-
size = ["F", "W"].includes(eastAsianCharacterInfo(_char2)) ? 1 : .53;
|
|
4381
|
-
totalSize.width += size * fontSize;
|
|
4382
|
-
}
|
|
4383
|
-
return totalSize.height = null != lineHeight ? lineHeight : fontSize, totalSize;
|
|
4384
|
-
}
|
|
4385
|
-
}, {
|
|
4386
|
-
key: "_measureReduce",
|
|
4387
|
-
value: function _measureReduce(text, processor) {
|
|
4388
|
-
var _this$textSpec4 = this.textSpec,
|
|
4389
|
-
fontSize = _this$textSpec4.fontSize,
|
|
4390
|
-
lineHeight = _this$textSpec4.lineHeight,
|
|
4391
|
-
defaultResult = {
|
|
4392
|
-
width: 0,
|
|
4393
|
-
height: 0
|
|
4394
|
-
};
|
|
4395
|
-
if (isNil$1(text)) return defaultResult;
|
|
4396
|
-
if (isArray$1(text)) {
|
|
4397
|
-
var textArr = text.filter(isValid$1).map(function (s) {
|
|
4398
|
-
return s.toString();
|
|
4399
|
-
});
|
|
4400
|
-
return 0 === textArr.length ? defaultResult : 1 === textArr.length ? processor(textArr[0]) : {
|
|
4401
|
-
width: textArr.reduce(function (maxWidth, cur) {
|
|
4402
|
-
return Math.max(maxWidth, processor(cur).width);
|
|
4403
|
-
}, 0),
|
|
4404
|
-
height: textArr.length * ((null != lineHeight ? lineHeight : fontSize) + 1) + 1
|
|
4405
|
-
};
|
|
4406
|
-
}
|
|
4407
|
-
return processor(text.toString());
|
|
4408
|
-
}
|
|
4409
|
-
}, {
|
|
4410
|
-
key: "_measureNumberChar",
|
|
4411
|
-
value: function _measureNumberChar() {
|
|
4412
|
-
if (isNil$1(this._numberCharSize)) {
|
|
4413
|
-
var numberBounds = this._standardMethod(TextMeasure.NUMBERS_CHAR_SET);
|
|
4414
|
-
this._numberCharSize = {
|
|
4415
|
-
width: numberBounds.width / TextMeasure.NUMBERS_CHAR_SET.length,
|
|
4416
|
-
height: numberBounds.height
|
|
4417
|
-
};
|
|
4418
|
-
}
|
|
4419
|
-
return this._numberCharSize;
|
|
4420
|
-
}
|
|
4421
|
-
}, {
|
|
4422
|
-
key: "_measureFullSizeChar",
|
|
4423
|
-
value: function _measureFullSizeChar() {
|
|
4424
|
-
return isNil$1(this._fullCharSize) && (this._fullCharSize = this._standardMethod(TextMeasure.FULL_SIZE_CHAR)), this._fullCharSize;
|
|
4425
|
-
}
|
|
4426
|
-
}, {
|
|
4427
|
-
key: "_measureLetterChar",
|
|
4428
|
-
value: function _measureLetterChar() {
|
|
4429
|
-
if (isNil$1(this._letterCharSize)) {
|
|
4430
|
-
var alphabetBounds = this._standardMethod(TextMeasure.ALPHABET_CHAR_SET);
|
|
4431
|
-
this._letterCharSize = {
|
|
4432
|
-
width: alphabetBounds.width / TextMeasure.ALPHABET_CHAR_SET.length,
|
|
4433
|
-
height: alphabetBounds.height
|
|
4434
|
-
};
|
|
4435
|
-
}
|
|
4436
|
-
return this._letterCharSize;
|
|
4437
|
-
}
|
|
4438
|
-
}, {
|
|
4439
|
-
key: "_measureSpecialChar",
|
|
4440
|
-
value: function _measureSpecialChar(_char3) {
|
|
4441
|
-
return isValid$1(this._specialCharSizeMap[_char3]) ? this._specialCharSizeMap[_char3] : this.specialCharSet.includes(_char3) ? (this._specialCharSizeMap[_char3] = this._standardMethod(_char3), this._specialCharSizeMap[_char3]) : null;
|
|
4442
|
-
}
|
|
4443
|
-
}, {
|
|
4444
|
-
key: "release",
|
|
4445
|
-
value: function release() {
|
|
4446
|
-
isValid$1(this._canvas) && (this._canvas = null), isValid$1(this._context) && (this._contextSaved && (this._context.restore(), this._contextSaved = !1), this._context = null);
|
|
4447
|
-
}
|
|
4448
|
-
}]);
|
|
4449
|
-
return TextMeasure;
|
|
4450
|
-
}();
|
|
4451
|
-
TextMeasure.ALPHABET_CHAR_SET = "abcdefghijklmnopqrstuvwxyz", TextMeasure.NUMBERS_CHAR_SET = "0123456789", TextMeasure.FULL_SIZE_CHAR = "字";
|
|
4452
|
-
|
|
4453
|
-
const circleThreshold = tau - 1e-8;
|
|
2563
|
+
const circleThreshold = vutils.tau - 1e-8;
|
|
4454
2564
|
class BoundsContext {
|
|
4455
2565
|
constructor(bounds) {
|
|
4456
2566
|
this.init(bounds);
|
|
@@ -4491,13 +2601,13 @@
|
|
|
4491
2601
|
update(sa);
|
|
4492
2602
|
update(ea);
|
|
4493
2603
|
if (ea !== sa) {
|
|
4494
|
-
sa = sa % tau;
|
|
2604
|
+
sa = sa % vutils.tau;
|
|
4495
2605
|
if (sa < 0) {
|
|
4496
|
-
sa += tau;
|
|
2606
|
+
sa += vutils.tau;
|
|
4497
2607
|
}
|
|
4498
|
-
ea = ea % tau;
|
|
2608
|
+
ea = ea % vutils.tau;
|
|
4499
2609
|
if (ea < 0) {
|
|
4500
|
-
ea += tau;
|
|
2610
|
+
ea += vutils.tau;
|
|
4501
2611
|
}
|
|
4502
2612
|
if (ea < sa) {
|
|
4503
2613
|
ccw = !ccw;
|
|
@@ -4506,15 +2616,15 @@
|
|
|
4506
2616
|
ea = s;
|
|
4507
2617
|
}
|
|
4508
2618
|
if (ccw) {
|
|
4509
|
-
ea -= tau;
|
|
4510
|
-
s = sa - (sa % halfPi
|
|
4511
|
-
for (i = 0; i < 4 && s > ea; ++i, s -= halfPi
|
|
2619
|
+
ea -= vutils.tau;
|
|
2620
|
+
s = sa - (sa % vutils.halfPi);
|
|
2621
|
+
for (i = 0; i < 4 && s > ea; ++i, s -= vutils.halfPi) {
|
|
4512
2622
|
update(s);
|
|
4513
2623
|
}
|
|
4514
2624
|
}
|
|
4515
2625
|
else {
|
|
4516
|
-
s = sa - (sa % halfPi
|
|
4517
|
-
for (i = 0; i < 4 && s < ea; ++i, s = s + halfPi
|
|
2626
|
+
s = sa - (sa % vutils.halfPi) + vutils.halfPi;
|
|
2627
|
+
for (i = 0; i < 4 && s < ea; ++i, s = s + vutils.halfPi) {
|
|
4518
2628
|
update(s);
|
|
4519
2629
|
}
|
|
4520
2630
|
}
|
|
@@ -4560,7 +2670,7 @@
|
|
|
4560
2670
|
class CurvePath {
|
|
4561
2671
|
constructor() {
|
|
4562
2672
|
this.curves = [];
|
|
4563
|
-
this.bounds = new AABBBounds();
|
|
2673
|
+
this.bounds = new vutils.AABBBounds();
|
|
4564
2674
|
}
|
|
4565
2675
|
getCurveLengths() {
|
|
4566
2676
|
return this.curves.map(curve => curve.getLength());
|
|
@@ -4741,7 +2851,7 @@
|
|
|
4741
2851
|
})(exports.BaseRenderContributionTime || (exports.BaseRenderContributionTime = {}));
|
|
4742
2852
|
|
|
4743
2853
|
function segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) {
|
|
4744
|
-
const th = degreeToRadian(rotateX);
|
|
2854
|
+
const th = vutils.degreeToRadian(rotateX);
|
|
4745
2855
|
const sin_th = Math.sin(th);
|
|
4746
2856
|
const cos_th = Math.cos(th);
|
|
4747
2857
|
rx = Math.abs(rx);
|
|
@@ -4777,12 +2887,12 @@
|
|
|
4777
2887
|
const th1 = Math.atan2(y1 - yc, x1 - xc);
|
|
4778
2888
|
let th_arc = th1 - th0;
|
|
4779
2889
|
if (th_arc < 0 && sweep === 1) {
|
|
4780
|
-
th_arc += tau;
|
|
2890
|
+
th_arc += vutils.tau;
|
|
4781
2891
|
}
|
|
4782
2892
|
else if (th_arc > 0 && sweep === 0) {
|
|
4783
|
-
th_arc -= tau;
|
|
2893
|
+
th_arc -= vutils.tau;
|
|
4784
2894
|
}
|
|
4785
|
-
const segs = Math.ceil(Math.abs(th_arc / (halfPi
|
|
2895
|
+
const segs = Math.ceil(Math.abs(th_arc / (vutils.halfPi + 0.001)));
|
|
4786
2896
|
const result = [];
|
|
4787
2897
|
for (let i = 0; i < segs; ++i) {
|
|
4788
2898
|
const th2 = th0 + (i * th_arc) / segs;
|
|
@@ -4889,7 +2999,7 @@
|
|
|
4889
2999
|
const y = yArr[i];
|
|
4890
3000
|
const nextX = xArr[(i + 1) % count];
|
|
4891
3001
|
const nextY = yArr[(i + 1) % count];
|
|
4892
|
-
totalLength += PointService.distanceNN(x, y, nextX, nextY);
|
|
3002
|
+
totalLength += vutils.PointService.distanceNN(x, y, nextX, nextY);
|
|
4893
3003
|
}
|
|
4894
3004
|
return totalLength / 2;
|
|
4895
3005
|
}
|
|
@@ -4903,17 +3013,17 @@
|
|
|
4903
3013
|
function cubicPointAt(p0, p1, p2, p3, t) {
|
|
4904
3014
|
const x = cubicCalc(p0.x, p1.x, p2.x, p3.x, t);
|
|
4905
3015
|
const y = cubicCalc(p0.y, p1.y, p2.y, p3.y, t);
|
|
4906
|
-
return new Point(x, y);
|
|
3016
|
+
return new vutils.Point(x, y);
|
|
4907
3017
|
}
|
|
4908
3018
|
|
|
4909
3019
|
function divideCubic(curve, t) {
|
|
4910
3020
|
const { p0, p1, p2, p3 } = curve;
|
|
4911
3021
|
const pt = cubicPointAt(p0, p1, p2, p3, t);
|
|
4912
|
-
const c1 = PointService.pointAtPP(p0, p1, t);
|
|
4913
|
-
const c2 = PointService.pointAtPP(p1, p2, t);
|
|
4914
|
-
const c3 = PointService.pointAtPP(p2, p3, t);
|
|
4915
|
-
const c12 = PointService.pointAtPP(c1, c2, t);
|
|
4916
|
-
const c23 = PointService.pointAtPP(c2, c3, t);
|
|
3022
|
+
const c1 = vutils.PointService.pointAtPP(p0, p1, t);
|
|
3023
|
+
const c2 = vutils.PointService.pointAtPP(p1, p2, t);
|
|
3024
|
+
const c3 = vutils.PointService.pointAtPP(p2, p3, t);
|
|
3025
|
+
const c12 = vutils.PointService.pointAtPP(c1, c2, t);
|
|
3026
|
+
const c23 = vutils.PointService.pointAtPP(c2, c3, t);
|
|
4917
3027
|
const curve1 = new CubicBezierCurve(p0, c1, c12, pt);
|
|
4918
3028
|
const curve2 = new CubicBezierCurve(pt, c23, c3, p3);
|
|
4919
3029
|
return [curve1, curve2];
|
|
@@ -4944,25 +3054,25 @@
|
|
|
4944
3054
|
}
|
|
4945
3055
|
calcProjLength(direction) {
|
|
4946
3056
|
if (direction === exports.Direction.ROW) {
|
|
4947
|
-
return abs(this.p0.x - this.p3.x);
|
|
3057
|
+
return vutils.abs(this.p0.x - this.p3.x);
|
|
4948
3058
|
}
|
|
4949
3059
|
else if (direction === exports.Direction.COLUMN) {
|
|
4950
|
-
return abs(this.p0.y - this.p3.y);
|
|
3060
|
+
return vutils.abs(this.p0.y - this.p3.y);
|
|
4951
3061
|
}
|
|
4952
3062
|
return 0;
|
|
4953
3063
|
}
|
|
4954
3064
|
getAngleAt(t) {
|
|
4955
|
-
const minT = max(t - 0.01, 0);
|
|
4956
|
-
const maxT = min(t + 0.01, 1);
|
|
3065
|
+
const minT = vutils.max(t - 0.01, 0);
|
|
3066
|
+
const maxT = vutils.min(t + 0.01, 1);
|
|
4957
3067
|
const minP = this.getPointAt(minT);
|
|
4958
3068
|
const maxP = this.getPointAt(maxT);
|
|
4959
|
-
return atan2(maxP.y - minP.y, maxP.x - minP.x);
|
|
3069
|
+
return vutils.atan2(maxP.y - minP.y, maxP.x - minP.x);
|
|
4960
3070
|
}
|
|
4961
3071
|
}
|
|
4962
3072
|
|
|
4963
3073
|
function divideLinear(curve, t) {
|
|
4964
3074
|
const { p0, p1 } = curve;
|
|
4965
|
-
const c1 = PointService.pointAtPP(p0, p1, t);
|
|
3075
|
+
const c1 = vutils.PointService.pointAtPP(p0, p1, t);
|
|
4966
3076
|
const curve1 = new LineCurve(p0, c1);
|
|
4967
3077
|
const curve2 = new LineCurve(c1, p1);
|
|
4968
3078
|
return [curve1, curve2];
|
|
@@ -4976,13 +3086,13 @@
|
|
|
4976
3086
|
}
|
|
4977
3087
|
getPointAt(t) {
|
|
4978
3088
|
if (this.defined !== false) {
|
|
4979
|
-
return PointService.pointAtPP(this.p0, this.p1, t);
|
|
3089
|
+
return vutils.PointService.pointAtPP(this.p0, this.p1, t);
|
|
4980
3090
|
}
|
|
4981
3091
|
throw new Error('defined为false的点不能getPointAt');
|
|
4982
3092
|
}
|
|
4983
3093
|
getAngleAt(t) {
|
|
4984
3094
|
if (this.angle == null) {
|
|
4985
|
-
this.angle = atan2(this.p1.y - this.p0.y, this.p1.x - this.p0.x);
|
|
3095
|
+
this.angle = vutils.atan2(this.p1.y - this.p0.y, this.p1.x - this.p0.x);
|
|
4986
3096
|
}
|
|
4987
3097
|
return this.angle;
|
|
4988
3098
|
}
|
|
@@ -4991,16 +3101,16 @@
|
|
|
4991
3101
|
}
|
|
4992
3102
|
calcLength() {
|
|
4993
3103
|
if (this._validPoint()) {
|
|
4994
|
-
return PointService.distancePP(this.p0, this.p1);
|
|
3104
|
+
return vutils.PointService.distancePP(this.p0, this.p1);
|
|
4995
3105
|
}
|
|
4996
3106
|
return 60;
|
|
4997
3107
|
}
|
|
4998
3108
|
calcProjLength(direction) {
|
|
4999
3109
|
if (direction === exports.Direction.ROW) {
|
|
5000
|
-
return abs(this.p0.x - this.p1.x);
|
|
3110
|
+
return vutils.abs(this.p0.x - this.p1.x);
|
|
5001
3111
|
}
|
|
5002
3112
|
else if (direction === exports.Direction.COLUMN) {
|
|
5003
|
-
return abs(this.p0.y - this.p1.y);
|
|
3113
|
+
return vutils.abs(this.p0.y - this.p1.y);
|
|
5004
3114
|
}
|
|
5005
3115
|
return 0;
|
|
5006
3116
|
}
|
|
@@ -5023,7 +3133,7 @@
|
|
|
5023
3133
|
this.curves = [];
|
|
5024
3134
|
}
|
|
5025
3135
|
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, defined, p) {
|
|
5026
|
-
const curve = new CubicBezierCurve(new Point(this._lastX, this._lastY), new Point(cp1x, cp1y), new Point(cp2x, cp2y), new Point(x, y));
|
|
3136
|
+
const curve = new CubicBezierCurve(new vutils.Point(this._lastX, this._lastY), new vutils.Point(cp1x, cp1y), new vutils.Point(cp2x, cp2y), new vutils.Point(x, y));
|
|
5027
3137
|
curve.originP1 = this._lastOriginP;
|
|
5028
3138
|
curve.originP2 = p;
|
|
5029
3139
|
curve.defined = defined;
|
|
@@ -5067,7 +3177,7 @@
|
|
|
5067
3177
|
return this.getLength(direction);
|
|
5068
3178
|
}
|
|
5069
3179
|
addLinearCurve(x, y, defined, p1, p2) {
|
|
5070
|
-
const curve = new LineCurve(new Point(this._lastX, this._lastY), new Point(x, y));
|
|
3180
|
+
const curve = new LineCurve(new vutils.Point(this._lastX, this._lastY), new vutils.Point(x, y));
|
|
5071
3181
|
curve.originP1 = p1;
|
|
5072
3182
|
curve.originP2 = p2;
|
|
5073
3183
|
curve.defined = defined;
|
|
@@ -5088,7 +3198,7 @@
|
|
|
5088
3198
|
const sc = this.curves[0];
|
|
5089
3199
|
const ec = this.curves[this.curves.length - 1];
|
|
5090
3200
|
const endP = (_a = ec.p3) !== null && _a !== void 0 ? _a : ec.p1;
|
|
5091
|
-
return abs(sc.p0.y - endP.y);
|
|
3201
|
+
return vutils.abs(sc.p0.y - endP.y);
|
|
5092
3202
|
}
|
|
5093
3203
|
else if (direction === exports.Direction.ROW) {
|
|
5094
3204
|
if (!this.curves.length) {
|
|
@@ -5097,7 +3207,7 @@
|
|
|
5097
3207
|
const sc = this.curves[0];
|
|
5098
3208
|
const ec = this.curves[this.curves.length - 1];
|
|
5099
3209
|
const endP = (_b = ec.p3) !== null && _b !== void 0 ? _b : ec.p1;
|
|
5100
|
-
return abs(sc.p0.x - endP.x);
|
|
3210
|
+
return vutils.abs(sc.p0.x - endP.x);
|
|
5101
3211
|
}
|
|
5102
3212
|
if (Number.isFinite(this.length)) {
|
|
5103
3213
|
return this.length;
|
|
@@ -5186,7 +3296,7 @@
|
|
|
5186
3296
|
if (points.length < 2 - Number(!!startPoint)) {
|
|
5187
3297
|
return null;
|
|
5188
3298
|
}
|
|
5189
|
-
const segContext = new SegContext('linear', direction !== null && direction !== void 0 ? direction : (abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y)
|
|
3299
|
+
const segContext = new SegContext('linear', direction !== null && direction !== void 0 ? direction : (vutils.abs(points[points.length - 1].x - points[0].x) > vutils.abs(points[points.length - 1].y - points[0].y)
|
|
5190
3300
|
? exports.Direction.ROW
|
|
5191
3301
|
: exports.Direction.COLUMN));
|
|
5192
3302
|
const linear = new Linear(segContext, startPoint);
|
|
@@ -5265,7 +3375,7 @@
|
|
|
5265
3375
|
if (points.length < 3 - Number(!!startPoint)) {
|
|
5266
3376
|
return genLinearSegments(points, params);
|
|
5267
3377
|
}
|
|
5268
|
-
const segContext = new SegContext('basis', direction !== null && direction !== void 0 ? direction : (abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y)
|
|
3378
|
+
const segContext = new SegContext('basis', direction !== null && direction !== void 0 ? direction : (vutils.abs(points[points.length - 1].x - points[0].x) > vutils.abs(points[points.length - 1].y - points[0].y)
|
|
5269
3379
|
? exports.Direction.ROW
|
|
5270
3380
|
: exports.Direction.COLUMN));
|
|
5271
3381
|
const basis = new Basis(segContext, startPoint);
|
|
@@ -5382,7 +3492,7 @@
|
|
|
5382
3492
|
if (points.length < 3 - Number(!!startPoint)) {
|
|
5383
3493
|
return genLinearSegments(points, params);
|
|
5384
3494
|
}
|
|
5385
|
-
const segContext = new SegContext('monotoneX', direction !== null && direction !== void 0 ? direction : (abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y)
|
|
3495
|
+
const segContext = new SegContext('monotoneX', direction !== null && direction !== void 0 ? direction : (vutils.abs(points[points.length - 1].x - points[0].x) > vutils.abs(points[points.length - 1].y - points[0].y)
|
|
5386
3496
|
? exports.Direction.ROW
|
|
5387
3497
|
: exports.Direction.COLUMN));
|
|
5388
3498
|
const monotoneX = new MonotoneX(segContext, startPoint);
|
|
@@ -5400,7 +3510,7 @@
|
|
|
5400
3510
|
if (points.length < 3 - Number(!!startPoint)) {
|
|
5401
3511
|
return genLinearSegments(points, params);
|
|
5402
3512
|
}
|
|
5403
|
-
const segContext = new ReflectSegContext('monotoneY', direction !== null && direction !== void 0 ? direction : (abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y)
|
|
3513
|
+
const segContext = new ReflectSegContext('monotoneY', direction !== null && direction !== void 0 ? direction : (vutils.abs(points[points.length - 1].x - points[0].x) > vutils.abs(points[points.length - 1].y - points[0].y)
|
|
5404
3514
|
? exports.Direction.ROW
|
|
5405
3515
|
: exports.Direction.COLUMN));
|
|
5406
3516
|
const monotoneY = new MonotoneY(segContext, startPoint);
|
|
@@ -5474,7 +3584,7 @@
|
|
|
5474
3584
|
if (points.length < 2 - Number(!!startPoint)) {
|
|
5475
3585
|
return null;
|
|
5476
3586
|
}
|
|
5477
|
-
const segContext = new SegContext('step', direction !== null && direction !== void 0 ? direction : (abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y)
|
|
3587
|
+
const segContext = new SegContext('step', direction !== null && direction !== void 0 ? direction : (vutils.abs(points[points.length - 1].x - points[0].x) > vutils.abs(points[points.length - 1].y - points[0].y)
|
|
5478
3588
|
? exports.Direction.ROW
|
|
5479
3589
|
: exports.Direction.COLUMN));
|
|
5480
3590
|
const step = new Step$1(segContext, t, startPoint);
|
|
@@ -5530,7 +3640,7 @@
|
|
|
5530
3640
|
if (points.length < 2 - Number(!!startPoint)) {
|
|
5531
3641
|
return null;
|
|
5532
3642
|
}
|
|
5533
|
-
const segContext = new SegContext('linear', direction !== null && direction !== void 0 ? direction : (abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y)
|
|
3643
|
+
const segContext = new SegContext('linear', direction !== null && direction !== void 0 ? direction : (vutils.abs(points[points.length - 1].x - points[0].x) > vutils.abs(points[points.length - 1].y - points[0].y)
|
|
5534
3644
|
? exports.Direction.ROW
|
|
5535
3645
|
: exports.Direction.COLUMN));
|
|
5536
3646
|
const linear = new LinearClosed(segContext, startPoint);
|
|
@@ -5558,14 +3668,14 @@
|
|
|
5558
3668
|
this._lastY = y;
|
|
5559
3669
|
}
|
|
5560
3670
|
addLinearCurve(x, y) {
|
|
5561
|
-
const curve = new LineCurve(new Point(this._lastX, this._lastY), new Point(x, y));
|
|
3671
|
+
const curve = new LineCurve(new vutils.Point(this._lastX, this._lastY), new vutils.Point(x, y));
|
|
5562
3672
|
return curve;
|
|
5563
3673
|
}
|
|
5564
3674
|
quadraticCurveTo(aCPx, aCPy, aX, aY) {
|
|
5565
3675
|
throw new Error('CurveContext不支持调用quadraticCurveTo');
|
|
5566
3676
|
}
|
|
5567
3677
|
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) {
|
|
5568
|
-
const curve = new CubicBezierCurve(new Point(this._lastX, this._lastY), new Point(cp1x, cp1y), new Point(cp2x, cp2y), new Point(x, y));
|
|
3678
|
+
const curve = new CubicBezierCurve(new vutils.Point(this._lastX, this._lastY), new vutils.Point(cp1x, cp1y), new vutils.Point(cp2x, cp2y), new vutils.Point(x, y));
|
|
5569
3679
|
this.path.curves.push(curve);
|
|
5570
3680
|
this._lastX = x;
|
|
5571
3681
|
this._lastY = y;
|
|
@@ -6032,7 +4142,7 @@
|
|
|
6032
4142
|
}
|
|
6033
4143
|
const sc = this.curves[0];
|
|
6034
4144
|
const ec = this.curves[this.curves.length - 1];
|
|
6035
|
-
return abs(sc.p0.y - ec.p1.y);
|
|
4145
|
+
return vutils.abs(sc.p0.y - ec.p1.y);
|
|
6036
4146
|
}
|
|
6037
4147
|
else if (this.direction === exports.Direction.ROW) {
|
|
6038
4148
|
if (!this.curves.length) {
|
|
@@ -6040,7 +4150,7 @@
|
|
|
6040
4150
|
}
|
|
6041
4151
|
const sc = this.curves[0];
|
|
6042
4152
|
const ec = this.curves[this.curves.length - 1];
|
|
6043
|
-
return abs(sc.p0.x - ec.p1.x);
|
|
4153
|
+
return vutils.abs(sc.p0.x - ec.p1.x);
|
|
6044
4154
|
}
|
|
6045
4155
|
return this.curves.reduce((l, c) => l + c.getLength(), 0);
|
|
6046
4156
|
}
|
|
@@ -6113,7 +4223,7 @@
|
|
|
6113
4223
|
scaleCenter: [0, 0],
|
|
6114
4224
|
anchor: [0, 0],
|
|
6115
4225
|
anchor3d: [0, 0],
|
|
6116
|
-
postMatrix: new Matrix()
|
|
4226
|
+
postMatrix: new vutils.Matrix()
|
|
6117
4227
|
};
|
|
6118
4228
|
const DefaultFillStyle = {
|
|
6119
4229
|
fillOpacity: 1,
|
|
@@ -6175,9 +4285,9 @@
|
|
|
6175
4285
|
function rewriteProto(obj, c) {
|
|
6176
4286
|
Object.setPrototypeOf(obj, c);
|
|
6177
4287
|
}
|
|
6178
|
-
const DefaultArcAttribute = Object.assign(Object.assign({}, DefaultAttribute), { startAngle: 0, endAngle: pi2, innerRadius: 0, outerRadius: 1, cornerRadius: 0, padRadius: 0, padAngle: 0, cap: false, forceShowCap: false });
|
|
4288
|
+
const DefaultArcAttribute = Object.assign(Object.assign({}, DefaultAttribute), { startAngle: 0, endAngle: vutils.pi2, innerRadius: 0, outerRadius: 1, cornerRadius: 0, padRadius: 0, padAngle: 0, cap: false, forceShowCap: false });
|
|
6179
4289
|
const DefaultAreaAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultConnectAttribute), { points: [], segments: [], curveType: 'linear', clipRange: 1, closePath: false });
|
|
6180
|
-
const DefaultCircleAttribute = Object.assign(Object.assign({}, DefaultAttribute), { radius: 1, startAngle: 0, endAngle: pi2 });
|
|
4290
|
+
const DefaultCircleAttribute = Object.assign(Object.assign({}, DefaultAttribute), { radius: 1, startAngle: 0, endAngle: vutils.pi2 });
|
|
6181
4291
|
const DefaultGroupAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, cornerRadius: 0, path: [], clip: false, visibleAll: true, display: 'relative', flexDirection: 'row', flexWrap: 'wrap', justifyContent: 'flex-start', alignItems: 'flex-start', alignContent: 'flex-start' });
|
|
6182
4292
|
const DefaultGlyphAttribute = Object.assign(Object.assign({}, DefaultAttribute), { path: '', width: 0, height: 0, cornerRadius: 0, clip: false });
|
|
6183
4293
|
const DefaultLineAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultConnectAttribute), { points: [], segments: [], curveType: 'linear', clipRange: 1, clipRangeByDimension: 'default', closePath: false });
|
|
@@ -6746,9 +4856,9 @@
|
|
|
6746
4856
|
return Math.sqrt(d);
|
|
6747
4857
|
}
|
|
6748
4858
|
function normalizeRadian(angle) {
|
|
6749
|
-
angle %= pi2;
|
|
4859
|
+
angle %= vutils.pi2;
|
|
6750
4860
|
if (angle < 0) {
|
|
6751
|
-
angle += pi2;
|
|
4861
|
+
angle += vutils.pi2;
|
|
6752
4862
|
}
|
|
6753
4863
|
return angle;
|
|
6754
4864
|
}
|
|
@@ -6806,7 +4916,7 @@
|
|
|
6806
4916
|
if (d - _l > r || d + _l < r) {
|
|
6807
4917
|
return false;
|
|
6808
4918
|
}
|
|
6809
|
-
if (Math.abs(startAngle - endAngle) % pi2 < 1e-4) {
|
|
4919
|
+
if (Math.abs(startAngle - endAngle) % vutils.pi2 < 1e-4) {
|
|
6810
4920
|
return true;
|
|
6811
4921
|
}
|
|
6812
4922
|
if (anticlockwise) {
|
|
@@ -6819,13 +4929,13 @@
|
|
|
6819
4929
|
endAngle = normalizeRadian(endAngle);
|
|
6820
4930
|
}
|
|
6821
4931
|
if (startAngle > endAngle) {
|
|
6822
|
-
endAngle += pi2;
|
|
4932
|
+
endAngle += vutils.pi2;
|
|
6823
4933
|
}
|
|
6824
4934
|
let angle = Math.atan2(y, x);
|
|
6825
4935
|
if (angle < 0) {
|
|
6826
|
-
angle += pi2;
|
|
4936
|
+
angle += vutils.pi2;
|
|
6827
4937
|
}
|
|
6828
|
-
return (angle >= startAngle && angle <= endAngle) || (angle + pi2 >= startAngle && angle + pi2 <= endAngle);
|
|
4938
|
+
return (angle >= startAngle && angle <= endAngle) || (angle + vutils.pi2 >= startAngle && angle + vutils.pi2 <= endAngle);
|
|
6829
4939
|
}
|
|
6830
4940
|
function containLineStroke(x0, y0, x1, y1, lineWidth, x, y) {
|
|
6831
4941
|
if (lineWidth === 0) {
|
|
@@ -7067,9 +5177,9 @@
|
|
|
7067
5177
|
if (dTheta < 1e-4) {
|
|
7068
5178
|
return 0;
|
|
7069
5179
|
}
|
|
7070
|
-
if (dTheta >= pi2 - 1e-4) {
|
|
5180
|
+
if (dTheta >= vutils.pi2 - 1e-4) {
|
|
7071
5181
|
startAngle = 0;
|
|
7072
|
-
endAngle = pi2;
|
|
5182
|
+
endAngle = vutils.pi2;
|
|
7073
5183
|
const dir = anticlockwise ? 1 : -1;
|
|
7074
5184
|
if (x >= roots[0] + cx && x <= roots[1] + cx) {
|
|
7075
5185
|
return dir;
|
|
@@ -7082,8 +5192,8 @@
|
|
|
7082
5192
|
endAngle = tmp;
|
|
7083
5193
|
}
|
|
7084
5194
|
if (startAngle < 0) {
|
|
7085
|
-
startAngle += pi2;
|
|
7086
|
-
endAngle += pi2;
|
|
5195
|
+
startAngle += vutils.pi2;
|
|
5196
|
+
endAngle += vutils.pi2;
|
|
7087
5197
|
}
|
|
7088
5198
|
let w = 0;
|
|
7089
5199
|
for (let i = 0; i < 2; i++) {
|
|
@@ -7092,10 +5202,10 @@
|
|
|
7092
5202
|
let angle = Math.atan2(y, x_);
|
|
7093
5203
|
let dir = anticlockwise ? 1 : -1;
|
|
7094
5204
|
if (angle < 0) {
|
|
7095
|
-
angle = pi2 + angle;
|
|
5205
|
+
angle = vutils.pi2 + angle;
|
|
7096
5206
|
}
|
|
7097
|
-
if ((angle >= startAngle && angle <= endAngle) || (angle + pi2 >= startAngle && angle + pi2 <= endAngle)) {
|
|
7098
|
-
if (angle > pi / 2 && angle < pi * 1.5) {
|
|
5207
|
+
if ((angle >= startAngle && angle <= endAngle) || (angle + vutils.pi2 >= startAngle && angle + vutils.pi2 <= endAngle)) {
|
|
5208
|
+
if (angle > vutils.pi / 2 && angle < vutils.pi * 1.5) {
|
|
7099
5209
|
dir = -dir;
|
|
7100
5210
|
}
|
|
7101
5211
|
w += dir;
|
|
@@ -7105,28 +5215,28 @@
|
|
|
7105
5215
|
return w;
|
|
7106
5216
|
}
|
|
7107
5217
|
function modpi2(radian) {
|
|
7108
|
-
const n = Math.round((radian / pi) * 1e8) / 1e8;
|
|
7109
|
-
return (n % 2) * pi;
|
|
5218
|
+
const n = Math.round((radian / vutils.pi) * 1e8) / 1e8;
|
|
5219
|
+
return (n % 2) * vutils.pi;
|
|
7110
5220
|
}
|
|
7111
5221
|
function normalizeArcAngles(angles, anticlockwise) {
|
|
7112
5222
|
let newStartAngle = modpi2(angles[0]);
|
|
7113
5223
|
if (newStartAngle < 0) {
|
|
7114
|
-
newStartAngle += pi2;
|
|
5224
|
+
newStartAngle += vutils.pi2;
|
|
7115
5225
|
}
|
|
7116
5226
|
const delta = newStartAngle - angles[0];
|
|
7117
5227
|
let newEndAngle = angles[1];
|
|
7118
5228
|
newEndAngle += delta;
|
|
7119
|
-
if (!anticlockwise && newEndAngle - newStartAngle >= pi2) {
|
|
7120
|
-
newEndAngle = newStartAngle + pi2;
|
|
5229
|
+
if (!anticlockwise && newEndAngle - newStartAngle >= vutils.pi2) {
|
|
5230
|
+
newEndAngle = newStartAngle + vutils.pi2;
|
|
7121
5231
|
}
|
|
7122
|
-
else if (anticlockwise && newStartAngle - newEndAngle >= pi2) {
|
|
7123
|
-
newEndAngle = newStartAngle - pi2;
|
|
5232
|
+
else if (anticlockwise && newStartAngle - newEndAngle >= vutils.pi2) {
|
|
5233
|
+
newEndAngle = newStartAngle - vutils.pi2;
|
|
7124
5234
|
}
|
|
7125
5235
|
else if (!anticlockwise && newStartAngle > newEndAngle) {
|
|
7126
|
-
newEndAngle = newStartAngle + (pi2 - modpi2(newStartAngle - newEndAngle));
|
|
5236
|
+
newEndAngle = newStartAngle + (vutils.pi2 - modpi2(newStartAngle - newEndAngle));
|
|
7127
5237
|
}
|
|
7128
5238
|
else if (anticlockwise && newStartAngle < newEndAngle) {
|
|
7129
|
-
newEndAngle = newStartAngle - (pi2 - modpi2(newEndAngle - newStartAngle));
|
|
5239
|
+
newEndAngle = newStartAngle - (vutils.pi2 - modpi2(newEndAngle - newStartAngle));
|
|
7130
5240
|
}
|
|
7131
5241
|
angles[0] = newStartAngle;
|
|
7132
5242
|
angles[1] = newEndAngle;
|
|
@@ -7329,10 +5439,10 @@
|
|
|
7329
5439
|
}
|
|
7330
5440
|
createTextMeasureInstance(textSpec, option, getCanvasForMeasure) {
|
|
7331
5441
|
this.configure(this.global, this.global.env);
|
|
7332
|
-
return new TextMeasure(Object.assign({ defaultFontParams: {
|
|
5442
|
+
return new vutils.TextMeasure(Object.assign({ defaultFontParams: {
|
|
7333
5443
|
fontFamily: DefaultTextStyle.fontFamily,
|
|
7334
5444
|
fontSize: DefaultTextStyle.fontSize
|
|
7335
|
-
}, getCanvasForMeasure: getCanvasForMeasure || (() => this.canvas), getTextBounds: undefined, specialCharSet: '-/: .,@%\'"~' + TextMeasure.ALPHABET_CHAR_SET + TextMeasure.ALPHABET_CHAR_SET.toUpperCase() }, (option !== null && option !== void 0 ? option : {})), textSpec);
|
|
5445
|
+
}, getCanvasForMeasure: getCanvasForMeasure || (() => this.canvas), getTextBounds: undefined, specialCharSet: '-/: .,@%\'"~' + vutils.TextMeasure.ALPHABET_CHAR_SET + vutils.TextMeasure.ALPHABET_CHAR_SET.toUpperCase() }, (option !== null && option !== void 0 ? option : {})), textSpec);
|
|
7336
5446
|
}
|
|
7337
5447
|
};
|
|
7338
5448
|
exports.DefaultGraphicUtil = __decorate([
|
|
@@ -7347,10 +5457,10 @@
|
|
|
7347
5457
|
TransformMode[TransformMode["transform"] = 0] = "transform";
|
|
7348
5458
|
TransformMode[TransformMode["matrix"] = 1] = "matrix";
|
|
7349
5459
|
})(TransformMode || (TransformMode = {}));
|
|
7350
|
-
const _matrix = new Matrix();
|
|
5460
|
+
const _matrix = new vutils.Matrix();
|
|
7351
5461
|
exports.DefaultTransformUtil = class DefaultTransformUtil {
|
|
7352
5462
|
constructor() {
|
|
7353
|
-
this.matrix = new Matrix();
|
|
5463
|
+
this.matrix = new vutils.Matrix();
|
|
7354
5464
|
}
|
|
7355
5465
|
init(origin) {
|
|
7356
5466
|
this.mode = TransformMode.transform;
|
|
@@ -7545,7 +5655,7 @@
|
|
|
7545
5655
|
parentTheme.applyTheme(parentGroup, pt, true);
|
|
7546
5656
|
}
|
|
7547
5657
|
if (!this.userTheme) {
|
|
7548
|
-
this.userTheme = clone(parentTheme.userTheme);
|
|
5658
|
+
this.userTheme = vutils.clone(parentTheme.userTheme);
|
|
7549
5659
|
}
|
|
7550
5660
|
else {
|
|
7551
5661
|
combineTheme(this.userTheme, parentTheme.userTheme, false);
|
|
@@ -7674,7 +5784,7 @@
|
|
|
7674
5784
|
}
|
|
7675
5785
|
Generator.auto_increment_id = 0;
|
|
7676
5786
|
|
|
7677
|
-
class Node extends EventEmitter {
|
|
5787
|
+
class Node extends vutils.EventEmitter {
|
|
7678
5788
|
get previousSibling() {
|
|
7679
5789
|
return this._prev;
|
|
7680
5790
|
}
|
|
@@ -8175,11 +6285,11 @@
|
|
|
8175
6285
|
return this.removeChild(child);
|
|
8176
6286
|
}
|
|
8177
6287
|
addEventListener(type, listener, options) {
|
|
8178
|
-
const capture = (isBoolean
|
|
8179
|
-
const once = isObject
|
|
8180
|
-
const context = isFunction
|
|
6288
|
+
const capture = (vutils.isBoolean(options, true) && options) || (vutils.isObject(options) && options.capture);
|
|
6289
|
+
const once = vutils.isObject(options) && options.once;
|
|
6290
|
+
const context = vutils.isFunction(listener) ? undefined : listener;
|
|
8181
6291
|
type = capture ? `${type}capture` : type;
|
|
8182
|
-
listener = isFunction
|
|
6292
|
+
listener = vutils.isFunction(listener) ? listener : listener.handleEvent;
|
|
8183
6293
|
if (once) {
|
|
8184
6294
|
super.once(type, listener, context);
|
|
8185
6295
|
}
|
|
@@ -8192,11 +6302,11 @@
|
|
|
8192
6302
|
return this.addEventListener(type, listener, options);
|
|
8193
6303
|
}
|
|
8194
6304
|
removeEventListener(type, listener, options) {
|
|
8195
|
-
const capture = (isBoolean
|
|
8196
|
-
const context = isFunction
|
|
6305
|
+
const capture = (vutils.isBoolean(options, true) && options) || (vutils.isObject(options) && options.capture);
|
|
6306
|
+
const context = vutils.isFunction(listener) ? undefined : listener;
|
|
8197
6307
|
type = capture ? `${type}capture` : type;
|
|
8198
|
-
listener = isFunction
|
|
8199
|
-
const once = isObject
|
|
6308
|
+
listener = vutils.isFunction(listener) ? listener : listener.handleEvent;
|
|
6309
|
+
const once = vutils.isObject(options) && options.once;
|
|
8200
6310
|
super.off(type, listener, context, once);
|
|
8201
6311
|
return this;
|
|
8202
6312
|
}
|
|
@@ -8204,7 +6314,7 @@
|
|
|
8204
6314
|
return this.removeEventListener(type, listener, options);
|
|
8205
6315
|
}
|
|
8206
6316
|
once(type, listener, options) {
|
|
8207
|
-
if (isObject
|
|
6317
|
+
if (vutils.isObject(options)) {
|
|
8208
6318
|
options.once = true;
|
|
8209
6319
|
return this.addEventListener(type, listener, options);
|
|
8210
6320
|
}
|
|
@@ -8269,10 +6379,10 @@
|
|
|
8269
6379
|
this.eventPhase = FederatedEvent.prototype.NONE;
|
|
8270
6380
|
this.propagationStopped = false;
|
|
8271
6381
|
this.propagationImmediatelyStopped = false;
|
|
8272
|
-
this.layer = new Point();
|
|
8273
|
-
this.page = new Point();
|
|
8274
|
-
this.canvas = new Point();
|
|
8275
|
-
this.viewport = new Point();
|
|
6382
|
+
this.layer = new vutils.Point();
|
|
6383
|
+
this.page = new vutils.Point();
|
|
6384
|
+
this.canvas = new vutils.Point();
|
|
6385
|
+
this.viewport = new vutils.Point();
|
|
8276
6386
|
this.NONE = 0;
|
|
8277
6387
|
this.CAPTURING_PHASE = 1;
|
|
8278
6388
|
this.AT_TARGET = 2;
|
|
@@ -8311,11 +6421,11 @@
|
|
|
8311
6421
|
class FederatedMouseEvent extends FederatedEvent {
|
|
8312
6422
|
constructor() {
|
|
8313
6423
|
super(...arguments);
|
|
8314
|
-
this.client = new Point();
|
|
8315
|
-
this.movement = new Point();
|
|
8316
|
-
this.offset = new Point();
|
|
8317
|
-
this.global = new Point();
|
|
8318
|
-
this.screen = new Point();
|
|
6424
|
+
this.client = new vutils.Point();
|
|
6425
|
+
this.movement = new vutils.Point();
|
|
6426
|
+
this.offset = new vutils.Point();
|
|
6427
|
+
this.global = new vutils.Point();
|
|
6428
|
+
this.screen = new vutils.Point();
|
|
8319
6429
|
}
|
|
8320
6430
|
get clientX() {
|
|
8321
6431
|
return this.client.x;
|
|
@@ -8437,7 +6547,7 @@
|
|
|
8437
6547
|
}
|
|
8438
6548
|
class EventManager {
|
|
8439
6549
|
constructor(root) {
|
|
8440
|
-
this.dispatch = new EventEmitter();
|
|
6550
|
+
this.dispatch = new vutils.EventEmitter();
|
|
8441
6551
|
this.mappingState = {
|
|
8442
6552
|
trackingData: {}
|
|
8443
6553
|
};
|
|
@@ -8987,7 +7097,7 @@
|
|
|
8987
7097
|
else if (pickResult && pickResult.group) {
|
|
8988
7098
|
target = pickResult.group;
|
|
8989
7099
|
}
|
|
8990
|
-
else if (x >= 0 && x <= get
|
|
7100
|
+
else if (x >= 0 && x <= vutils.get(this.rootTarget, 'width') && y >= 0 && y <= vutils.get(this.rootTarget, 'height')) {
|
|
8991
7101
|
target = this.rootTarget;
|
|
8992
7102
|
}
|
|
8993
7103
|
else {
|
|
@@ -9130,7 +7240,7 @@
|
|
|
9130
7240
|
Object.assign(domElement.style, style);
|
|
9131
7241
|
}
|
|
9132
7242
|
}
|
|
9133
|
-
else if (applyStyles && isString
|
|
7243
|
+
else if (applyStyles && vutils.isString(mode) && !vutils.has(this.cursorStyles, mode)) {
|
|
9134
7244
|
domElement.style.cursor = mode;
|
|
9135
7245
|
}
|
|
9136
7246
|
}
|
|
@@ -9248,46 +7358,46 @@
|
|
|
9248
7358
|
event.changedTouches.length) {
|
|
9249
7359
|
for (let i = 0, li = event.changedTouches.length; i < li; i++) {
|
|
9250
7360
|
const touch = event.changedTouches[i];
|
|
9251
|
-
if (isUndefined
|
|
7361
|
+
if (vutils.isUndefined(touch.button)) {
|
|
9252
7362
|
touch.button = 0;
|
|
9253
7363
|
}
|
|
9254
|
-
if (isUndefined
|
|
7364
|
+
if (vutils.isUndefined(touch.buttons)) {
|
|
9255
7365
|
touch.buttons = 1;
|
|
9256
7366
|
}
|
|
9257
|
-
if (isUndefined
|
|
7367
|
+
if (vutils.isUndefined(touch.isPrimary)) {
|
|
9258
7368
|
touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart';
|
|
9259
7369
|
}
|
|
9260
|
-
if (isUndefined
|
|
7370
|
+
if (vutils.isUndefined(touch.width)) {
|
|
9261
7371
|
touch.width = touch.radiusX || 1;
|
|
9262
7372
|
}
|
|
9263
|
-
if (isUndefined
|
|
7373
|
+
if (vutils.isUndefined(touch.height)) {
|
|
9264
7374
|
touch.height = touch.radiusY || 1;
|
|
9265
7375
|
}
|
|
9266
|
-
if (isUndefined
|
|
7376
|
+
if (vutils.isUndefined(touch.tiltX)) {
|
|
9267
7377
|
touch.tiltX = 0;
|
|
9268
7378
|
}
|
|
9269
|
-
if (isUndefined
|
|
7379
|
+
if (vutils.isUndefined(touch.tiltY)) {
|
|
9270
7380
|
touch.tiltY = 0;
|
|
9271
7381
|
}
|
|
9272
|
-
if (isUndefined
|
|
7382
|
+
if (vutils.isUndefined(touch.pointerType)) {
|
|
9273
7383
|
touch.pointerType = 'touch';
|
|
9274
7384
|
}
|
|
9275
|
-
if (isUndefined
|
|
7385
|
+
if (vutils.isUndefined(touch.pointerId)) {
|
|
9276
7386
|
touch.pointerId = touch.identifier || 0;
|
|
9277
7387
|
}
|
|
9278
|
-
if (isUndefined
|
|
7388
|
+
if (vutils.isUndefined(touch.pressure)) {
|
|
9279
7389
|
touch.pressure = touch.force || 0.5;
|
|
9280
7390
|
}
|
|
9281
|
-
if (isUndefined
|
|
7391
|
+
if (vutils.isUndefined(touch.twist)) {
|
|
9282
7392
|
touch.twist = 0;
|
|
9283
7393
|
}
|
|
9284
|
-
if (isUndefined
|
|
7394
|
+
if (vutils.isUndefined(touch.tangentialPressure)) {
|
|
9285
7395
|
touch.tangentialPressure = 0;
|
|
9286
7396
|
}
|
|
9287
|
-
if (isUndefined
|
|
7397
|
+
if (vutils.isUndefined(touch.layerX)) {
|
|
9288
7398
|
touch.layerX = touch.offsetX = touch.clientX;
|
|
9289
7399
|
}
|
|
9290
|
-
if (isUndefined
|
|
7400
|
+
if (vutils.isUndefined(touch.layerY)) {
|
|
9291
7401
|
touch.layerY = touch.offsetY = touch.clientY;
|
|
9292
7402
|
}
|
|
9293
7403
|
touch.isNormalized = true;
|
|
@@ -9298,34 +7408,34 @@
|
|
|
9298
7408
|
else if (!this.globalObj.supportsMouseEvents ||
|
|
9299
7409
|
(event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof PointerEvent)))) {
|
|
9300
7410
|
const tempEvent = event;
|
|
9301
|
-
if (isUndefined
|
|
7411
|
+
if (vutils.isUndefined(tempEvent.isPrimary)) {
|
|
9302
7412
|
tempEvent.isPrimary = true;
|
|
9303
7413
|
}
|
|
9304
|
-
if (isUndefined
|
|
7414
|
+
if (vutils.isUndefined(tempEvent.width)) {
|
|
9305
7415
|
tempEvent.width = 1;
|
|
9306
7416
|
}
|
|
9307
|
-
if (isUndefined
|
|
7417
|
+
if (vutils.isUndefined(tempEvent.height)) {
|
|
9308
7418
|
tempEvent.height = 1;
|
|
9309
7419
|
}
|
|
9310
|
-
if (isUndefined
|
|
7420
|
+
if (vutils.isUndefined(tempEvent.tiltX)) {
|
|
9311
7421
|
tempEvent.tiltX = 0;
|
|
9312
7422
|
}
|
|
9313
|
-
if (isUndefined
|
|
7423
|
+
if (vutils.isUndefined(tempEvent.tiltY)) {
|
|
9314
7424
|
tempEvent.tiltY = 0;
|
|
9315
7425
|
}
|
|
9316
|
-
if (isUndefined
|
|
7426
|
+
if (vutils.isUndefined(tempEvent.pointerType)) {
|
|
9317
7427
|
tempEvent.pointerType = 'mouse';
|
|
9318
7428
|
}
|
|
9319
|
-
if (isUndefined
|
|
7429
|
+
if (vutils.isUndefined(tempEvent.pointerId)) {
|
|
9320
7430
|
tempEvent.pointerId = MOUSE_POINTER_ID;
|
|
9321
7431
|
}
|
|
9322
|
-
if (isUndefined
|
|
7432
|
+
if (vutils.isUndefined(tempEvent.pressure)) {
|
|
9323
7433
|
tempEvent.pressure = 0.5;
|
|
9324
7434
|
}
|
|
9325
|
-
if (isUndefined
|
|
7435
|
+
if (vutils.isUndefined(tempEvent.twist)) {
|
|
9326
7436
|
tempEvent.twist = 0;
|
|
9327
7437
|
}
|
|
9328
|
-
if (isUndefined
|
|
7438
|
+
if (vutils.isUndefined(tempEvent.tangentialPressure)) {
|
|
9329
7439
|
tempEvent.tangentialPressure = 0;
|
|
9330
7440
|
}
|
|
9331
7441
|
tempEvent.isNormalized = true;
|
|
@@ -9829,8 +7939,8 @@
|
|
|
9829
7939
|
if (t === 0 || t === 1) {
|
|
9830
7940
|
return t;
|
|
9831
7941
|
}
|
|
9832
|
-
const s = (period / pi2) * Math.asin(1 / amplitude);
|
|
9833
|
-
return -(amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin(((t - s) * pi2) / period));
|
|
7942
|
+
const s = (period / vutils.pi2) * Math.asin(1 / amplitude);
|
|
7943
|
+
return -(amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin(((t - s) * vutils.pi2) / period));
|
|
9834
7944
|
};
|
|
9835
7945
|
}
|
|
9836
7946
|
static getElasticOut(amplitude, period) {
|
|
@@ -9838,17 +7948,17 @@
|
|
|
9838
7948
|
if (t === 0 || t === 1) {
|
|
9839
7949
|
return t;
|
|
9840
7950
|
}
|
|
9841
|
-
const s = (period / pi2) * Math.asin(1 / amplitude);
|
|
9842
|
-
return amplitude * Math.pow(2, -10 * t) * Math.sin(((t - s) * pi2) / period) + 1;
|
|
7951
|
+
const s = (period / vutils.pi2) * Math.asin(1 / amplitude);
|
|
7952
|
+
return amplitude * Math.pow(2, -10 * t) * Math.sin(((t - s) * vutils.pi2) / period) + 1;
|
|
9843
7953
|
};
|
|
9844
7954
|
}
|
|
9845
7955
|
static getElasticInOut(amplitude, period) {
|
|
9846
7956
|
return function (t) {
|
|
9847
|
-
const s = (period / pi2) * Math.asin(1 / amplitude);
|
|
7957
|
+
const s = (period / vutils.pi2) * Math.asin(1 / amplitude);
|
|
9848
7958
|
if ((t *= 2) < 1) {
|
|
9849
|
-
return -0.5 * (amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin(((t - s) * pi2) / period));
|
|
7959
|
+
return -0.5 * (amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin(((t - s) * vutils.pi2) / period));
|
|
9850
7960
|
}
|
|
9851
|
-
return amplitude * Math.pow(2, -10 * (t -= 1)) * Math.sin(((t - s) * pi2) / period) * 0.5 + 1;
|
|
7961
|
+
return amplitude * Math.pow(2, -10 * (t -= 1)) * Math.sin(((t - s) * vutils.pi2) / period) * 0.5 + 1;
|
|
9852
7962
|
};
|
|
9853
7963
|
}
|
|
9854
7964
|
}
|
|
@@ -10061,7 +8171,7 @@
|
|
|
10061
8171
|
afterAll(list) {
|
|
10062
8172
|
let maxT = -Infinity;
|
|
10063
8173
|
list.forEach(a => {
|
|
10064
|
-
maxT = max(a.getDuration(), maxT);
|
|
8174
|
+
maxT = vutils.max(a.getDuration(), maxT);
|
|
10065
8175
|
});
|
|
10066
8176
|
this._startTime = maxT;
|
|
10067
8177
|
return this;
|
|
@@ -10652,7 +8762,7 @@
|
|
|
10652
8762
|
const parseStroke = (stroke) => {
|
|
10653
8763
|
var _a;
|
|
10654
8764
|
let isFullStroke = true;
|
|
10655
|
-
if (isBoolean
|
|
8765
|
+
if (vutils.isBoolean(stroke, true)) {
|
|
10656
8766
|
for (let i = 0; i < 4; i++) {
|
|
10657
8767
|
_strokeVec4[i] = stroke;
|
|
10658
8768
|
isFullStroke && (isFullStroke = !!((_a = _strokeVec4[i]) !== null && _a !== void 0 ? _a : true));
|
|
@@ -10681,7 +8791,7 @@
|
|
|
10681
8791
|
if (!padding) {
|
|
10682
8792
|
return 0;
|
|
10683
8793
|
}
|
|
10684
|
-
if (isArray
|
|
8794
|
+
if (vutils.isArray(padding)) {
|
|
10685
8795
|
if (padding.length === 0) {
|
|
10686
8796
|
return 0;
|
|
10687
8797
|
}
|
|
@@ -10707,24 +8817,24 @@
|
|
|
10707
8817
|
];
|
|
10708
8818
|
const indexList = [1, 2, 3, 0, 1, 2, 3, 0];
|
|
10709
8819
|
function circleBounds(startAngle, endAngle, radius, bounds) {
|
|
10710
|
-
while (startAngle >= pi2) {
|
|
10711
|
-
startAngle -= pi2;
|
|
8820
|
+
while (startAngle >= vutils.pi2) {
|
|
8821
|
+
startAngle -= vutils.pi2;
|
|
10712
8822
|
}
|
|
10713
8823
|
while (startAngle < 0) {
|
|
10714
|
-
startAngle += pi2;
|
|
8824
|
+
startAngle += vutils.pi2;
|
|
10715
8825
|
}
|
|
10716
8826
|
while (startAngle > endAngle) {
|
|
10717
|
-
endAngle += pi2;
|
|
8827
|
+
endAngle += vutils.pi2;
|
|
10718
8828
|
}
|
|
10719
8829
|
_coords[0].x = radius;
|
|
10720
8830
|
_coords[1].y = radius;
|
|
10721
8831
|
_coords[2].x = -radius;
|
|
10722
8832
|
_coords[3].y = -radius;
|
|
10723
|
-
const startIdx = Math.ceil(startAngle / halfPi
|
|
10724
|
-
const endIdx = Math.ceil(endAngle / halfPi
|
|
10725
|
-
bounds.add(cos(startAngle) * radius, sin(startAngle) * radius);
|
|
10726
|
-
bounds.add(cos(endAngle) * radius, sin(endAngle) * radius);
|
|
10727
|
-
if (startIdx !== endIdx || endAngle - startAngle > pi) {
|
|
8833
|
+
const startIdx = Math.ceil(startAngle / vutils.halfPi) % 4;
|
|
8834
|
+
const endIdx = Math.ceil(endAngle / vutils.halfPi) % 4;
|
|
8835
|
+
bounds.add(vutils.cos(startAngle) * radius, vutils.sin(startAngle) * radius);
|
|
8836
|
+
bounds.add(vutils.cos(endAngle) * radius, vutils.sin(endAngle) * radius);
|
|
8837
|
+
if (startIdx !== endIdx || endAngle - startAngle > vutils.pi) {
|
|
10728
8838
|
let match = false;
|
|
10729
8839
|
for (let i = 0; i < indexList.length; i++) {
|
|
10730
8840
|
if (!match && startIdx === indexList[i]) {
|
|
@@ -10766,15 +8876,15 @@
|
|
|
10766
8876
|
pointA.defined === pointB.defined);
|
|
10767
8877
|
}
|
|
10768
8878
|
function pointInterpolation(pointA, pointB, ratio) {
|
|
10769
|
-
const { x, y } = pointAt(pointA.x, pointA.y, pointB.x, pointB.y, ratio);
|
|
10770
|
-
const { x: x1, y: y1 } = pointAt(pointA.x1, pointA.y1, pointB.x1, pointB.y1, ratio);
|
|
10771
|
-
const point = new Point(x, y, x1, y1);
|
|
8879
|
+
const { x, y } = vutils.pointAt(pointA.x, pointA.y, pointB.x, pointB.y, ratio);
|
|
8880
|
+
const { x: x1, y: y1 } = vutils.pointAt(pointA.x1, pointA.y1, pointB.x1, pointB.y1, ratio);
|
|
8881
|
+
const point = new vutils.Point(x, y, x1, y1);
|
|
10772
8882
|
point.defined = pointB.defined;
|
|
10773
8883
|
return point;
|
|
10774
8884
|
}
|
|
10775
8885
|
function pointInterpolationHighPerformance(pointA, pointB, ratio, point) {
|
|
10776
|
-
const { x, y } = pointAt(pointA.x, pointA.y, pointB.x, pointB.y, ratio);
|
|
10777
|
-
const { x: x1, y: y1 } = pointAt(pointA.x1, pointA.y1, pointB.x1, pointB.y1, ratio);
|
|
8886
|
+
const { x, y } = vutils.pointAt(pointA.x, pointA.y, pointB.x, pointB.y, ratio);
|
|
8887
|
+
const { x: x1, y: y1 } = vutils.pointAt(pointA.x1, pointA.y1, pointB.x1, pointB.y1, ratio);
|
|
10778
8888
|
point.x = x;
|
|
10779
8889
|
point.y = y;
|
|
10780
8890
|
point.x1 = x1;
|
|
@@ -10795,7 +8905,7 @@
|
|
|
10795
8905
|
let points = [];
|
|
10796
8906
|
if (pointsA.length > pointsB.length) {
|
|
10797
8907
|
points = pointsB.map(point => {
|
|
10798
|
-
const p = new Point(point.x, point.y, point.x1, point.y1);
|
|
8908
|
+
const p = new vutils.Point(point.x, point.y, point.x1, point.y1);
|
|
10799
8909
|
p.defined = point.defined;
|
|
10800
8910
|
return p;
|
|
10801
8911
|
});
|
|
@@ -10805,7 +8915,7 @@
|
|
|
10805
8915
|
}
|
|
10806
8916
|
else {
|
|
10807
8917
|
points = pointsB.map(point => {
|
|
10808
|
-
const p = new Point(point.x, point.y, point.x1, point.y1);
|
|
8918
|
+
const p = new vutils.Point(point.x, point.y, point.x1, point.y1);
|
|
10809
8919
|
p.defined = point.defined;
|
|
10810
8920
|
return p;
|
|
10811
8921
|
});
|
|
@@ -10832,7 +8942,7 @@
|
|
|
10832
8942
|
return transformKeys.includes(key);
|
|
10833
8943
|
};
|
|
10834
8944
|
function getAttributeFromDefaultAttrList(attr, key) {
|
|
10835
|
-
if (isArray
|
|
8945
|
+
if (vutils.isArray(attr)) {
|
|
10836
8946
|
let val;
|
|
10837
8947
|
for (let i = 0; i < attr.length && val === undefined; i++) {
|
|
10838
8948
|
val = attr[i][key];
|
|
@@ -10883,8 +8993,8 @@
|
|
|
10883
8993
|
}
|
|
10884
8994
|
onBind() {
|
|
10885
8995
|
var _a, _b, _c, _d, _e, _f;
|
|
10886
|
-
this.fromNumber = isNumber
|
|
10887
|
-
this.toNumber = isNumber
|
|
8996
|
+
this.fromNumber = vutils.isNumber((_a = this.from) === null || _a === void 0 ? void 0 : _a.text) ? (_b = this.from) === null || _b === void 0 ? void 0 : _b.text : Number.parseFloat((_c = this.from) === null || _c === void 0 ? void 0 : _c.text);
|
|
8997
|
+
this.toNumber = vutils.isNumber((_d = this.to) === null || _d === void 0 ? void 0 : _d.text) ? (_e = this.to) === null || _e === void 0 ? void 0 : _e.text : Number.parseFloat((_f = this.to) === null || _f === void 0 ? void 0 : _f.text);
|
|
10888
8998
|
if (!Number.isFinite(this.toNumber)) {
|
|
10889
8999
|
this.fromNumber = 0;
|
|
10890
9000
|
}
|
|
@@ -11048,7 +9158,7 @@
|
|
|
11048
9158
|
var _a, _b, _c, _d;
|
|
11049
9159
|
this.fromText = (_b = (_a = this.from) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : '';
|
|
11050
9160
|
this.toText = (_d = (_c = this.to) === null || _c === void 0 ? void 0 : _c.text) !== null && _d !== void 0 ? _d : '';
|
|
11051
|
-
if (!this.toText || isArray
|
|
9161
|
+
if (!this.toText || vutils.isArray(this.toText)) {
|
|
11052
9162
|
this.valid = false;
|
|
11053
9163
|
}
|
|
11054
9164
|
else {
|
|
@@ -11158,7 +9268,7 @@
|
|
|
11158
9268
|
}
|
|
11159
9269
|
const x = this.target.getComputedAttribute('x');
|
|
11160
9270
|
const y = this.target.getComputedAttribute('y');
|
|
11161
|
-
const nextPos = new Point(x, y);
|
|
9271
|
+
const nextPos = new vutils.Point(x, y);
|
|
11162
9272
|
if (!this.posList.length) {
|
|
11163
9273
|
this.posList.push(nextPos);
|
|
11164
9274
|
return;
|
|
@@ -11254,7 +9364,7 @@
|
|
|
11254
9364
|
this.points = this.interpolatePoints.map(interpolate => {
|
|
11255
9365
|
const fromPoint = interpolate[0];
|
|
11256
9366
|
const toPoint = interpolate[1];
|
|
11257
|
-
const newPoint = new Point(fromPoint.x, fromPoint.y, fromPoint.x1, fromPoint.y1);
|
|
9367
|
+
const newPoint = new vutils.Point(fromPoint.x, fromPoint.y, fromPoint.x1, fromPoint.y1);
|
|
11258
9368
|
newPoint.defined = toPoint.defined;
|
|
11259
9369
|
newPoint.context = toPoint.context;
|
|
11260
9370
|
return newPoint;
|
|
@@ -11438,7 +9548,7 @@
|
|
|
11438
9548
|
const phi = Math.acos((startY - center.y) / r);
|
|
11439
9549
|
let theta = Math.acos((startX - center.x) / r / Math.sin(phi));
|
|
11440
9550
|
if (startZ - center.z < 0) {
|
|
11441
|
-
theta = pi2 - theta;
|
|
9551
|
+
theta = vutils.pi2 - theta;
|
|
11442
9552
|
}
|
|
11443
9553
|
this.theta = theta;
|
|
11444
9554
|
this.phi = phi;
|
|
@@ -11463,11 +9573,11 @@
|
|
|
11463
9573
|
out.x = x;
|
|
11464
9574
|
out.y = y;
|
|
11465
9575
|
out.z = z;
|
|
11466
|
-
out.alpha = theta + pi / 2;
|
|
11467
|
-
while (out.alpha > pi2) {
|
|
11468
|
-
out.alpha -= pi2;
|
|
9576
|
+
out.alpha = theta + vutils.pi / 2;
|
|
9577
|
+
while (out.alpha > vutils.pi2) {
|
|
9578
|
+
out.alpha -= vutils.pi2;
|
|
11469
9579
|
}
|
|
11470
|
-
out.alpha = pi2 - out.alpha;
|
|
9580
|
+
out.alpha = vutils.pi2 - out.alpha;
|
|
11471
9581
|
out.zIndex = out.z * -10000;
|
|
11472
9582
|
}
|
|
11473
9583
|
}
|
|
@@ -11872,7 +9982,7 @@
|
|
|
11872
9982
|
return [newArray1, newArray2];
|
|
11873
9983
|
}
|
|
11874
9984
|
const addLineToBezierPath = (bezierPath, x0, y0, x1, y1) => {
|
|
11875
|
-
if (!(isNumberClose(x0, x1) && isNumberClose(y0, y1))) {
|
|
9985
|
+
if (!(vutils.isNumberClose(x0, x1) && vutils.isNumberClose(y0, y1))) {
|
|
11876
9986
|
bezierPath.push(x0, y0, x1, y1, x1, y1);
|
|
11877
9987
|
}
|
|
11878
9988
|
};
|
|
@@ -11965,7 +10075,7 @@
|
|
|
11965
10075
|
const startAngle = cmd[6];
|
|
11966
10076
|
const endAngle = cmd[7] + startAngle;
|
|
11967
10077
|
const anticlockwise = !!cmd[8];
|
|
11968
|
-
const hasRotate = !isNumberClose(rotate, 0);
|
|
10078
|
+
const hasRotate = !vutils.isNumberClose(rotate, 0);
|
|
11969
10079
|
const rc = Math.cos(rotate);
|
|
11970
10080
|
const rs = Math.sin(rotate);
|
|
11971
10081
|
let xTemp = Math.cos(startAngle) * rx;
|
|
@@ -12030,13 +10140,13 @@
|
|
|
12030
10140
|
const tx2 = cmd[3];
|
|
12031
10141
|
const ty2 = cmd[4];
|
|
12032
10142
|
const r = cmd[5];
|
|
12033
|
-
const dis1 = PointService.distancePP({ x: xi, y: yi }, { x: tx1, y: ty1 });
|
|
12034
|
-
const dis2 = PointService.distancePP({ x: tx2, y: ty2 }, { x: tx1, y: ty1 });
|
|
10143
|
+
const dis1 = vutils.PointService.distancePP({ x: xi, y: yi }, { x: tx1, y: ty1 });
|
|
10144
|
+
const dis2 = vutils.PointService.distancePP({ x: tx2, y: ty2 }, { x: tx1, y: ty1 });
|
|
12035
10145
|
const theta = ((xi - tx1) * (tx2 - tx1) + (yi - ty1) * (ty2 - ty1)) / (dis1 * dis2);
|
|
12036
10146
|
const dis = r / Math.sin(theta / 2);
|
|
12037
10147
|
const midX = (xi + tx2 - 2 * tx1) / 2;
|
|
12038
10148
|
const midY = (yi + ty2 - 2 * ty1) / 2;
|
|
12039
|
-
const midLen = PointService.distancePP({ x: midX, y: midY }, { x: 0, y: 0 });
|
|
10149
|
+
const midLen = vutils.PointService.distancePP({ x: midX, y: midY }, { x: 0, y: 0 });
|
|
12040
10150
|
const cx = tx1 + (dis * midX) / midLen;
|
|
12041
10151
|
const cy = tx2 + (dis * midY) / midLen;
|
|
12042
10152
|
const disP = Math.sqrt(dis * dis - r * r);
|
|
@@ -12045,8 +10155,8 @@
|
|
|
12045
10155
|
addLineToBezierPath(currentSubpath, xi, yi, x0, y0);
|
|
12046
10156
|
xi = tx1 + (disP * (tx2 - tx1)) / dis2;
|
|
12047
10157
|
yi = ty1 + (disP * (ty2 - ty1)) / dis2;
|
|
12048
|
-
const startAngle = getAngleByPoint({ x: cx, y: cy }, { x: x0, y: y0 });
|
|
12049
|
-
const endAngle = getAngleByPoint({ x: cx, y: cy }, { x: xi, y: yi });
|
|
10158
|
+
const startAngle = vutils.getAngleByPoint({ x: cx, y: cy }, { x: x0, y: y0 });
|
|
10159
|
+
const endAngle = vutils.getAngleByPoint({ x: cx, y: cy }, { x: xi, y: yi });
|
|
12050
10160
|
addArcToBezierPath(currentSubpath, startAngle, endAngle, cx, cy, r, r);
|
|
12051
10161
|
break;
|
|
12052
10162
|
}
|
|
@@ -12200,7 +10310,7 @@
|
|
|
12200
10310
|
return res;
|
|
12201
10311
|
};
|
|
12202
10312
|
const samplingPoints = (points, count) => {
|
|
12203
|
-
const validatePoints = points.filter(point => point.defined !== false && isNumber
|
|
10313
|
+
const validatePoints = points.filter(point => point.defined !== false && vutils.isNumber(point.x) && vutils.isNumber(point.y));
|
|
12204
10314
|
if (validatePoints.length === 0) {
|
|
12205
10315
|
return [];
|
|
12206
10316
|
}
|
|
@@ -12254,7 +10364,7 @@
|
|
|
12254
10364
|
return res.concat((_a = seg.points) !== null && _a !== void 0 ? _a : []);
|
|
12255
10365
|
}, []);
|
|
12256
10366
|
}
|
|
12257
|
-
const validatePoints = points.filter(point => point.defined !== false && isNumber
|
|
10367
|
+
const validatePoints = points.filter(point => point.defined !== false && vutils.isNumber(point.x) && vutils.isNumber(point.y));
|
|
12258
10368
|
if (!validatePoints.length) {
|
|
12259
10369
|
return [];
|
|
12260
10370
|
}
|
|
@@ -12298,7 +10408,7 @@
|
|
|
12298
10408
|
for (let i = 0; i < len; i++) {
|
|
12299
10409
|
const cur = points[i];
|
|
12300
10410
|
const next = i === len - 1 ? points[0] : points[i + 1];
|
|
12301
|
-
const res = getIntersectPoint([p0.x, p0.y], [p1.x, p1.y], [cur.x, cur.y], [next.x, next.y]);
|
|
10411
|
+
const res = vutils.getIntersectPoint([p0.x, p0.y], [p1.x, p1.y], [cur.x, cur.y], [next.x, next.y]);
|
|
12302
10412
|
if (res && typeof res !== 'boolean') {
|
|
12303
10413
|
intersections.push({
|
|
12304
10414
|
dot: crossProduct([res[0] - p0.x, res[1] - p0.x], [p1.x - p0.x, p1.y - p0.x]),
|
|
@@ -12332,7 +10442,7 @@
|
|
|
12332
10442
|
return [newPointsA, newPointsB];
|
|
12333
10443
|
};
|
|
12334
10444
|
const binarySplitPolygon = (points) => {
|
|
12335
|
-
const box = new Bounds();
|
|
10445
|
+
const box = new vutils.Bounds();
|
|
12336
10446
|
points.forEach(point => {
|
|
12337
10447
|
box.add(point.x, point.y);
|
|
12338
10448
|
});
|
|
@@ -12410,7 +10520,7 @@
|
|
|
12410
10520
|
return res;
|
|
12411
10521
|
};
|
|
12412
10522
|
|
|
12413
|
-
const { Color } = ColorUtil;
|
|
10523
|
+
const { Color } = vutils.ColorUtil;
|
|
12414
10524
|
function colorEqual(color1, color2) {
|
|
12415
10525
|
const c1 = Color.parseColorString(color1);
|
|
12416
10526
|
const c2 = Color.parseColorString(color2);
|
|
@@ -12627,8 +10737,8 @@
|
|
|
12627
10737
|
return `rgba(${Math.round(_fromColorRGB[0] + (_toColorRGB[0] - _fromColorRGB[0]) * ratio)},${Math.round(_fromColorRGB[1] + (_toColorRGB[1] - _fromColorRGB[1]) * ratio)},${Math.round(_fromColorRGB[2] + (_toColorRGB[2] - _fromColorRGB[2]) * ratio)},${_fromColorRGB[3] + (_toColorRGB[3] - _fromColorRGB[3]) * ratio})`;
|
|
12628
10738
|
}
|
|
12629
10739
|
|
|
12630
|
-
Object.keys(DEFAULT_COLORS).forEach(k => {
|
|
12631
|
-
DEFAULT_COLORS[k];
|
|
10740
|
+
Object.keys(vutils.DEFAULT_COLORS).forEach(k => {
|
|
10741
|
+
vutils.DEFAULT_COLORS[k];
|
|
12632
10742
|
});
|
|
12633
10743
|
|
|
12634
10744
|
const interpolateOtherAttrs = (attrs, out, ratio) => {
|
|
@@ -12732,7 +10842,7 @@
|
|
|
12732
10842
|
return;
|
|
12733
10843
|
}
|
|
12734
10844
|
const toValue = toAttrs[fromKey];
|
|
12735
|
-
if (!isNil
|
|
10845
|
+
if (!vutils.isNil(toValue) && !vutils.isNil(fromAttrs[fromKey]) && toValue !== fromAttrs[fromKey]) {
|
|
12736
10846
|
if (fromKey === 'fill' || fromKey === 'stroke') {
|
|
12737
10847
|
res.push({
|
|
12738
10848
|
from: typeof fromAttrs[fromKey] === 'string'
|
|
@@ -13189,7 +11299,7 @@
|
|
|
13189
11299
|
}
|
|
13190
11300
|
ResourceLoader.cache = new Map();
|
|
13191
11301
|
|
|
13192
|
-
const tempMatrix = new Matrix();
|
|
11302
|
+
const tempMatrix = new vutils.Matrix();
|
|
13193
11303
|
const PURE_STYLE_KEY = [
|
|
13194
11304
|
'stroke',
|
|
13195
11305
|
'opacity',
|
|
@@ -13215,7 +11325,7 @@
|
|
|
13215
11325
|
const tempConstantXYKey = ['x', 'y'];
|
|
13216
11326
|
const tempConstantScaleXYKey = ['scaleX', 'scaleY'];
|
|
13217
11327
|
const tempConstantAngleKey = ['angle'];
|
|
13218
|
-
const point = new Point();
|
|
11328
|
+
const point = new vutils.Point();
|
|
13219
11329
|
const NOWORK_ANIMATE_ATTR = {
|
|
13220
11330
|
strokeSeg: 1,
|
|
13221
11331
|
boundsPadding: 2,
|
|
@@ -13270,7 +11380,7 @@
|
|
|
13270
11380
|
}
|
|
13271
11381
|
constructor(params = {}) {
|
|
13272
11382
|
super();
|
|
13273
|
-
this._AABBBounds = new AABBBounds();
|
|
11383
|
+
this._AABBBounds = new vutils.AABBBounds();
|
|
13274
11384
|
this._updateTag = exports.UpdateTag.INIT;
|
|
13275
11385
|
this.attribute = params;
|
|
13276
11386
|
this.valid = this.isValid();
|
|
@@ -13356,7 +11466,7 @@
|
|
|
13356
11466
|
}
|
|
13357
11467
|
tryUpdateLocalTransMatrix(clearTag = true) {
|
|
13358
11468
|
if (!this._transMatrix) {
|
|
13359
|
-
this._transMatrix = new Matrix();
|
|
11469
|
+
this._transMatrix = new vutils.Matrix();
|
|
13360
11470
|
}
|
|
13361
11471
|
if (this.shouldUpdateLocalMatrix()) {
|
|
13362
11472
|
this.doUpdateLocalMatrix();
|
|
@@ -13398,7 +11508,7 @@
|
|
|
13398
11508
|
return false;
|
|
13399
11509
|
}
|
|
13400
11510
|
if (mode === exports.IContainPointMode.GLOBAL) {
|
|
13401
|
-
const point = new Point(x, y);
|
|
11511
|
+
const point = new vutils.Point(x, y);
|
|
13402
11512
|
if (this.parent) {
|
|
13403
11513
|
this.parent.globalTransMatrix.transformPoint(point, point);
|
|
13404
11514
|
}
|
|
@@ -13436,7 +11546,7 @@
|
|
|
13436
11546
|
var _a;
|
|
13437
11547
|
const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({ [key]: value }, this.attribute, key, context);
|
|
13438
11548
|
if (!params) {
|
|
13439
|
-
if (!isNil
|
|
11549
|
+
if (!vutils.isNil((_a = this.normalAttrs) === null || _a === void 0 ? void 0 : _a[key])) {
|
|
13440
11550
|
this.normalAttrs[key] = value;
|
|
13441
11551
|
}
|
|
13442
11552
|
else {
|
|
@@ -13568,7 +11678,7 @@
|
|
|
13568
11678
|
else {
|
|
13569
11679
|
let { postMatrix } = this.attribute;
|
|
13570
11680
|
if (!postMatrix) {
|
|
13571
|
-
postMatrix = new Matrix();
|
|
11681
|
+
postMatrix = new vutils.Matrix();
|
|
13572
11682
|
attribute.postMatrix = postMatrix;
|
|
13573
11683
|
}
|
|
13574
11684
|
application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter);
|
|
@@ -13620,7 +11730,7 @@
|
|
|
13620
11730
|
else {
|
|
13621
11731
|
let { postMatrix } = this.attribute;
|
|
13622
11732
|
if (!postMatrix) {
|
|
13623
|
-
postMatrix = new Matrix();
|
|
11733
|
+
postMatrix = new vutils.Matrix();
|
|
13624
11734
|
attribute.postMatrix = postMatrix;
|
|
13625
11735
|
}
|
|
13626
11736
|
application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter);
|
|
@@ -13695,7 +11805,7 @@
|
|
|
13695
11805
|
if (!this.currentStates || !this.currentStates.length) {
|
|
13696
11806
|
return false;
|
|
13697
11807
|
}
|
|
13698
|
-
if (!isNil
|
|
11808
|
+
if (!vutils.isNil(stateName)) {
|
|
13699
11809
|
return this.currentStates.includes(stateName);
|
|
13700
11810
|
}
|
|
13701
11811
|
return true;
|
|
@@ -13751,7 +11861,7 @@
|
|
|
13751
11861
|
this.animates.forEach(animate => {
|
|
13752
11862
|
if (animate.stateNames) {
|
|
13753
11863
|
const endProps = animate.getEndProps();
|
|
13754
|
-
if (has
|
|
11864
|
+
if (vutils.has(endProps, key)) {
|
|
13755
11865
|
value = endProps[key];
|
|
13756
11866
|
}
|
|
13757
11867
|
}
|
|
@@ -13900,7 +12010,7 @@
|
|
|
13900
12010
|
application.transformUtil.fromMatrix(m, m).scale(scaleX, scaleY, { x: scaleCenter[0], y: scaleCenter[1] });
|
|
13901
12011
|
}
|
|
13902
12012
|
else {
|
|
13903
|
-
normalTransform(this._transMatrix, this._transMatrix.reset(), x, y, scaleX, scaleY, angle, anchor && _anchor);
|
|
12013
|
+
vutils.normalTransform(this._transMatrix, this._transMatrix.reset(), x, y, scaleX, scaleY, angle, anchor && _anchor);
|
|
13904
12014
|
}
|
|
13905
12015
|
const p = this.getOffsetXY(DefaultTransform);
|
|
13906
12016
|
this._transMatrix.e += p.x;
|
|
@@ -14094,7 +12204,7 @@
|
|
|
14094
12204
|
};
|
|
14095
12205
|
}
|
|
14096
12206
|
createPathProxy(path) {
|
|
14097
|
-
if (isString
|
|
12207
|
+
if (vutils.isString(path, true)) {
|
|
14098
12208
|
this.pathProxy = new CustomPath2D().fromString(path);
|
|
14099
12209
|
}
|
|
14100
12210
|
else {
|
|
@@ -14117,7 +12227,7 @@
|
|
|
14117
12227
|
this.resources.set(url, cache);
|
|
14118
12228
|
if (typeof image === 'string') {
|
|
14119
12229
|
cache.state = 'loading';
|
|
14120
|
-
if (isValidUrl
|
|
12230
|
+
if (vutils.isValidUrl(image) || vutils.isBase64(image)) {
|
|
14121
12231
|
ResourceLoader.GetImage(image, this);
|
|
14122
12232
|
this.backgroundImg = this.backgroundImg || background;
|
|
14123
12233
|
}
|
|
@@ -14607,7 +12717,7 @@
|
|
|
14607
12717
|
return rotate;
|
|
14608
12718
|
}
|
|
14609
12719
|
function xul(str) {
|
|
14610
|
-
const xmlStr = isArray
|
|
12720
|
+
const xmlStr = vutils.isArray(str) ? str[0] : str;
|
|
14611
12721
|
const config = [];
|
|
14612
12722
|
if (!xmlStr) {
|
|
14613
12723
|
return config;
|
|
@@ -14772,7 +12882,7 @@
|
|
|
14772
12882
|
}
|
|
14773
12883
|
containsPoint(x, y, mode) {
|
|
14774
12884
|
if (mode === exports.IContainPointMode.GLOBAL) {
|
|
14775
|
-
const point = new Point(x, y);
|
|
12885
|
+
const point = new vutils.Point(x, y);
|
|
14776
12886
|
if (this.parent) {
|
|
14777
12887
|
this.parent.globalTransMatrix.transformPoint(point, point);
|
|
14778
12888
|
}
|
|
@@ -15364,7 +13474,7 @@
|
|
|
15364
13474
|
}
|
|
15365
13475
|
function runStroke(stroke, lineWidth) {
|
|
15366
13476
|
let s;
|
|
15367
|
-
if (isArray
|
|
13477
|
+
if (vutils.isArray(stroke)) {
|
|
15368
13478
|
s = stroke.some(item => item || item === undefined);
|
|
15369
13479
|
}
|
|
15370
13480
|
else {
|
|
@@ -15433,7 +13543,7 @@
|
|
|
15433
13543
|
const x32 = x3 - x2;
|
|
15434
13544
|
const y32 = y3 - y2;
|
|
15435
13545
|
let t = y32 * x10 - x32 * y10;
|
|
15436
|
-
if (t * t < epsilon) {
|
|
13546
|
+
if (t * t < vutils.epsilon) {
|
|
15437
13547
|
return [];
|
|
15438
13548
|
}
|
|
15439
13549
|
t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
|
|
@@ -15479,7 +13589,7 @@
|
|
|
15479
13589
|
}
|
|
15480
13590
|
function drawArcPath$1(arc, context, cx, cy, outerRadius, innerRadius, partStroke) {
|
|
15481
13591
|
const { startAngle, endAngle } = arc.getParsedAngle();
|
|
15482
|
-
const deltaAngle = abs(endAngle - startAngle);
|
|
13592
|
+
const deltaAngle = vutils.abs(endAngle - startAngle);
|
|
15483
13593
|
const clockwise = endAngle > startAngle;
|
|
15484
13594
|
let collapsedToLine = false;
|
|
15485
13595
|
if (outerRadius < innerRadius) {
|
|
@@ -15487,14 +13597,14 @@
|
|
|
15487
13597
|
outerRadius = innerRadius;
|
|
15488
13598
|
innerRadius = temp;
|
|
15489
13599
|
}
|
|
15490
|
-
if (outerRadius <= epsilon) {
|
|
13600
|
+
if (outerRadius <= vutils.epsilon) {
|
|
15491
13601
|
context.moveTo(cx, cy);
|
|
15492
13602
|
}
|
|
15493
|
-
else if (deltaAngle >= pi2 - epsilon) {
|
|
15494
|
-
context.moveTo(cx + outerRadius * cos(startAngle), cy + outerRadius * sin(startAngle));
|
|
13603
|
+
else if (deltaAngle >= vutils.pi2 - vutils.epsilon) {
|
|
13604
|
+
context.moveTo(cx + outerRadius * vutils.cos(startAngle), cy + outerRadius * vutils.sin(startAngle));
|
|
15495
13605
|
context.arc(cx, cy, outerRadius, startAngle, endAngle, !clockwise);
|
|
15496
|
-
if (innerRadius > epsilon) {
|
|
15497
|
-
context.moveTo(cx + innerRadius * cos(endAngle), cy + innerRadius * sin(endAngle));
|
|
13606
|
+
if (innerRadius > vutils.epsilon) {
|
|
13607
|
+
context.moveTo(cx + innerRadius * vutils.cos(endAngle), cy + innerRadius * vutils.sin(endAngle));
|
|
15498
13608
|
context.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise);
|
|
15499
13609
|
}
|
|
15500
13610
|
}
|
|
@@ -15509,30 +13619,30 @@
|
|
|
15509
13619
|
const maxInnerCornerRadius = Math.max(innerCornerRadiusEnd, innerCornerRadiusStart);
|
|
15510
13620
|
let limitedOcr = maxOuterCornerRadius;
|
|
15511
13621
|
let limitedIcr = maxInnerCornerRadius;
|
|
15512
|
-
const xors = outerRadius * cos(outerStartAngle);
|
|
15513
|
-
const yors = outerRadius * sin(outerStartAngle);
|
|
15514
|
-
const xire = innerRadius * cos(innerEndAngle);
|
|
15515
|
-
const yire = innerRadius * sin(innerEndAngle);
|
|
13622
|
+
const xors = outerRadius * vutils.cos(outerStartAngle);
|
|
13623
|
+
const yors = outerRadius * vutils.sin(outerStartAngle);
|
|
13624
|
+
const xire = innerRadius * vutils.cos(innerEndAngle);
|
|
13625
|
+
const yire = innerRadius * vutils.sin(innerEndAngle);
|
|
15516
13626
|
let xore;
|
|
15517
13627
|
let yore;
|
|
15518
13628
|
let xirs;
|
|
15519
13629
|
let yirs;
|
|
15520
|
-
if (maxInnerCornerRadius > epsilon || maxOuterCornerRadius > epsilon) {
|
|
15521
|
-
xore = outerRadius * cos(outerEndAngle);
|
|
15522
|
-
yore = outerRadius * sin(outerEndAngle);
|
|
15523
|
-
xirs = innerRadius * cos(innerStartAngle);
|
|
15524
|
-
yirs = innerRadius * sin(innerStartAngle);
|
|
15525
|
-
if (deltaAngle < pi) {
|
|
13630
|
+
if (maxInnerCornerRadius > vutils.epsilon || maxOuterCornerRadius > vutils.epsilon) {
|
|
13631
|
+
xore = outerRadius * vutils.cos(outerEndAngle);
|
|
13632
|
+
yore = outerRadius * vutils.sin(outerEndAngle);
|
|
13633
|
+
xirs = innerRadius * vutils.cos(innerStartAngle);
|
|
13634
|
+
yirs = innerRadius * vutils.sin(innerStartAngle);
|
|
13635
|
+
if (deltaAngle < vutils.pi) {
|
|
15526
13636
|
const oc = intersect(xors, yors, xirs, yirs, xore, yore, xire, yire);
|
|
15527
13637
|
if (oc) {
|
|
15528
13638
|
const ax = xors - oc[0];
|
|
15529
13639
|
const ay = yors - oc[1];
|
|
15530
13640
|
const bx = xore - oc[0];
|
|
15531
13641
|
const by = yore - oc[1];
|
|
15532
|
-
const kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2);
|
|
15533
|
-
const lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
|
|
15534
|
-
limitedIcr = min(maxInnerCornerRadius, (innerRadius - lc) / (kc - 1));
|
|
15535
|
-
limitedOcr = min(maxOuterCornerRadius, (outerRadius - lc) / (kc + 1));
|
|
13642
|
+
const kc = 1 / vutils.sin(vutils.acos((ax * bx + ay * by) / (vutils.sqrt(ax * ax + ay * ay) * vutils.sqrt(bx * bx + by * by))) / 2);
|
|
13643
|
+
const lc = vutils.sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
|
|
13644
|
+
limitedIcr = vutils.min(maxInnerCornerRadius, (innerRadius - lc) / (kc - 1));
|
|
13645
|
+
limitedOcr = vutils.min(maxOuterCornerRadius, (outerRadius - lc) / (kc + 1));
|
|
15536
13646
|
}
|
|
15537
13647
|
}
|
|
15538
13648
|
}
|
|
@@ -15542,35 +13652,35 @@
|
|
|
15542
13652
|
}
|
|
15543
13653
|
collapsedToLine = true;
|
|
15544
13654
|
}
|
|
15545
|
-
else if (limitedOcr > epsilon) {
|
|
15546
|
-
const cornerRadiusStart = min(outerCornerRadiusStart, limitedOcr);
|
|
15547
|
-
const cornerRadiusEnd = min(outerCornerRadiusEnd, limitedOcr);
|
|
13655
|
+
else if (limitedOcr > vutils.epsilon) {
|
|
13656
|
+
const cornerRadiusStart = vutils.min(outerCornerRadiusStart, limitedOcr);
|
|
13657
|
+
const cornerRadiusEnd = vutils.min(outerCornerRadiusEnd, limitedOcr);
|
|
15548
13658
|
const t0 = cornerTangents(xirs, yirs, xors, yors, outerRadius, cornerRadiusStart, Number(clockwise));
|
|
15549
13659
|
const t1 = cornerTangents(xore, yore, xire, yire, outerRadius, cornerRadiusEnd, Number(clockwise));
|
|
15550
13660
|
if (limitedOcr < maxOuterCornerRadius && cornerRadiusStart === cornerRadiusEnd) {
|
|
15551
13661
|
if (!partStroke || partStroke[0]) {
|
|
15552
13662
|
context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01);
|
|
15553
|
-
context.arc(cx + t0.cx, cy + t0.cy, limitedOcr, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !clockwise);
|
|
13663
|
+
context.arc(cx + t0.cx, cy + t0.cy, limitedOcr, vutils.atan2(t0.y01, t0.x01), vutils.atan2(t1.y01, t1.x01), !clockwise);
|
|
15554
13664
|
}
|
|
15555
13665
|
else {
|
|
15556
|
-
context.moveTo(cx + t0.cx + limitedOcr * cos(atan2(t1.y01, t1.x01)), cy + t0.cy + limitedOcr * sin(atan2(t1.y01, t1.x01)));
|
|
13666
|
+
context.moveTo(cx + t0.cx + limitedOcr * vutils.cos(vutils.atan2(t1.y01, t1.x01)), cy + t0.cy + limitedOcr * vutils.sin(vutils.atan2(t1.y01, t1.x01)));
|
|
15557
13667
|
}
|
|
15558
13668
|
}
|
|
15559
13669
|
else {
|
|
15560
13670
|
if (!partStroke || partStroke[0]) {
|
|
15561
13671
|
context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01);
|
|
15562
13672
|
cornerRadiusStart > 0 &&
|
|
15563
|
-
context.arc(cx + t0.cx, cy + t0.cy, cornerRadiusStart, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !clockwise);
|
|
15564
|
-
context.arc(cx, cy, outerRadius, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !clockwise);
|
|
13673
|
+
context.arc(cx + t0.cx, cy + t0.cy, cornerRadiusStart, vutils.atan2(t0.y01, t0.x01), vutils.atan2(t0.y11, t0.x11), !clockwise);
|
|
13674
|
+
context.arc(cx, cy, outerRadius, vutils.atan2(t0.cy + t0.y11, t0.cx + t0.x11), vutils.atan2(t1.cy + t1.y11, t1.cx + t1.x11), !clockwise);
|
|
15565
13675
|
cornerRadiusEnd > 0 &&
|
|
15566
|
-
context.arc(cx + t1.cx, cy + t1.cy, cornerRadiusEnd, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !clockwise);
|
|
13676
|
+
context.arc(cx + t1.cx, cy + t1.cy, cornerRadiusEnd, vutils.atan2(t1.y11, t1.x11), vutils.atan2(t1.y01, t1.x01), !clockwise);
|
|
15567
13677
|
}
|
|
15568
13678
|
else {
|
|
15569
13679
|
if (cornerRadiusEnd > 0) {
|
|
15570
|
-
context.moveTo(cx + t1.cx + cornerRadiusEnd * cos(atan2(t1.y01, t1.x01)), cy + t1.cy + cornerRadiusEnd * sin(atan2(t1.y01, t1.x01)));
|
|
13680
|
+
context.moveTo(cx + t1.cx + cornerRadiusEnd * vutils.cos(vutils.atan2(t1.y01, t1.x01)), cy + t1.cy + cornerRadiusEnd * vutils.sin(vutils.atan2(t1.y01, t1.x01)));
|
|
15571
13681
|
}
|
|
15572
13682
|
else {
|
|
15573
|
-
context.moveTo(cx + xore, cy + outerRadius * sin(outerEndAngle));
|
|
13683
|
+
context.moveTo(cx + xore, cy + outerRadius * vutils.sin(outerEndAngle));
|
|
15574
13684
|
}
|
|
15575
13685
|
}
|
|
15576
13686
|
}
|
|
@@ -15581,10 +13691,10 @@
|
|
|
15581
13691
|
context.arc(cx, cy, outerRadius, outerStartAngle, outerEndAngle, !clockwise);
|
|
15582
13692
|
}
|
|
15583
13693
|
else {
|
|
15584
|
-
context.moveTo(cx + outerRadius * cos(outerEndAngle), cy + outerRadius * sin(outerEndAngle));
|
|
13694
|
+
context.moveTo(cx + outerRadius * vutils.cos(outerEndAngle), cy + outerRadius * vutils.sin(outerEndAngle));
|
|
15585
13695
|
}
|
|
15586
13696
|
}
|
|
15587
|
-
if (!(innerRadius > epsilon) || innerDeltaAngle < 0.001) {
|
|
13697
|
+
if (!(innerRadius > vutils.epsilon) || innerDeltaAngle < 0.001) {
|
|
15588
13698
|
if (!partStroke || partStroke[1]) {
|
|
15589
13699
|
context.lineTo(cx + xire, cy + yire);
|
|
15590
13700
|
}
|
|
@@ -15593,9 +13703,9 @@
|
|
|
15593
13703
|
}
|
|
15594
13704
|
collapsedToLine = true;
|
|
15595
13705
|
}
|
|
15596
|
-
else if (limitedIcr > epsilon) {
|
|
15597
|
-
const cornerRadiusStart = min(innerCornerRadiusStart, limitedIcr);
|
|
15598
|
-
const cornerRadiusEnd = min(innerCornerRadiusEnd, limitedIcr);
|
|
13706
|
+
else if (limitedIcr > vutils.epsilon) {
|
|
13707
|
+
const cornerRadiusStart = vutils.min(innerCornerRadiusStart, limitedIcr);
|
|
13708
|
+
const cornerRadiusEnd = vutils.min(innerCornerRadiusEnd, limitedIcr);
|
|
15599
13709
|
const t0 = cornerTangents(xire, yire, xore, yore, innerRadius, -cornerRadiusEnd, Number(clockwise));
|
|
15600
13710
|
const t1 = cornerTangents(xors, yors, xirs, yirs, innerRadius, -cornerRadiusStart, Number(clockwise));
|
|
15601
13711
|
if (!partStroke || partStroke[1]) {
|
|
@@ -15605,25 +13715,25 @@
|
|
|
15605
13715
|
context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01);
|
|
15606
13716
|
}
|
|
15607
13717
|
if (limitedIcr < maxInnerCornerRadius && cornerRadiusStart === cornerRadiusEnd) {
|
|
15608
|
-
const arcEndAngle = atan2(t1.y01, t1.x01);
|
|
13718
|
+
const arcEndAngle = vutils.atan2(t1.y01, t1.x01);
|
|
15609
13719
|
if (!partStroke || partStroke[2]) {
|
|
15610
|
-
context.arc(cx + t0.cx, cy + t0.cy, limitedIcr, atan2(t0.y01, t0.x01), arcEndAngle, !clockwise);
|
|
13720
|
+
context.arc(cx + t0.cx, cy + t0.cy, limitedIcr, vutils.atan2(t0.y01, t0.x01), arcEndAngle, !clockwise);
|
|
15611
13721
|
}
|
|
15612
13722
|
else {
|
|
15613
|
-
context.moveTo(cx + t0.cx + cos(arcEndAngle), cy + t0.cy + sin(arcEndAngle));
|
|
13723
|
+
context.moveTo(cx + t0.cx + vutils.cos(arcEndAngle), cy + t0.cy + vutils.sin(arcEndAngle));
|
|
15614
13724
|
}
|
|
15615
13725
|
}
|
|
15616
13726
|
else {
|
|
15617
13727
|
if (!partStroke || partStroke[2]) {
|
|
15618
13728
|
cornerRadiusEnd > 0 &&
|
|
15619
|
-
context.arc(cx + t0.cx, cy + t0.cy, cornerRadiusEnd, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !clockwise);
|
|
15620
|
-
context.arc(cx, cy, innerRadius, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), clockwise);
|
|
13729
|
+
context.arc(cx + t0.cx, cy + t0.cy, cornerRadiusEnd, vutils.atan2(t0.y01, t0.x01), vutils.atan2(t0.y11, t0.x11), !clockwise);
|
|
13730
|
+
context.arc(cx, cy, innerRadius, vutils.atan2(t0.cy + t0.y11, t0.cx + t0.x11), vutils.atan2(t1.cy + t1.y11, t1.cx + t1.x11), clockwise);
|
|
15621
13731
|
cornerRadiusStart > 0 &&
|
|
15622
|
-
context.arc(cx + t1.cx, cy + t1.cy, cornerRadiusStart, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !clockwise);
|
|
13732
|
+
context.arc(cx + t1.cx, cy + t1.cy, cornerRadiusStart, vutils.atan2(t1.y11, t1.x11), vutils.atan2(t1.y01, t1.x01), !clockwise);
|
|
15623
13733
|
}
|
|
15624
13734
|
else {
|
|
15625
13735
|
if (cornerRadiusStart > 0) {
|
|
15626
|
-
context.moveTo(cx + t1.cx + cornerRadiusStart * cos(atan2(t1.y01, t1.x01)), cy + t1.cy + cornerRadiusStart * sin(atan2(t1.y01, t1.x01)));
|
|
13736
|
+
context.moveTo(cx + t1.cx + cornerRadiusStart * vutils.cos(vutils.atan2(t1.y01, t1.x01)), cy + t1.cy + cornerRadiusStart * vutils.sin(vutils.atan2(t1.y01, t1.x01)));
|
|
15627
13737
|
}
|
|
15628
13738
|
else {
|
|
15629
13739
|
context.moveTo(cx + xirs, cy + yirs);
|
|
@@ -15642,7 +13752,7 @@
|
|
|
15642
13752
|
context.arc(cx, cy, innerRadius, innerEndAngle, innerStartAngle, clockwise);
|
|
15643
13753
|
}
|
|
15644
13754
|
else {
|
|
15645
|
-
context.moveTo(cx + innerRadius * cos(innerStartAngle), cy + innerRadius * sin(innerStartAngle));
|
|
13755
|
+
context.moveTo(cx + innerRadius * vutils.cos(innerStartAngle), cy + innerRadius * vutils.sin(innerStartAngle));
|
|
15646
13756
|
}
|
|
15647
13757
|
}
|
|
15648
13758
|
}
|
|
@@ -15650,7 +13760,7 @@
|
|
|
15650
13760
|
context.closePath();
|
|
15651
13761
|
}
|
|
15652
13762
|
else if (partStroke[3]) {
|
|
15653
|
-
context.lineTo(cx + outerRadius * cos(startAngle), cy + outerRadius * sin(startAngle));
|
|
13763
|
+
context.lineTo(cx + outerRadius * vutils.cos(startAngle), cy + outerRadius * vutils.sin(startAngle));
|
|
15654
13764
|
}
|
|
15655
13765
|
return collapsedToLine;
|
|
15656
13766
|
}
|
|
@@ -15769,10 +13879,10 @@
|
|
|
15769
13879
|
function getConicGradientAt(x, y, angle, color) {
|
|
15770
13880
|
const { stops, startAngle, endAngle } = color;
|
|
15771
13881
|
while (angle < 0) {
|
|
15772
|
-
angle += pi2;
|
|
13882
|
+
angle += vutils.pi2;
|
|
15773
13883
|
}
|
|
15774
|
-
while (angle > pi2) {
|
|
15775
|
-
angle -= pi2;
|
|
13884
|
+
while (angle > vutils.pi2) {
|
|
13885
|
+
angle -= vutils.pi2;
|
|
15776
13886
|
}
|
|
15777
13887
|
if (angle < startAngle) {
|
|
15778
13888
|
return stops[0].color;
|
|
@@ -16377,7 +14487,7 @@
|
|
|
16377
14487
|
if (!this.shouldUpdateShape() && this.cache) {
|
|
16378
14488
|
this.cache.verticalList.forEach(item => {
|
|
16379
14489
|
const w = item.reduce((a, b) => a + b.width, 0);
|
|
16380
|
-
width = max(w, width);
|
|
14490
|
+
width = vutils.max(w, width);
|
|
16381
14491
|
});
|
|
16382
14492
|
const dx = textDrawOffsetX(textAlign, width);
|
|
16383
14493
|
const height = this.cache.verticalList.length * lineHeight;
|
|
@@ -16420,7 +14530,7 @@
|
|
|
16420
14530
|
this.clearUpdateShapeTag();
|
|
16421
14531
|
this.cache.verticalList.forEach(item => {
|
|
16422
14532
|
const w = item.reduce((a, b) => a + b.width, 0);
|
|
16423
|
-
width = max(w, width);
|
|
14533
|
+
width = vutils.max(w, width);
|
|
16424
14534
|
});
|
|
16425
14535
|
const dx = textDrawOffsetX(textAlign, width);
|
|
16426
14536
|
const height = this.cache.verticalList.length * lineHeight;
|
|
@@ -16467,7 +14577,7 @@
|
|
|
16467
14577
|
class WrapText extends Text {
|
|
16468
14578
|
_isValid() {
|
|
16469
14579
|
const { text } = this.attribute;
|
|
16470
|
-
if (isArray
|
|
14580
|
+
if (vutils.isArray(text)) {
|
|
16471
14581
|
return !text.every((t) => t == null || t === '');
|
|
16472
14582
|
}
|
|
16473
14583
|
return text != null && text !== '';
|
|
@@ -16603,7 +14713,7 @@
|
|
|
16603
14713
|
|
|
16604
14714
|
class BaseSymbol {
|
|
16605
14715
|
bounds(size, bounds) {
|
|
16606
|
-
if (isNumber
|
|
14716
|
+
if (vutils.isNumber(size)) {
|
|
16607
14717
|
const halfS = size / 2;
|
|
16608
14718
|
bounds.x1 = -halfS;
|
|
16609
14719
|
bounds.x2 = halfS;
|
|
@@ -16621,10 +14731,10 @@
|
|
|
16621
14731
|
|
|
16622
14732
|
function circle(ctx, r, x, y, z) {
|
|
16623
14733
|
if (z) {
|
|
16624
|
-
ctx.arc(x, y, r, 0, tau, false, z);
|
|
14734
|
+
ctx.arc(x, y, r, 0, vutils.tau, false, z);
|
|
16625
14735
|
}
|
|
16626
14736
|
else {
|
|
16627
|
-
ctx.arc(x, y, r, 0, tau);
|
|
14737
|
+
ctx.arc(x, y, r, 0, vutils.tau);
|
|
16628
14738
|
}
|
|
16629
14739
|
return false;
|
|
16630
14740
|
}
|
|
@@ -16789,15 +14899,15 @@
|
|
|
16789
14899
|
var triangle = new TriangleSymbol();
|
|
16790
14900
|
|
|
16791
14901
|
const kr = Math.sin(Math.PI / 10) / Math.sin((7 * Math.PI) / 10);
|
|
16792
|
-
const kx = Math.sin(tau / 10) * kr;
|
|
16793
|
-
const ky = -Math.cos(tau / 10) * kr;
|
|
14902
|
+
const kx = Math.sin(vutils.tau / 10) * kr;
|
|
14903
|
+
const ky = -Math.cos(vutils.tau / 10) * kr;
|
|
16794
14904
|
function star(ctx, r, transX, transY) {
|
|
16795
14905
|
const x = kx * r;
|
|
16796
14906
|
const y = ky * r;
|
|
16797
14907
|
ctx.moveTo(transX, -r + transY);
|
|
16798
14908
|
ctx.lineTo(x + transX, y + transY);
|
|
16799
14909
|
for (let i = 1; i < 5; ++i) {
|
|
16800
|
-
const a = (tau * i) / 5;
|
|
14910
|
+
const a = (vutils.tau * i) / 5;
|
|
16801
14911
|
const c = Math.cos(a);
|
|
16802
14912
|
const s = Math.sin(a);
|
|
16803
14913
|
ctx.lineTo(s * r + transX, -c * r + transY);
|
|
@@ -16823,7 +14933,7 @@
|
|
|
16823
14933
|
}
|
|
16824
14934
|
var star$1 = new StarSymbol();
|
|
16825
14935
|
|
|
16826
|
-
const sqrt3$1 = sqrt(3);
|
|
14936
|
+
const sqrt3$1 = vutils.sqrt(3);
|
|
16827
14937
|
function arrow(ctx, r, transX, transY) {
|
|
16828
14938
|
const triangleH = r;
|
|
16829
14939
|
const trangleBottomSide = triangleH / sqrt3$1;
|
|
@@ -16904,8 +15014,8 @@
|
|
|
16904
15014
|
var stroke$1 = new StrokeSymbol();
|
|
16905
15015
|
|
|
16906
15016
|
const c = -0.5;
|
|
16907
|
-
const s = sqrt(3) / 2;
|
|
16908
|
-
const k = 1 / sqrt(12);
|
|
15017
|
+
const s = vutils.sqrt(3) / 2;
|
|
15018
|
+
const k = 1 / vutils.sqrt(12);
|
|
16909
15019
|
function wye(ctx, r, transX, transY) {
|
|
16910
15020
|
const x0 = r / 2;
|
|
16911
15021
|
const y0 = r * k;
|
|
@@ -17035,7 +15145,7 @@
|
|
|
17035
15145
|
}
|
|
17036
15146
|
var triangleDown = new TriangleDownSymbol();
|
|
17037
15147
|
|
|
17038
|
-
const sqrt3 = sqrt(3);
|
|
15148
|
+
const sqrt3 = vutils.sqrt(3);
|
|
17039
15149
|
function thinTriangle(ctx, r, x, y) {
|
|
17040
15150
|
const h = r * sqrt3;
|
|
17041
15151
|
ctx.moveTo(x, y + (-h / 3) * 2);
|
|
@@ -17248,11 +15358,11 @@
|
|
|
17248
15358
|
this.pathStr = 'M-0.5,-0.5h1v1h-1Z';
|
|
17249
15359
|
}
|
|
17250
15360
|
draw(ctx, size, x, y) {
|
|
17251
|
-
const rectSize = isNumber
|
|
15361
|
+
const rectSize = vutils.isNumber(size) ? [size, size] : size;
|
|
17252
15362
|
return rect(ctx, rectSize, x, y);
|
|
17253
15363
|
}
|
|
17254
15364
|
drawOffset(ctx, size, x, y, offset) {
|
|
17255
|
-
const rectSize = isNumber
|
|
15365
|
+
const rectSize = vutils.isNumber(size)
|
|
17256
15366
|
? [size + 2 * offset, size + 2 * offset]
|
|
17257
15367
|
: [size[0] + 2 * offset, size[1] + 2 * offset];
|
|
17258
15368
|
return rect(ctx, rectSize, x, y);
|
|
@@ -17260,12 +15370,12 @@
|
|
|
17260
15370
|
}
|
|
17261
15371
|
var rect$1 = new RectSymbol();
|
|
17262
15372
|
|
|
17263
|
-
const tempBounds = new AABBBounds();
|
|
15373
|
+
const tempBounds = new vutils.AABBBounds();
|
|
17264
15374
|
class CustomSymbolClass {
|
|
17265
15375
|
constructor(type, path, isSvg = false) {
|
|
17266
15376
|
this.pathStr = '';
|
|
17267
15377
|
this.type = type;
|
|
17268
|
-
if (isArray
|
|
15378
|
+
if (vutils.isArray(path)) {
|
|
17269
15379
|
this.svgCache = path;
|
|
17270
15380
|
}
|
|
17271
15381
|
else {
|
|
@@ -17377,7 +15487,7 @@
|
|
|
17377
15487
|
}
|
|
17378
15488
|
_isValid() {
|
|
17379
15489
|
const { size } = this.attribute;
|
|
17380
|
-
return isArray
|
|
15490
|
+
return vutils.isArray(size) ? size.length === 2 && size.every(this._validNumber) : this._validNumber(size);
|
|
17381
15491
|
}
|
|
17382
15492
|
doUpdateParsedPath() {
|
|
17383
15493
|
const symbolTheme = getTheme(this).symbol;
|
|
@@ -17399,8 +15509,8 @@
|
|
|
17399
15509
|
if (!svg) {
|
|
17400
15510
|
return null;
|
|
17401
15511
|
}
|
|
17402
|
-
const path = isArray
|
|
17403
|
-
const b = new AABBBounds();
|
|
15512
|
+
const path = vutils.isArray(svg.path) ? svg.path : [svg.path];
|
|
15513
|
+
const b = new vutils.AABBBounds();
|
|
17404
15514
|
const cacheList = [];
|
|
17405
15515
|
path.forEach((item) => {
|
|
17406
15516
|
const cache = new CustomPath2D().fromString(item.d);
|
|
@@ -17420,7 +15530,7 @@
|
|
|
17420
15530
|
});
|
|
17421
15531
|
const width = b.width();
|
|
17422
15532
|
const height = b.height();
|
|
17423
|
-
const maxWH = max(width, height);
|
|
15533
|
+
const maxWH = vutils.max(width, height);
|
|
17424
15534
|
const scale = 1 / maxWH;
|
|
17425
15535
|
cacheList.forEach(cache => cache.path.transform(0, 0, scale, scale));
|
|
17426
15536
|
this._parsedPath = new CustomSymbolClass(symbolType, cacheList, true);
|
|
@@ -17430,7 +15540,7 @@
|
|
|
17430
15540
|
const cache = new CustomPath2D().fromString(symbolType);
|
|
17431
15541
|
const width = cache.bounds.width();
|
|
17432
15542
|
const height = cache.bounds.height();
|
|
17433
|
-
const maxWH = max(width, height);
|
|
15543
|
+
const maxWH = vutils.max(width, height);
|
|
17434
15544
|
const scale = 1 / maxWH;
|
|
17435
15545
|
cache.transform(0, 0, scale, scale);
|
|
17436
15546
|
this._parsedPath = new CustomSymbolClass(symbolType, cache);
|
|
@@ -17468,7 +15578,7 @@
|
|
|
17468
15578
|
const size = this.attribute.size;
|
|
17469
15579
|
const x = 0;
|
|
17470
15580
|
const y = 0;
|
|
17471
|
-
const formattedSize = isArray
|
|
15581
|
+
const formattedSize = vutils.isArray(size) ? size : [size, size];
|
|
17472
15582
|
return symbolInstance.path
|
|
17473
15583
|
? new CustomPath2D().fromCustomPath2D(symbolInstance.path, x, y, formattedSize[0], formattedSize[1])
|
|
17474
15584
|
: new CustomPath2D().fromString(symbolInstance.pathStr, x, y, formattedSize[0], formattedSize[1]);
|
|
@@ -17659,7 +15769,7 @@
|
|
|
17659
15769
|
findFace() {
|
|
17660
15770
|
const faces = { polygons: [], vertices: [], edges: [] };
|
|
17661
15771
|
const rectTheme = getTheme(this).rect3d;
|
|
17662
|
-
const { width = rectTheme.width, height = rectTheme.width, length = min(rectTheme.width, rectTheme.height) } = this.attribute;
|
|
15772
|
+
const { width = rectTheme.width, height = rectTheme.width, length = vutils.min(rectTheme.width, rectTheme.height) } = this.attribute;
|
|
17663
15773
|
for (let i = 0; i < CUBE_VERTICES.length; i++) {
|
|
17664
15774
|
const v = CUBE_VERTICES[i];
|
|
17665
15775
|
faces.vertices.push([v[0] * width, v[1] * height, v[2] * length]);
|
|
@@ -18426,7 +16536,7 @@
|
|
|
18426
16536
|
}
|
|
18427
16537
|
}
|
|
18428
16538
|
this.onBeforeAttributeUpdate = (val, attributes, key) => {
|
|
18429
|
-
if ((isArray
|
|
16539
|
+
if ((vutils.isArray(key) && key.indexOf('margin') !== -1) || key === 'margin') {
|
|
18430
16540
|
if (attributes.margin) {
|
|
18431
16541
|
const marginArray = parsePadding(attributes.margin);
|
|
18432
16542
|
if (typeof marginArray === 'number') {
|
|
@@ -19033,7 +17143,7 @@
|
|
|
19033
17143
|
if (attribute.path instanceof CustomPath2D) {
|
|
19034
17144
|
return attribute.path;
|
|
19035
17145
|
}
|
|
19036
|
-
if (isNil
|
|
17146
|
+
if (vutils.isNil(this.cache)) {
|
|
19037
17147
|
this.doUpdatePathShape();
|
|
19038
17148
|
}
|
|
19039
17149
|
if (this.cache instanceof CustomPath2D) {
|
|
@@ -19057,7 +17167,7 @@
|
|
|
19057
17167
|
}
|
|
19058
17168
|
doUpdatePathShape() {
|
|
19059
17169
|
const attribute = this.attribute;
|
|
19060
|
-
if (isString
|
|
17170
|
+
if (vutils.isString(attribute.path, true)) {
|
|
19061
17171
|
this.cache = new CustomPath2D().fromString(attribute.path);
|
|
19062
17172
|
}
|
|
19063
17173
|
else if (attribute.customPath) {
|
|
@@ -19232,7 +17342,7 @@
|
|
|
19232
17342
|
return 0;
|
|
19233
17343
|
}
|
|
19234
17344
|
const deltaRadius = Math.abs(outerRadius - innerRadius);
|
|
19235
|
-
return Math.min(isNumber
|
|
17345
|
+
return Math.min(vutils.isNumber(cornerRadius, true)
|
|
19236
17346
|
? cornerRadius
|
|
19237
17347
|
: (deltaRadius * parseFloat(cornerRadius)) / 100, deltaRadius / 2);
|
|
19238
17348
|
}
|
|
@@ -19242,9 +17352,9 @@
|
|
|
19242
17352
|
const { cap = arcTheme.cap } = this.attribute;
|
|
19243
17353
|
const sign = endAngle - startAngle >= 0 ? 1 : -1;
|
|
19244
17354
|
const deltaAngle = endAngle - startAngle;
|
|
19245
|
-
startAngle = clampAngleByRadian(startAngle);
|
|
17355
|
+
startAngle = vutils.clampAngleByRadian(startAngle);
|
|
19246
17356
|
endAngle = startAngle + deltaAngle;
|
|
19247
|
-
if (cap && abs(deltaAngle) < pi2 - epsilon) {
|
|
17357
|
+
if (cap && vutils.abs(deltaAngle) < vutils.pi2 - vutils.epsilon) {
|
|
19248
17358
|
let startCap = 1;
|
|
19249
17359
|
let endCap = 1;
|
|
19250
17360
|
if (cap.length) {
|
|
@@ -19254,7 +17364,7 @@
|
|
|
19254
17364
|
const { outerRadius = arcTheme.outerRadius, innerRadius = arcTheme.innerRadius } = this.attribute;
|
|
19255
17365
|
const capWidth = Math.abs(outerRadius - innerRadius) / 2;
|
|
19256
17366
|
const capAngle = capWidth / outerRadius;
|
|
19257
|
-
if (capWidth > epsilon && outerRadius > epsilon) {
|
|
17367
|
+
if (capWidth > vutils.epsilon && outerRadius > vutils.epsilon) {
|
|
19258
17368
|
return {
|
|
19259
17369
|
startAngle: startAngle - sign * capAngle * startCap,
|
|
19260
17370
|
endAngle: endAngle + sign * capAngle * endCap,
|
|
@@ -19271,8 +17381,8 @@
|
|
|
19271
17381
|
getParsePadAngle(startAngle, endAngle) {
|
|
19272
17382
|
const arcTheme = getTheme(this).arc;
|
|
19273
17383
|
const { outerRadius = arcTheme.outerRadius, innerRadius = arcTheme.innerRadius, padAngle = arcTheme.padAngle } = this.attribute;
|
|
19274
|
-
const { padRadius = sqrt(outerRadius * outerRadius + innerRadius * innerRadius) } = this.attribute;
|
|
19275
|
-
const deltaAngle = abs(endAngle - startAngle);
|
|
17384
|
+
const { padRadius = vutils.sqrt(outerRadius * outerRadius + innerRadius * innerRadius) } = this.attribute;
|
|
17385
|
+
const deltaAngle = vutils.abs(endAngle - startAngle);
|
|
19276
17386
|
let outerStartAngle = startAngle;
|
|
19277
17387
|
let outerEndAngle = endAngle;
|
|
19278
17388
|
let innerStartAngle = startAngle;
|
|
@@ -19280,11 +17390,11 @@
|
|
|
19280
17390
|
const halfPadAngle = padAngle / 2;
|
|
19281
17391
|
let innerDeltaAngle = deltaAngle;
|
|
19282
17392
|
let outerDeltaAngle = deltaAngle;
|
|
19283
|
-
if (halfPadAngle > epsilon && padRadius > epsilon) {
|
|
17393
|
+
if (halfPadAngle > vutils.epsilon && padRadius > vutils.epsilon) {
|
|
19284
17394
|
const sign = endAngle > startAngle ? 1 : -1;
|
|
19285
|
-
let p0 = asin((Number(padRadius) / innerRadius) * sin(halfPadAngle));
|
|
19286
|
-
let p1 = asin((Number(padRadius) / outerRadius) * sin(halfPadAngle));
|
|
19287
|
-
if ((innerDeltaAngle -= p0 * 2) > epsilon) {
|
|
17395
|
+
let p0 = vutils.asin((Number(padRadius) / innerRadius) * vutils.sin(halfPadAngle));
|
|
17396
|
+
let p1 = vutils.asin((Number(padRadius) / outerRadius) * vutils.sin(halfPadAngle));
|
|
17397
|
+
if ((innerDeltaAngle -= p0 * 2) > vutils.epsilon) {
|
|
19288
17398
|
p0 *= sign;
|
|
19289
17399
|
innerStartAngle += p0;
|
|
19290
17400
|
innerEndAngle -= p0;
|
|
@@ -19293,7 +17403,7 @@
|
|
|
19293
17403
|
innerDeltaAngle = 0;
|
|
19294
17404
|
innerStartAngle = innerEndAngle = (startAngle + endAngle) / 2;
|
|
19295
17405
|
}
|
|
19296
|
-
if ((outerDeltaAngle -= p1 * 2) > epsilon) {
|
|
17406
|
+
if ((outerDeltaAngle -= p1 * 2) > vutils.epsilon) {
|
|
19297
17407
|
p1 *= sign;
|
|
19298
17408
|
outerStartAngle += p1;
|
|
19299
17409
|
outerEndAngle -= p1;
|
|
@@ -19353,7 +17463,7 @@
|
|
|
19353
17463
|
const { startAngle, endAngle } = this.getParsedAngle();
|
|
19354
17464
|
let innerRadius = attribute.innerRadius;
|
|
19355
17465
|
let outerRadius = attribute.outerRadius;
|
|
19356
|
-
const deltaAngle = abs(endAngle - startAngle);
|
|
17466
|
+
const deltaAngle = vutils.abs(endAngle - startAngle);
|
|
19357
17467
|
const clockwise = endAngle > startAngle;
|
|
19358
17468
|
if (outerRadius < innerRadius) {
|
|
19359
17469
|
const temp = outerRadius;
|
|
@@ -19361,22 +17471,22 @@
|
|
|
19361
17471
|
innerRadius = temp;
|
|
19362
17472
|
}
|
|
19363
17473
|
const path = new CustomPath2D();
|
|
19364
|
-
if (outerRadius <= epsilon) {
|
|
17474
|
+
if (outerRadius <= vutils.epsilon) {
|
|
19365
17475
|
path.moveTo(x, y);
|
|
19366
17476
|
}
|
|
19367
|
-
else if (deltaAngle >= pi2 - epsilon) {
|
|
19368
|
-
path.moveTo(x + outerRadius * cos(startAngle), y + outerRadius * sin(startAngle));
|
|
17477
|
+
else if (deltaAngle >= vutils.pi2 - vutils.epsilon) {
|
|
17478
|
+
path.moveTo(x + outerRadius * vutils.cos(startAngle), y + outerRadius * vutils.sin(startAngle));
|
|
19369
17479
|
path.arc(x, y, outerRadius, startAngle, endAngle, !clockwise);
|
|
19370
|
-
if (innerRadius > epsilon) {
|
|
19371
|
-
path.moveTo(x + innerRadius * cos(endAngle), y + innerRadius * sin(endAngle));
|
|
17480
|
+
if (innerRadius > vutils.epsilon) {
|
|
17481
|
+
path.moveTo(x + innerRadius * vutils.cos(endAngle), y + innerRadius * vutils.sin(endAngle));
|
|
19372
17482
|
path.arc(x, y, innerRadius, endAngle, startAngle, clockwise);
|
|
19373
17483
|
}
|
|
19374
17484
|
}
|
|
19375
17485
|
else {
|
|
19376
|
-
const xors = outerRadius * cos(startAngle);
|
|
19377
|
-
const yors = outerRadius * sin(startAngle);
|
|
19378
|
-
const xire = innerRadius * cos(endAngle);
|
|
19379
|
-
const yire = innerRadius * sin(endAngle);
|
|
17486
|
+
const xors = outerRadius * vutils.cos(startAngle);
|
|
17487
|
+
const yors = outerRadius * vutils.sin(startAngle);
|
|
17488
|
+
const xire = innerRadius * vutils.cos(endAngle);
|
|
17489
|
+
const yire = innerRadius * vutils.sin(endAngle);
|
|
19380
17490
|
path.moveTo(x + xors, y + yors);
|
|
19381
17491
|
path.arc(x, y, outerRadius, startAngle, endAngle, !clockwise);
|
|
19382
17492
|
path.lineTo(x + xire, y + yire);
|
|
@@ -19523,14 +17633,14 @@
|
|
|
19523
17633
|
for (let j = i + 1; j < kList.length; j++) {
|
|
19524
17634
|
if (kList[i] === kList[j]) {
|
|
19525
17635
|
find = true;
|
|
19526
|
-
const d1 = PointService.distancePP(pointsMap[i].p, pointsMap[i + 1].p);
|
|
17636
|
+
const d1 = vutils.PointService.distancePP(pointsMap[i].p, pointsMap[i + 1].p);
|
|
19527
17637
|
pointsMap[i].d = d1;
|
|
19528
17638
|
pointsMap[i + 1].d = d1;
|
|
19529
|
-
maxD = max(maxD, d1);
|
|
19530
|
-
const d2 = PointService.distancePP(pointsMap[j].p, pointsMap[j + 1].p);
|
|
17639
|
+
maxD = vutils.max(maxD, d1);
|
|
17640
|
+
const d2 = vutils.PointService.distancePP(pointsMap[j].p, pointsMap[j + 1].p);
|
|
19531
17641
|
pointsMap[j].d = d2;
|
|
19532
17642
|
pointsMap[j + 1].d = d2;
|
|
19533
|
-
maxD = max(maxD, d2);
|
|
17643
|
+
maxD = vutils.max(maxD, d2);
|
|
19534
17644
|
}
|
|
19535
17645
|
if (find) {
|
|
19536
17646
|
break;
|
|
@@ -19657,7 +17767,7 @@
|
|
|
19657
17767
|
}
|
|
19658
17768
|
allocate(a, b, c, d, e, f) {
|
|
19659
17769
|
if (!this.pools.length) {
|
|
19660
|
-
return new Matrix(a, b, c, d, e, f);
|
|
17770
|
+
return new vutils.Matrix(a, b, c, d, e, f);
|
|
19661
17771
|
}
|
|
19662
17772
|
const m = this.pools.pop();
|
|
19663
17773
|
m.a = a;
|
|
@@ -19670,7 +17780,7 @@
|
|
|
19670
17780
|
}
|
|
19671
17781
|
allocateByObj(matrix) {
|
|
19672
17782
|
if (!this.pools.length) {
|
|
19673
|
-
return new Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
|
|
17783
|
+
return new vutils.Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
|
|
19674
17784
|
}
|
|
19675
17785
|
const m = this.pools.pop();
|
|
19676
17786
|
m.a = matrix.a;
|
|
@@ -20188,8 +18298,8 @@
|
|
|
20188
18298
|
'selfChange'
|
|
20189
18299
|
])
|
|
20190
18300
|
};
|
|
20191
|
-
this.tempAABBBounds1 = new AABBBounds();
|
|
20192
|
-
this.tempAABBBounds2 = new AABBBounds();
|
|
18301
|
+
this.tempAABBBounds1 = new vutils.AABBBounds();
|
|
18302
|
+
this.tempAABBBounds2 = new vutils.AABBBounds();
|
|
20193
18303
|
}
|
|
20194
18304
|
onAttributeUpdate(graphic) {
|
|
20195
18305
|
if (this.hooks.onAttributeUpdate.taps.length) {
|
|
@@ -20360,7 +18470,7 @@
|
|
|
20360
18470
|
aabbBounds.union(tb1);
|
|
20361
18471
|
}
|
|
20362
18472
|
this.combindShadowAABBBounds(aabbBounds, graphic);
|
|
20363
|
-
transformBoundsWithMatrix(aabbBounds, aabbBounds, graphic.transMatrix);
|
|
18473
|
+
vutils.transformBoundsWithMatrix(aabbBounds, aabbBounds, graphic.transMatrix);
|
|
20364
18474
|
return aabbBounds;
|
|
20365
18475
|
}
|
|
20366
18476
|
updatePathAABBBounds(attribute, pathTheme, aabbBounds, graphic) {
|
|
@@ -20547,7 +18657,7 @@
|
|
|
20547
18657
|
}
|
|
20548
18658
|
updateCircleAABBBoundsAccurate(attribute, circleTheme, aabbBounds, graphic) {
|
|
20549
18659
|
const { startAngle = circleTheme.startAngle, endAngle = circleTheme.endAngle, radius = circleTheme.radius } = attribute;
|
|
20550
|
-
if (endAngle - startAngle > pi2 - epsilon) {
|
|
18660
|
+
if (endAngle - startAngle > vutils.pi2 - vutils.epsilon) {
|
|
20551
18661
|
aabbBounds.set(-radius, -radius, radius, radius);
|
|
20552
18662
|
}
|
|
20553
18663
|
else {
|
|
@@ -20596,10 +18706,10 @@
|
|
|
20596
18706
|
startAngle = endAngle;
|
|
20597
18707
|
endAngle = temp;
|
|
20598
18708
|
}
|
|
20599
|
-
if (outerRadius <= epsilon) {
|
|
18709
|
+
if (outerRadius <= vutils.epsilon) {
|
|
20600
18710
|
aabbBounds.set(0, 0, 0, 0);
|
|
20601
18711
|
}
|
|
20602
|
-
else if (Math.abs(endAngle - startAngle) > pi2 - epsilon) {
|
|
18712
|
+
else if (Math.abs(endAngle - startAngle) > vutils.pi2 - vutils.epsilon) {
|
|
20603
18713
|
aabbBounds.set(-outerRadius, -outerRadius, outerRadius, outerRadius);
|
|
20604
18714
|
}
|
|
20605
18715
|
else {
|
|
@@ -20633,7 +18743,7 @@
|
|
|
20633
18743
|
}
|
|
20634
18744
|
updateSymbolAABBBoundsImprecise(attribute, symbolTheme, aabbBounds, graphic) {
|
|
20635
18745
|
const { size = symbolTheme.size } = attribute;
|
|
20636
|
-
if (isArray
|
|
18746
|
+
if (vutils.isArray(size)) {
|
|
20637
18747
|
aabbBounds.set(-size[0] / 2, -size[1] / 2, size[0] / 2, size[1] / 2);
|
|
20638
18748
|
}
|
|
20639
18749
|
else {
|
|
@@ -20685,7 +18795,7 @@
|
|
|
20685
18795
|
aabbBounds.union(tb1);
|
|
20686
18796
|
}
|
|
20687
18797
|
this.combindShadowAABBBounds(aabbBounds, graphic);
|
|
20688
|
-
transformBoundsWithMatrix(aabbBounds, aabbBounds, graphic.transMatrix);
|
|
18798
|
+
vutils.transformBoundsWithMatrix(aabbBounds, aabbBounds, graphic.transMatrix);
|
|
20689
18799
|
}
|
|
20690
18800
|
};
|
|
20691
18801
|
exports.DefaultGraphicService = __decorate([
|
|
@@ -21023,7 +19133,7 @@
|
|
|
21023
19133
|
const startAngle = data.startAngle;
|
|
21024
19134
|
let endAngle = data.endAngle;
|
|
21025
19135
|
endAngle = _ea;
|
|
21026
|
-
const deltaAngle = abs(endAngle - startAngle);
|
|
19136
|
+
const deltaAngle = vutils.abs(endAngle - startAngle);
|
|
21027
19137
|
const clockwise = endAngle > startAngle;
|
|
21028
19138
|
let collapsedToLine = false;
|
|
21029
19139
|
if (outerRadius < innerRadius) {
|
|
@@ -21041,77 +19151,77 @@
|
|
|
21041
19151
|
const maxInnerCornerRadius = Math.max(innerCornerRadiusEnd, innerCornerRadiusStart);
|
|
21042
19152
|
let limitedOcr = maxOuterCornerRadius;
|
|
21043
19153
|
let limitedIcr = maxInnerCornerRadius;
|
|
21044
|
-
const xors = outerRadius * cos(outerStartAngle);
|
|
21045
|
-
const yors = outerRadius * sin(outerStartAngle);
|
|
21046
|
-
const xire = innerRadius * cos(innerEndAngle);
|
|
21047
|
-
const yire = innerRadius * sin(innerEndAngle);
|
|
19154
|
+
const xors = outerRadius * vutils.cos(outerStartAngle);
|
|
19155
|
+
const yors = outerRadius * vutils.sin(outerStartAngle);
|
|
19156
|
+
const xire = innerRadius * vutils.cos(innerEndAngle);
|
|
19157
|
+
const yire = innerRadius * vutils.sin(innerEndAngle);
|
|
21048
19158
|
let xore;
|
|
21049
19159
|
let yore;
|
|
21050
19160
|
let xirs;
|
|
21051
19161
|
let yirs;
|
|
21052
|
-
if (maxInnerCornerRadius > epsilon || maxOuterCornerRadius > epsilon) {
|
|
21053
|
-
xore = outerRadius * cos(outerEndAngle);
|
|
21054
|
-
yore = outerRadius * sin(outerEndAngle);
|
|
21055
|
-
xirs = innerRadius * cos(innerStartAngle);
|
|
21056
|
-
yirs = innerRadius * sin(innerStartAngle);
|
|
21057
|
-
if (deltaAngle < pi) {
|
|
19162
|
+
if (maxInnerCornerRadius > vutils.epsilon || maxOuterCornerRadius > vutils.epsilon) {
|
|
19163
|
+
xore = outerRadius * vutils.cos(outerEndAngle);
|
|
19164
|
+
yore = outerRadius * vutils.sin(outerEndAngle);
|
|
19165
|
+
xirs = innerRadius * vutils.cos(innerStartAngle);
|
|
19166
|
+
yirs = innerRadius * vutils.sin(innerStartAngle);
|
|
19167
|
+
if (deltaAngle < vutils.pi) {
|
|
21058
19168
|
const oc = intersect(xors, yors, xirs, yirs, xore, yore, xire, yire);
|
|
21059
19169
|
if (oc) {
|
|
21060
19170
|
const ax = xors - oc[0];
|
|
21061
19171
|
const ay = yors - oc[1];
|
|
21062
19172
|
const bx = xore - oc[0];
|
|
21063
19173
|
const by = yore - oc[1];
|
|
21064
|
-
const kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2);
|
|
21065
|
-
const lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
|
|
21066
|
-
limitedIcr = min(maxInnerCornerRadius, (innerRadius - lc) / (kc - 1));
|
|
21067
|
-
limitedOcr = min(maxOuterCornerRadius, (outerRadius - lc) / (kc + 1));
|
|
19174
|
+
const kc = 1 / vutils.sin(vutils.acos((ax * bx + ay * by) / (vutils.sqrt(ax * ax + ay * ay) * vutils.sqrt(bx * bx + by * by))) / 2);
|
|
19175
|
+
const lc = vutils.sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
|
|
19176
|
+
limitedIcr = vutils.min(maxInnerCornerRadius, (innerRadius - lc) / (kc - 1));
|
|
19177
|
+
limitedOcr = vutils.min(maxOuterCornerRadius, (outerRadius - lc) / (kc + 1));
|
|
21068
19178
|
}
|
|
21069
19179
|
}
|
|
21070
19180
|
}
|
|
21071
|
-
if (limitedOcr > epsilon) {
|
|
21072
|
-
const cornerRadiusStart = min(outerCornerRadiusStart, limitedOcr);
|
|
21073
|
-
const cornerRadiusEnd = min(outerCornerRadiusEnd, limitedOcr);
|
|
19181
|
+
if (limitedOcr > vutils.epsilon) {
|
|
19182
|
+
const cornerRadiusStart = vutils.min(outerCornerRadiusStart, limitedOcr);
|
|
19183
|
+
const cornerRadiusEnd = vutils.min(outerCornerRadiusEnd, limitedOcr);
|
|
21074
19184
|
const t0 = cornerTangents(xirs, yirs, xors, yors, outerRadius, cornerRadiusStart, Number(clockwise));
|
|
21075
19185
|
const t1 = cornerTangents(xore, yore, xire, yire, outerRadius, cornerRadiusEnd, Number(clockwise));
|
|
21076
19186
|
if (limitedOcr < maxOuterCornerRadius && cornerRadiusStart === cornerRadiusEnd) {
|
|
21077
19187
|
context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01);
|
|
21078
|
-
context.arc(cx + t0.cx, cy + t0.cy, limitedOcr, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !clockwise);
|
|
19188
|
+
context.arc(cx + t0.cx, cy + t0.cy, limitedOcr, vutils.atan2(t0.y01, t0.x01), vutils.atan2(t1.y01, t1.x01), !clockwise);
|
|
21079
19189
|
}
|
|
21080
19190
|
else {
|
|
21081
19191
|
const a1 = endAngle - capAngle - 0.03;
|
|
21082
|
-
const a2 = atan2(t1.y11, t1.x11);
|
|
19192
|
+
const a2 = vutils.atan2(t1.y11, t1.x11);
|
|
21083
19193
|
context.arc(cx, cy, outerRadius, a1, a2, !clockwise);
|
|
21084
19194
|
cornerRadiusEnd > 0 &&
|
|
21085
|
-
context.arc(cx + t1.cx, cy + t1.cy, cornerRadiusEnd, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !clockwise);
|
|
19195
|
+
context.arc(cx + t1.cx, cy + t1.cy, cornerRadiusEnd, vutils.atan2(t1.y11, t1.x11), vutils.atan2(t1.y01, t1.x01), !clockwise);
|
|
21086
19196
|
}
|
|
21087
19197
|
}
|
|
21088
19198
|
else {
|
|
21089
19199
|
context.moveTo(cx + xors, cy + yors);
|
|
21090
19200
|
}
|
|
21091
|
-
if (!(innerRadius > epsilon) || innerDeltaAngle < 0.001) {
|
|
19201
|
+
if (!(innerRadius > vutils.epsilon) || innerDeltaAngle < 0.001) {
|
|
21092
19202
|
context.lineTo(cx + xire, cy + yire);
|
|
21093
19203
|
collapsedToLine = true;
|
|
21094
19204
|
}
|
|
21095
|
-
else if (limitedIcr > epsilon) {
|
|
21096
|
-
const cornerRadiusStart = min(innerCornerRadiusStart, limitedIcr);
|
|
21097
|
-
const cornerRadiusEnd = min(innerCornerRadiusEnd, limitedIcr);
|
|
19205
|
+
else if (limitedIcr > vutils.epsilon) {
|
|
19206
|
+
const cornerRadiusStart = vutils.min(innerCornerRadiusStart, limitedIcr);
|
|
19207
|
+
const cornerRadiusEnd = vutils.min(innerCornerRadiusEnd, limitedIcr);
|
|
21098
19208
|
const t0 = cornerTangents(xire, yire, xore, yore, innerRadius, -cornerRadiusEnd, Number(clockwise));
|
|
21099
19209
|
const t1 = cornerTangents(xors, yors, xirs, yirs, innerRadius, -cornerRadiusStart, Number(clockwise));
|
|
21100
19210
|
context.lineTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01);
|
|
21101
19211
|
if (limitedIcr < maxInnerCornerRadius && cornerRadiusStart === cornerRadiusEnd) {
|
|
21102
|
-
const arcEndAngle = atan2(t1.y01, t1.x01);
|
|
21103
|
-
context.arc(cx + t0.cx, cy + t0.cy, limitedIcr, atan2(t0.y01, t0.x01), arcEndAngle, !clockwise);
|
|
19212
|
+
const arcEndAngle = vutils.atan2(t1.y01, t1.x01);
|
|
19213
|
+
context.arc(cx + t0.cx, cy + t0.cy, limitedIcr, vutils.atan2(t0.y01, t0.x01), arcEndAngle, !clockwise);
|
|
21104
19214
|
}
|
|
21105
19215
|
else {
|
|
21106
19216
|
cornerRadiusEnd > 0 &&
|
|
21107
|
-
context.arc(cx + t0.cx, cy + t0.cy, cornerRadiusEnd, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !clockwise);
|
|
21108
|
-
const a1 = atan2(t0.cy + t0.y11, t0.cx + t0.x11);
|
|
19217
|
+
context.arc(cx + t0.cx, cy + t0.cy, cornerRadiusEnd, vutils.atan2(t0.y01, t0.x01), vutils.atan2(t0.y11, t0.x11), !clockwise);
|
|
19218
|
+
const a1 = vutils.atan2(t0.cy + t0.y11, t0.cx + t0.x11);
|
|
21109
19219
|
const a2 = endAngle - capAngle - 0.03;
|
|
21110
19220
|
context.arc(cx, cy, innerRadius, a1, a2, clockwise);
|
|
21111
19221
|
}
|
|
21112
19222
|
}
|
|
21113
19223
|
else {
|
|
21114
|
-
context.lineTo(cx + innerRadius * cos(innerStartAngle), cy + innerRadius * sin(innerStartAngle));
|
|
19224
|
+
context.lineTo(cx + innerRadius * vutils.cos(innerStartAngle), cy + innerRadius * vutils.sin(innerStartAngle));
|
|
21115
19225
|
}
|
|
21116
19226
|
return collapsedToLine;
|
|
21117
19227
|
}
|
|
@@ -21125,10 +19235,10 @@
|
|
|
21125
19235
|
const { fVisible, sVisible, doFill, doStroke } = data;
|
|
21126
19236
|
const { outerRadius = arcAttribute.outerRadius, innerRadius = arcAttribute.innerRadius, cap = arcAttribute.cap, forceShowCap = arcAttribute.forceShowCap } = arc.attribute;
|
|
21127
19237
|
let conicalOffset = 0;
|
|
21128
|
-
const tempChangeConicalColor = ((isBoolean
|
|
19238
|
+
const tempChangeConicalColor = ((vutils.isBoolean(cap) && cap) || cap[0]) && fill.gradient === 'conical';
|
|
21129
19239
|
if (tempChangeConicalColor) {
|
|
21130
19240
|
const { sc, startAngle, endAngle } = arc.getParsedAngle();
|
|
21131
|
-
if (abs(endAngle - startAngle) < pi2 - epsilon) {
|
|
19241
|
+
if (vutils.abs(endAngle - startAngle) < vutils.pi2 - vutils.epsilon) {
|
|
21132
19242
|
conicalOffset = sc || 0;
|
|
21133
19243
|
fill.startAngle -= conicalOffset;
|
|
21134
19244
|
fill.endAngle -= conicalOffset;
|
|
@@ -21175,10 +19285,10 @@
|
|
|
21175
19285
|
context.stroke();
|
|
21176
19286
|
}
|
|
21177
19287
|
}
|
|
21178
|
-
if (((isBoolean
|
|
19288
|
+
if (((vutils.isBoolean(cap) && cap) || cap[1]) && forceShowCap) {
|
|
21179
19289
|
const { startAngle: sa, endAngle: ea } = arc.getParsedAngle();
|
|
21180
|
-
const deltaAngle = abs(ea - sa);
|
|
21181
|
-
if (deltaAngle >= pi2 - epsilon) {
|
|
19290
|
+
const deltaAngle = vutils.abs(ea - sa);
|
|
19291
|
+
if (deltaAngle >= vutils.pi2 - vutils.epsilon) {
|
|
21182
19292
|
context.beginPath();
|
|
21183
19293
|
const capWidth = Math.abs(outerRadius - innerRadius) / 2;
|
|
21184
19294
|
const capAngle = capWidth / outerRadius;
|
|
@@ -21423,7 +19533,7 @@
|
|
|
21423
19533
|
if (needMoveTo) {
|
|
21424
19534
|
path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ);
|
|
21425
19535
|
}
|
|
21426
|
-
drawSegItem$1(path, curve, min(_p, 1), params);
|
|
19536
|
+
drawSegItem$1(path, curve, vutils.min(_p, 1), params);
|
|
21427
19537
|
needMoveTo = false;
|
|
21428
19538
|
}
|
|
21429
19539
|
}
|
|
@@ -21514,7 +19624,7 @@
|
|
|
21514
19624
|
offsetZ: z
|
|
21515
19625
|
});
|
|
21516
19626
|
if (line.cache &&
|
|
21517
|
-
!isArray
|
|
19627
|
+
!vutils.isArray(line.cache) &&
|
|
21518
19628
|
line.cache.curves.every(c => c.defined) &&
|
|
21519
19629
|
line.attribute.curveType &&
|
|
21520
19630
|
line.attribute.curveType.includes('Closed')) {
|
|
@@ -21542,7 +19652,7 @@
|
|
|
21542
19652
|
}
|
|
21543
19653
|
}
|
|
21544
19654
|
let { connectedType, connectedX, connectedY, connectedStyle } = attribute;
|
|
21545
|
-
if (isArray
|
|
19655
|
+
if (vutils.isArray(defaultAttribute)) {
|
|
21546
19656
|
connectedType = (_b = connectedType !== null && connectedType !== void 0 ? connectedType : defaultAttribute[0].connectedType) !== null && _b !== void 0 ? _b : defaultAttribute[1].connectedType;
|
|
21547
19657
|
connectedX = (_c = connectedX !== null && connectedX !== void 0 ? connectedX : defaultAttribute[0].connectedX) !== null && _c !== void 0 ? _c : defaultAttribute[1].connectedX;
|
|
21548
19658
|
connectedY = (_d = connectedY !== null && connectedY !== void 0 ? connectedY : defaultAttribute[0].connectedY) !== null && _d !== void 0 ? _d : defaultAttribute[1].connectedY;
|
|
@@ -21569,7 +19679,7 @@
|
|
|
21569
19679
|
zeroY: connectedY
|
|
21570
19680
|
});
|
|
21571
19681
|
const da = [];
|
|
21572
|
-
if (isArray
|
|
19682
|
+
if (vutils.isArray(defaultAttribute)) {
|
|
21573
19683
|
defaultAttribute.forEach(i => da.push(i));
|
|
21574
19684
|
}
|
|
21575
19685
|
else {
|
|
@@ -21701,7 +19811,7 @@
|
|
|
21701
19811
|
const _cr = (totalDrawLength - drawedLengthUntilLast) / curSegLength;
|
|
21702
19812
|
drawedLengthUntilLast += curSegLength;
|
|
21703
19813
|
if (_cr > 0) {
|
|
21704
|
-
skip = this.drawSegmentItem(context, cache, !!fill, !!stroke, fillOpacity, strokeOpacity, segments[index], [lineAttribute, line.attribute], min(_cr, 1), clipRangeByDimension, x, y, line, fillCb, strokeCb);
|
|
19814
|
+
skip = this.drawSegmentItem(context, cache, !!fill, !!stroke, fillOpacity, strokeOpacity, segments[index], [lineAttribute, line.attribute], vutils.min(_cr, 1), clipRangeByDimension, x, y, line, fillCb, strokeCb);
|
|
21705
19815
|
}
|
|
21706
19816
|
});
|
|
21707
19817
|
}
|
|
@@ -21818,8 +19928,8 @@
|
|
|
21818
19928
|
let { direction } = params || {};
|
|
21819
19929
|
const { curves: topCurves } = top;
|
|
21820
19930
|
const endP = (_a = topCurves[topCurves.length - 1].p3) !== null && _a !== void 0 ? _a : topCurves[topCurves.length - 1].p1;
|
|
21821
|
-
const xTotalLength = abs(endP.x - topCurves[0].p0.x);
|
|
21822
|
-
const yTotalLength = abs(endP.y - topCurves[0].p0.y);
|
|
19931
|
+
const xTotalLength = vutils.abs(endP.x - topCurves[0].p0.x);
|
|
19932
|
+
const yTotalLength = vutils.abs(endP.y - topCurves[0].p0.y);
|
|
21823
19933
|
direction = direction !== null && direction !== void 0 ? direction : (xTotalLength > yTotalLength ? exports.Direction.ROW : exports.Direction.COLUMN);
|
|
21824
19934
|
if (!Number.isFinite(xTotalLength)) {
|
|
21825
19935
|
direction = exports.Direction.COLUMN;
|
|
@@ -22165,7 +20275,7 @@
|
|
|
22165
20275
|
const _cr = (totalDrawLength - drawedLengthUntilLast) / curSegLength;
|
|
22166
20276
|
drawedLengthUntilLast += curSegLength;
|
|
22167
20277
|
if (_cr > 0) {
|
|
22168
|
-
skip = this.drawSegmentItem(context, cache, doFill, fillOpacity, doStroke, strokeOpacity, segments[index], [areaAttribute, area.attribute], min(_cr, 1), x, y, z, area, drawContext, fillCb, strokeCb);
|
|
20278
|
+
skip = this.drawSegmentItem(context, cache, doFill, fillOpacity, doStroke, strokeOpacity, segments[index], [areaAttribute, area.attribute], vutils.min(_cr, 1), x, y, z, area, drawContext, fillCb, strokeCb);
|
|
22169
20279
|
}
|
|
22170
20280
|
});
|
|
22171
20281
|
}
|
|
@@ -22193,7 +20303,7 @@
|
|
|
22193
20303
|
let { connectedType, connectedX, connectedY, connectedStyle } = attribute;
|
|
22194
20304
|
const da = [];
|
|
22195
20305
|
if (connect) {
|
|
22196
|
-
if (isArray
|
|
20306
|
+
if (vutils.isArray(defaultAttribute)) {
|
|
22197
20307
|
connectedType = (_a = connectedType !== null && connectedType !== void 0 ? connectedType : defaultAttribute[0].connectedType) !== null && _a !== void 0 ? _a : defaultAttribute[1].connectedType;
|
|
22198
20308
|
connectedX = (_b = connectedX !== null && connectedX !== void 0 ? connectedX : defaultAttribute[0].connectedX) !== null && _b !== void 0 ? _b : defaultAttribute[1].connectedX;
|
|
22199
20309
|
connectedY = (_c = connectedY !== null && connectedY !== void 0 ? connectedY : defaultAttribute[0].connectedY) !== null && _c !== void 0 ? _c : defaultAttribute[1].connectedY;
|
|
@@ -22208,7 +20318,7 @@
|
|
|
22208
20318
|
if (connectedType !== 'connect' && connectedType !== 'zero') {
|
|
22209
20319
|
connectedType = 'none';
|
|
22210
20320
|
}
|
|
22211
|
-
if (isArray
|
|
20321
|
+
if (vutils.isArray(defaultAttribute)) {
|
|
22212
20322
|
defaultAttribute.forEach(i => da.push(i));
|
|
22213
20323
|
}
|
|
22214
20324
|
else {
|
|
@@ -22238,8 +20348,8 @@
|
|
|
22238
20348
|
startP = points[0];
|
|
22239
20349
|
endP = points[points.length - 1];
|
|
22240
20350
|
}
|
|
22241
|
-
const xTotalLength = abs(endP.x - startP.x);
|
|
22242
|
-
const yTotalLength = abs(endP.y - startP.y);
|
|
20351
|
+
const xTotalLength = vutils.abs(endP.x - startP.x);
|
|
20352
|
+
const yTotalLength = vutils.abs(endP.y - startP.y);
|
|
22243
20353
|
direction = xTotalLength > yTotalLength ? exports.Direction.ROW : exports.Direction.COLUMN;
|
|
22244
20354
|
drawAreaSegments(context.camera ? context : context.nativeContext, cache, clipRange, {
|
|
22245
20355
|
offsetX,
|
|
@@ -22270,7 +20380,7 @@
|
|
|
22270
20380
|
}
|
|
22271
20381
|
else {
|
|
22272
20382
|
const { stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke } = attribute;
|
|
22273
|
-
if (isArray
|
|
20383
|
+
if (vutils.isArray(stroke) && (stroke[0] || stroke[2]) && stroke[1] === false) {
|
|
22274
20384
|
context.beginPath();
|
|
22275
20385
|
drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, direction === exports.Direction.ROW ? 'x' : 'y', {
|
|
22276
20386
|
offsetX,
|
|
@@ -22355,10 +20465,10 @@
|
|
|
22355
20465
|
__metadata("design:paramtypes", [Object])
|
|
22356
20466
|
], exports.DefaultCanvasPathRender);
|
|
22357
20467
|
|
|
22358
|
-
const halfPi = pi / 2;
|
|
20468
|
+
const halfPi = vutils.pi / 2;
|
|
22359
20469
|
function createRectPath(path, x, y, width, height, rectCornerRadius) {
|
|
22360
20470
|
let cornerRadius;
|
|
22361
|
-
if (isNumber
|
|
20471
|
+
if (vutils.isNumber(rectCornerRadius, true)) {
|
|
22362
20472
|
cornerRadius = [
|
|
22363
20473
|
rectCornerRadius,
|
|
22364
20474
|
rectCornerRadius,
|
|
@@ -22415,28 +20525,28 @@
|
|
|
22415
20525
|
const leftBottomPoint2 = [leftBottom[0], leftBottom[1] - _cornerRadius[3]];
|
|
22416
20526
|
path.moveTo(leftTopPoint1[0], leftTopPoint1[1]);
|
|
22417
20527
|
path.lineTo(rightTopPoint1[0], rightTopPoint1[1]);
|
|
22418
|
-
if (!arrayEqual(rightTopPoint1, rightTopPoint2)) {
|
|
20528
|
+
if (!vutils.arrayEqual(rightTopPoint1, rightTopPoint2)) {
|
|
22419
20529
|
const centerX = rightTopPoint1[0];
|
|
22420
20530
|
const centerY = rightTopPoint1[1] + _cornerRadius[1];
|
|
22421
20531
|
path.arc(centerX, centerY, _cornerRadius[1], -halfPi, 0, false);
|
|
22422
20532
|
}
|
|
22423
20533
|
path.lineTo(rightBottomPoint2[0], rightBottomPoint2[1]);
|
|
22424
|
-
if (!arrayEqual(rightBottomPoint1, rightBottomPoint2)) {
|
|
20534
|
+
if (!vutils.arrayEqual(rightBottomPoint1, rightBottomPoint2)) {
|
|
22425
20535
|
const centerX = rightBottomPoint2[0] - _cornerRadius[2];
|
|
22426
20536
|
const centerY = rightBottomPoint2[1];
|
|
22427
20537
|
path.arc(centerX, centerY, _cornerRadius[2], 0, halfPi, false);
|
|
22428
20538
|
}
|
|
22429
20539
|
path.lineTo(leftBottomPoint1[0], leftBottomPoint1[1]);
|
|
22430
|
-
if (!arrayEqual(leftBottomPoint1, leftBottomPoint2)) {
|
|
20540
|
+
if (!vutils.arrayEqual(leftBottomPoint1, leftBottomPoint2)) {
|
|
22431
20541
|
const centerX = leftBottomPoint1[0];
|
|
22432
20542
|
const centerY = leftBottomPoint1[1] - _cornerRadius[3];
|
|
22433
|
-
path.arc(centerX, centerY, _cornerRadius[3], halfPi, pi, false);
|
|
20543
|
+
path.arc(centerX, centerY, _cornerRadius[3], halfPi, vutils.pi, false);
|
|
22434
20544
|
}
|
|
22435
20545
|
path.lineTo(leftTopPoint2[0], leftTopPoint2[1]);
|
|
22436
|
-
if (!arrayEqual(leftTopPoint1, leftTopPoint2)) {
|
|
20546
|
+
if (!vutils.arrayEqual(leftTopPoint1, leftTopPoint2)) {
|
|
22437
20547
|
const centerX = leftTopPoint1[0];
|
|
22438
20548
|
const centerY = leftTopPoint1[1] + _cornerRadius[0];
|
|
22439
|
-
path.arc(centerX, centerY, _cornerRadius[0], pi, pi + halfPi, false);
|
|
20549
|
+
path.arc(centerX, centerY, _cornerRadius[0], vutils.pi, vutils.pi + halfPi, false);
|
|
22440
20550
|
}
|
|
22441
20551
|
path.closePath();
|
|
22442
20552
|
return path;
|
|
@@ -22466,7 +20576,7 @@
|
|
|
22466
20576
|
if (!(fVisible || sVisible || fillCb || strokeCb || background)) {
|
|
22467
20577
|
return;
|
|
22468
20578
|
}
|
|
22469
|
-
if (cornerRadius === 0 || (isArray
|
|
20579
|
+
if (cornerRadius === 0 || (vutils.isArray(cornerRadius) && cornerRadius.every(num => num === 0))) {
|
|
22470
20580
|
context.beginPath();
|
|
22471
20581
|
context.rect(x, y, width, height);
|
|
22472
20582
|
}
|
|
@@ -22727,7 +20837,7 @@
|
|
|
22727
20837
|
let totalW = 0;
|
|
22728
20838
|
verticalList.forEach(verticalData => {
|
|
22729
20839
|
const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);
|
|
22730
|
-
totalW = max(_w, totalW);
|
|
20840
|
+
totalW = vutils.max(_w, totalW);
|
|
22731
20841
|
});
|
|
22732
20842
|
let offsetY = 0;
|
|
22733
20843
|
let offsetX = 0;
|
|
@@ -22983,7 +21093,7 @@
|
|
|
22983
21093
|
}
|
|
22984
21094
|
const { fVisible, sVisible, doFill, doStroke } = data;
|
|
22985
21095
|
context.beginPath();
|
|
22986
|
-
if (cornerRadius <= 0 || (isArray
|
|
21096
|
+
if (cornerRadius <= 0 || (vutils.isArray(cornerRadius) && cornerRadius.every(num => num === 0))) {
|
|
22987
21097
|
drawPolygon(context.camera ? context : context.nativeContext, points, x, y);
|
|
22988
21098
|
}
|
|
22989
21099
|
else {
|
|
@@ -23055,7 +21165,7 @@
|
|
|
23055
21165
|
return;
|
|
23056
21166
|
}
|
|
23057
21167
|
let needRestore = false;
|
|
23058
|
-
if (cornerRadius === 0 || (isArray
|
|
21168
|
+
if (cornerRadius === 0 || (vutils.isArray(cornerRadius) && cornerRadius.every(num => num === 0))) ;
|
|
23059
21169
|
else {
|
|
23060
21170
|
context.beginPath();
|
|
23061
21171
|
createRectPath(context, x, y, width, height, cornerRadius);
|
|
@@ -23148,7 +21258,7 @@
|
|
|
23148
21258
|
}
|
|
23149
21259
|
let result;
|
|
23150
21260
|
let color;
|
|
23151
|
-
if (isArray
|
|
21261
|
+
if (vutils.isArray(c)) {
|
|
23152
21262
|
for (let i = 0; i < c.length; i++) {
|
|
23153
21263
|
color = c[i];
|
|
23154
21264
|
if (color) {
|
|
@@ -23380,7 +21490,7 @@
|
|
|
23380
21490
|
createCirclePattern(size, padding, color, targetContext) {
|
|
23381
21491
|
return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {
|
|
23382
21492
|
ctx.fillStyle = color;
|
|
23383
|
-
ctx.arc(r, r, r, 0, pi2);
|
|
21493
|
+
ctx.arc(r, r, r, 0, vutils.pi2);
|
|
23384
21494
|
ctx.fill();
|
|
23385
21495
|
});
|
|
23386
21496
|
}
|
|
@@ -23725,7 +21835,7 @@
|
|
|
23725
21835
|
return;
|
|
23726
21836
|
}
|
|
23727
21837
|
if (!graphic.backgroundImg) {
|
|
23728
|
-
if (isObject
|
|
21838
|
+
if (vutils.isObject(background)) {
|
|
23729
21839
|
const { stroke, fill, lineWidth = 1, cornerRadius = 0, expandX = 0, expandY = 0 } = background;
|
|
23730
21840
|
if (!stroke && !fill) {
|
|
23731
21841
|
return;
|
|
@@ -23789,7 +21899,7 @@
|
|
|
23789
21899
|
let y = bounds.y1;
|
|
23790
21900
|
let width = bounds.width();
|
|
23791
21901
|
let height = bounds.height();
|
|
23792
|
-
if (isNumber
|
|
21902
|
+
if (vutils.isNumber(boundsPadding)) {
|
|
23793
21903
|
x += boundsPadding;
|
|
23794
21904
|
y += boundsPadding;
|
|
23795
21905
|
width -= boundsPadding * 2;
|
|
@@ -23831,7 +21941,7 @@
|
|
|
23831
21941
|
const nextX = x - d;
|
|
23832
21942
|
const nextY = y - d;
|
|
23833
21943
|
const dw = d * 2;
|
|
23834
|
-
if (cornerRadius === 0 || (isArray
|
|
21944
|
+
if (cornerRadius === 0 || (vutils.isArray(cornerRadius) && cornerRadius.every(num => num === 0))) {
|
|
23835
21945
|
context.beginPath();
|
|
23836
21946
|
context.rect(nextX, nextY, width + dw, height + dw);
|
|
23837
21947
|
}
|
|
@@ -23857,7 +21967,7 @@
|
|
|
23857
21967
|
const nextX = x + d;
|
|
23858
21968
|
const nextY = y + d;
|
|
23859
21969
|
const dw = d * 2;
|
|
23860
|
-
if (cornerRadius === 0 || (isArray
|
|
21970
|
+
if (cornerRadius === 0 || (vutils.isArray(cornerRadius) && cornerRadius.every(num => num === 0))) {
|
|
23861
21971
|
context.beginPath();
|
|
23862
21972
|
context.rect(nextX, nextY, width - dw, height - dw);
|
|
23863
21973
|
}
|
|
@@ -24111,7 +22221,7 @@
|
|
|
24111
22221
|
graphic: null,
|
|
24112
22222
|
group: null
|
|
24113
22223
|
};
|
|
24114
|
-
const parentMatrix = new Matrix(1, 0, 0, 1, 0, 0);
|
|
22224
|
+
const parentMatrix = new vutils.Matrix(1, 0, 0, 1, 0, 0);
|
|
24115
22225
|
let group;
|
|
24116
22226
|
for (let i = 0; i < graphics.length; i++) {
|
|
24117
22227
|
if (graphics[i].isContainer) {
|
|
@@ -24160,7 +22270,7 @@
|
|
|
24160
22270
|
return result;
|
|
24161
22271
|
}
|
|
24162
22272
|
const transMatrix = group.transMatrix;
|
|
24163
|
-
const newPoint = new Point(point.x, point.y);
|
|
22273
|
+
const newPoint = new vutils.Point(point.x, point.y);
|
|
24164
22274
|
parentMatrix.transformPoint(newPoint, newPoint);
|
|
24165
22275
|
const insideGroup = group.AABBBounds.containsPoint(newPoint);
|
|
24166
22276
|
if (!insideGroup) {
|
|
@@ -24174,7 +22284,7 @@
|
|
|
24174
22284
|
result = this.pickGroup(graphic, point, parentMatrix, params);
|
|
24175
22285
|
}
|
|
24176
22286
|
else {
|
|
24177
|
-
const newPoint = new Point(point.x, point.y);
|
|
22287
|
+
const newPoint = new vutils.Point(point.x, point.y);
|
|
24178
22288
|
parentMatrix.transformPoint(newPoint, newPoint);
|
|
24179
22289
|
const data = this.pickItem(graphic, newPoint, parentMatrix, params);
|
|
24180
22290
|
if (data) {
|
|
@@ -24237,7 +22347,7 @@
|
|
|
24237
22347
|
context.highPerformanceSave();
|
|
24238
22348
|
const g = graphic.shadowRoot;
|
|
24239
22349
|
const currentGroupMatrix = matrixAllocate.allocateByObj(parentMatrix);
|
|
24240
|
-
const newPoint = new Point(point.x, point.y);
|
|
22350
|
+
const newPoint = new vutils.Point(point.x, point.y);
|
|
24241
22351
|
parentMatrix.transformPoint(newPoint, newPoint);
|
|
24242
22352
|
const transMatrix = graphic.transMatrix;
|
|
24243
22353
|
currentGroupMatrix.multiply(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f);
|
|
@@ -24286,10 +22396,10 @@
|
|
|
24286
22396
|
let angle1 = ((_b = (_a = a.attribute.startAngle) !== null && _a !== void 0 ? _a : 0 + a.attribute.endAngle) !== null && _b !== void 0 ? _b : 0) / 2;
|
|
24287
22397
|
let angle2 = ((_d = (_c = b.attribute.startAngle) !== null && _c !== void 0 ? _c : 0 + b.attribute.endAngle) !== null && _d !== void 0 ? _d : 0) / 2;
|
|
24288
22398
|
while (angle1 < 0) {
|
|
24289
|
-
angle1 += pi2;
|
|
22399
|
+
angle1 += vutils.pi2;
|
|
24290
22400
|
}
|
|
24291
22401
|
while (angle2 < 0) {
|
|
24292
|
-
angle2 += pi2;
|
|
22402
|
+
angle2 += vutils.pi2;
|
|
24293
22403
|
}
|
|
24294
22404
|
return angle2 - angle1;
|
|
24295
22405
|
});
|
|
@@ -24851,7 +22961,7 @@
|
|
|
24851
22961
|
}
|
|
24852
22962
|
|
|
24853
22963
|
const DrawItemInterceptor = Symbol.for('DrawItemInterceptor');
|
|
24854
|
-
const tempDirtyBounds = new AABBBounds();
|
|
22964
|
+
const tempDirtyBounds = new vutils.AABBBounds();
|
|
24855
22965
|
let ShadowRootDrawItemInterceptorContribution = class ShadowRootDrawItemInterceptorContribution {
|
|
24856
22966
|
constructor() {
|
|
24857
22967
|
this.order = 1;
|
|
@@ -25020,10 +23130,10 @@
|
|
|
25020
23130
|
let angle1 = (((_a = a.attribute.startAngle) !== null && _a !== void 0 ? _a : 0) + ((_b = a.attribute.endAngle) !== null && _b !== void 0 ? _b : 0)) / 2;
|
|
25021
23131
|
let angle2 = (((_c = b.attribute.startAngle) !== null && _c !== void 0 ? _c : 0) + ((_d = b.attribute.endAngle) !== null && _d !== void 0 ? _d : 0)) / 2;
|
|
25022
23132
|
while (angle1 < 0) {
|
|
25023
|
-
angle1 += pi2;
|
|
23133
|
+
angle1 += vutils.pi2;
|
|
25024
23134
|
}
|
|
25025
23135
|
while (angle2 < 0) {
|
|
25026
|
-
angle2 += pi2;
|
|
23136
|
+
angle2 += vutils.pi2;
|
|
25027
23137
|
}
|
|
25028
23138
|
return angle2 - angle1;
|
|
25029
23139
|
});
|
|
@@ -25120,8 +23230,8 @@
|
|
|
25120
23230
|
this.currentRenderMap = new Map();
|
|
25121
23231
|
this.defaultRenderMap = new Map();
|
|
25122
23232
|
this.styleRenderMap = new Map();
|
|
25123
|
-
this.dirtyBounds = new Bounds();
|
|
25124
|
-
this.backupDirtyBounds = new Bounds();
|
|
23233
|
+
this.dirtyBounds = new vutils.Bounds();
|
|
23234
|
+
this.backupDirtyBounds = new vutils.Bounds();
|
|
25125
23235
|
}
|
|
25126
23236
|
init() {
|
|
25127
23237
|
this.contributions.forEach(item => {
|
|
@@ -25148,7 +23258,7 @@
|
|
|
25148
23258
|
}
|
|
25149
23259
|
const dirtyBounds = this.dirtyBounds.setValue(0, 0, width, height);
|
|
25150
23260
|
if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {
|
|
25151
|
-
const b = getRectIntersect(dirtyBounds, stage.dirtyBounds, false);
|
|
23261
|
+
const b = vutils.getRectIntersect(dirtyBounds, stage.dirtyBounds, false);
|
|
25152
23262
|
dirtyBounds.x1 = Math.floor(b.x1);
|
|
25153
23263
|
dirtyBounds.y1 = Math.floor(b.y1);
|
|
25154
23264
|
dirtyBounds.x2 = Math.ceil(b.x2);
|
|
@@ -25211,7 +23321,7 @@
|
|
|
25211
23321
|
this._increaseRender(group, drawContext);
|
|
25212
23322
|
return;
|
|
25213
23323
|
}
|
|
25214
|
-
if (!isRectIntersect(group.AABBBounds, this.dirtyBounds, false)) {
|
|
23324
|
+
if (!vutils.isRectIntersect(group.AABBBounds, this.dirtyBounds, false)) {
|
|
25215
23325
|
return;
|
|
25216
23326
|
}
|
|
25217
23327
|
const tempBounds = this.dirtyBounds.clone();
|
|
@@ -25309,7 +23419,7 @@
|
|
|
25309
23419
|
if (!renderer) {
|
|
25310
23420
|
return;
|
|
25311
23421
|
}
|
|
25312
|
-
if (!(graphic.isContainer || isRectIntersect(graphic.AABBBounds, this.dirtyBounds, false))) {
|
|
23422
|
+
if (!(graphic.isContainer || vutils.isRectIntersect(graphic.AABBBounds, this.dirtyBounds, false))) {
|
|
25313
23423
|
return;
|
|
25314
23424
|
}
|
|
25315
23425
|
const skipDraw = drawContext.startAtId != null && graphic._uid !== drawContext.startAtId;
|
|
@@ -25426,7 +23536,7 @@
|
|
|
25426
23536
|
context.disableStroke = disableStroke;
|
|
25427
23537
|
context.disableBeginPath = disableBeginPath;
|
|
25428
23538
|
}
|
|
25429
|
-
else if (cornerRadius === 0 || (isArray
|
|
23539
|
+
else if (cornerRadius === 0 || (vutils.isArray(cornerRadius) && cornerRadius.every(num => num === 0))) {
|
|
25430
23540
|
context.beginPath();
|
|
25431
23541
|
context.rect(x, y, width, height);
|
|
25432
23542
|
}
|
|
@@ -26094,7 +24204,7 @@
|
|
|
26094
24204
|
|
|
26095
24205
|
function drawArcPath(arc, context, cx, cy, z, outerRadius, innerRadius) {
|
|
26096
24206
|
const { startAngle, endAngle } = arc.getParsedAngle();
|
|
26097
|
-
const deltaAngle = abs(endAngle - startAngle);
|
|
24207
|
+
const deltaAngle = vutils.abs(endAngle - startAngle);
|
|
26098
24208
|
const clockwise = endAngle > startAngle;
|
|
26099
24209
|
let collapsedToLine = false;
|
|
26100
24210
|
if (outerRadius < innerRadius) {
|
|
@@ -26102,23 +24212,23 @@
|
|
|
26102
24212
|
outerRadius = innerRadius;
|
|
26103
24213
|
innerRadius = temp;
|
|
26104
24214
|
}
|
|
26105
|
-
if (outerRadius <= epsilon) {
|
|
24215
|
+
if (outerRadius <= vutils.epsilon) {
|
|
26106
24216
|
context.moveTo(cx, cy, z);
|
|
26107
24217
|
}
|
|
26108
|
-
else if (deltaAngle >= pi2 - epsilon) {
|
|
26109
|
-
context.moveTo(cx + outerRadius * cos(startAngle), cy + outerRadius * sin(startAngle), z);
|
|
24218
|
+
else if (deltaAngle >= vutils.pi2 - vutils.epsilon) {
|
|
24219
|
+
context.moveTo(cx + outerRadius * vutils.cos(startAngle), cy + outerRadius * vutils.sin(startAngle), z);
|
|
26110
24220
|
context.arc(cx, cy, outerRadius, startAngle, endAngle, !clockwise, z);
|
|
26111
|
-
if (innerRadius > epsilon) {
|
|
26112
|
-
context.moveTo(cx + innerRadius * cos(endAngle), cy + innerRadius * sin(endAngle), z);
|
|
24221
|
+
if (innerRadius > vutils.epsilon) {
|
|
24222
|
+
context.moveTo(cx + innerRadius * vutils.cos(endAngle), cy + innerRadius * vutils.sin(endAngle), z);
|
|
26113
24223
|
context.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise, z);
|
|
26114
24224
|
}
|
|
26115
24225
|
}
|
|
26116
24226
|
else {
|
|
26117
24227
|
const { outerDeltaAngle, innerDeltaAngle, outerStartAngle, outerEndAngle, innerEndAngle, innerStartAngle } = arc.getParsePadAngle(startAngle, endAngle);
|
|
26118
|
-
const xors = outerRadius * cos(outerStartAngle);
|
|
26119
|
-
const yors = outerRadius * sin(outerStartAngle);
|
|
26120
|
-
const xire = innerRadius * cos(innerEndAngle);
|
|
26121
|
-
const yire = innerRadius * sin(innerEndAngle);
|
|
24228
|
+
const xors = outerRadius * vutils.cos(outerStartAngle);
|
|
24229
|
+
const yors = outerRadius * vutils.sin(outerStartAngle);
|
|
24230
|
+
const xire = innerRadius * vutils.cos(innerEndAngle);
|
|
24231
|
+
const yire = innerRadius * vutils.sin(innerEndAngle);
|
|
26122
24232
|
if (outerDeltaAngle < 0.001) {
|
|
26123
24233
|
collapsedToLine = true;
|
|
26124
24234
|
}
|
|
@@ -26126,7 +24236,7 @@
|
|
|
26126
24236
|
context.moveTo(cx + xors, cy + yors, z);
|
|
26127
24237
|
context.arc(cx, cy, outerRadius, outerStartAngle, outerEndAngle, !clockwise, z);
|
|
26128
24238
|
}
|
|
26129
|
-
if (!(innerRadius > epsilon) || innerDeltaAngle < 0.001) {
|
|
24239
|
+
if (!(innerRadius > vutils.epsilon) || innerDeltaAngle < 0.001) {
|
|
26130
24240
|
context.lineTo(cx + xire, cy + yire, z);
|
|
26131
24241
|
collapsedToLine = true;
|
|
26132
24242
|
}
|
|
@@ -26140,24 +24250,24 @@
|
|
|
26140
24250
|
}
|
|
26141
24251
|
function drawInnerOuterArcPath(arc, context, cx, cy, z1, z2, radius, getParsePadAngle) {
|
|
26142
24252
|
const { startAngle, endAngle } = arc.getParsedAngle();
|
|
26143
|
-
const deltaAngle = abs(endAngle - startAngle);
|
|
24253
|
+
const deltaAngle = vutils.abs(endAngle - startAngle);
|
|
26144
24254
|
const clockwise = endAngle > startAngle;
|
|
26145
24255
|
let collapsedToLine = false;
|
|
26146
|
-
if (radius <= epsilon) {
|
|
24256
|
+
if (radius <= vutils.epsilon) {
|
|
26147
24257
|
context.moveTo(cx, cy, z1);
|
|
26148
24258
|
}
|
|
26149
|
-
else if (deltaAngle >= pi2 - epsilon) {
|
|
26150
|
-
context.moveTo(cx + radius * cos(startAngle), cy + radius * sin(startAngle), z1);
|
|
24259
|
+
else if (deltaAngle >= vutils.pi2 - vutils.epsilon) {
|
|
24260
|
+
context.moveTo(cx + radius * vutils.cos(startAngle), cy + radius * vutils.sin(startAngle), z1);
|
|
26151
24261
|
context.arc(cx, cy, radius, startAngle, endAngle, !clockwise, z1);
|
|
26152
|
-
context.lineTo(cx + radius * cos(endAngle), cy + radius * sin(endAngle), z2);
|
|
24262
|
+
context.lineTo(cx + radius * vutils.cos(endAngle), cy + radius * vutils.sin(endAngle), z2);
|
|
26153
24263
|
context.arc(cx, cy, radius, endAngle, startAngle, clockwise, z2);
|
|
26154
24264
|
}
|
|
26155
24265
|
else {
|
|
26156
24266
|
const { innerouterDeltaAngle, innerouterStartAngle, innerouterEndAngle } = getParsePadAngle(startAngle, endAngle);
|
|
26157
|
-
const xors = radius * cos(innerouterStartAngle);
|
|
26158
|
-
const yors = radius * sin(innerouterStartAngle);
|
|
26159
|
-
const xore = radius * cos(innerouterEndAngle);
|
|
26160
|
-
const yore = radius * sin(innerouterEndAngle);
|
|
24267
|
+
const xors = radius * vutils.cos(innerouterStartAngle);
|
|
24268
|
+
const yors = radius * vutils.sin(innerouterStartAngle);
|
|
24269
|
+
const xore = radius * vutils.cos(innerouterEndAngle);
|
|
24270
|
+
const yore = radius * vutils.sin(innerouterEndAngle);
|
|
26161
24271
|
if (innerouterDeltaAngle < 0.001) {
|
|
26162
24272
|
collapsedToLine = true;
|
|
26163
24273
|
}
|
|
@@ -26228,7 +24338,7 @@
|
|
|
26228
24338
|
if (face === 'inside') {
|
|
26229
24339
|
context.save();
|
|
26230
24340
|
context.beginPath();
|
|
26231
|
-
context.arc(x, y, innerRadius, 0, pi2, true, z_face.top);
|
|
24341
|
+
context.arc(x, y, innerRadius, 0, vutils.pi2, true, z_face.top);
|
|
26232
24342
|
context.clip();
|
|
26233
24343
|
}
|
|
26234
24344
|
context.beginPath();
|
|
@@ -26976,7 +25086,7 @@
|
|
|
26976
25086
|
}
|
|
26977
25087
|
}
|
|
26978
25088
|
|
|
26979
|
-
const globalBounds = new AABBBounds();
|
|
25089
|
+
const globalBounds = new vutils.AABBBounds();
|
|
26980
25090
|
class DirtyBoundsPlugin {
|
|
26981
25091
|
constructor() {
|
|
26982
25092
|
this.name = 'DirtyBoundsPlugin';
|
|
@@ -27050,7 +25160,7 @@
|
|
|
27050
25160
|
this.activeEvent = 'onRegister';
|
|
27051
25161
|
this.id = Generator.GenAutoIncrementId();
|
|
27052
25162
|
this.key = this.name + this.id;
|
|
27053
|
-
this.tempBounds = new AABBBounds();
|
|
25163
|
+
this.tempBounds = new vutils.AABBBounds();
|
|
27054
25164
|
}
|
|
27055
25165
|
tryLayout(graphic) {
|
|
27056
25166
|
const p = graphic.parent;
|
|
@@ -27328,7 +25438,7 @@
|
|
|
27328
25438
|
else if (isNumber(graphic.attribute.boundsPadding)) {
|
|
27329
25439
|
return graphic.attribute.boundsPadding;
|
|
27330
25440
|
}
|
|
27331
|
-
else if (isArray
|
|
25441
|
+
else if (vutils.isArray(graphic.attribute.boundsPadding) && graphic.attribute.boundsPadding.length === 1) {
|
|
27332
25442
|
return graphic.attribute.boundsPadding[0];
|
|
27333
25443
|
}
|
|
27334
25444
|
const paddingArray = parsePadding(graphic.attribute.boundsPadding);
|
|
@@ -27352,15 +25462,15 @@
|
|
|
27352
25462
|
this.color = color;
|
|
27353
25463
|
this.colorRgb = ColorStore.Get(color, exports.ColorType.Color1);
|
|
27354
25464
|
this.ambient = ambient;
|
|
27355
|
-
const length = sqrt(dir[0] * dir[0] + dir[1] * dir[1] + dir[2] * dir[2]);
|
|
25465
|
+
const length = vutils.sqrt(dir[0] * dir[0] + dir[1] * dir[1] + dir[2] * dir[2]);
|
|
27356
25466
|
this.formatedDir = [dir[0] / length, dir[1] / length, dir[2] / length];
|
|
27357
25467
|
}
|
|
27358
25468
|
computeColor(normal, color) {
|
|
27359
25469
|
const lightDir = this.formatedDir;
|
|
27360
|
-
const brightness = min(max((normal[0] * lightDir[0] + normal[1] * lightDir[1] + normal[2] * lightDir[2]) * (1 - this.ambient / 2), 0) +
|
|
25470
|
+
const brightness = vutils.min(vutils.max((normal[0] * lightDir[0] + normal[1] * lightDir[1] + normal[2] * lightDir[2]) * (1 - this.ambient / 2), 0) +
|
|
27361
25471
|
this.ambient, 1);
|
|
27362
25472
|
let colorArray;
|
|
27363
|
-
if (isString
|
|
25473
|
+
if (vutils.isString(color)) {
|
|
27364
25474
|
colorArray = ColorStore.Get(color, exports.ColorType.Color1);
|
|
27365
25475
|
}
|
|
27366
25476
|
else {
|
|
@@ -27391,7 +25501,7 @@
|
|
|
27391
25501
|
const centerx = center[0];
|
|
27392
25502
|
const centery = center[1];
|
|
27393
25503
|
const centerz = center[2];
|
|
27394
|
-
if (Math.abs(eyex - centerx) < epsilon && Math.abs(eyey - centery) < epsilon && Math.abs(eyez - centerz) < epsilon) {
|
|
25504
|
+
if (Math.abs(eyex - centerx) < vutils.epsilon && Math.abs(eyey - centery) < vutils.epsilon && Math.abs(eyez - centerz) < vutils.epsilon) {
|
|
27395
25505
|
return DefaultMat4Allocate.identity(out);
|
|
27396
25506
|
}
|
|
27397
25507
|
z0 = eyex - centerx;
|
|
@@ -27712,7 +25822,7 @@
|
|
|
27712
25822
|
title: params.title || '',
|
|
27713
25823
|
canvas: params.canvas
|
|
27714
25824
|
});
|
|
27715
|
-
this._viewBox = new AABBBounds();
|
|
25825
|
+
this._viewBox = new vutils.AABBBounds();
|
|
27716
25826
|
if (params.viewBox) {
|
|
27717
25827
|
this._viewBox.setValue(params.viewBox.x1, params.viewBox.y1, params.viewBox.x2, params.viewBox.y2);
|
|
27718
25828
|
}
|
|
@@ -27915,7 +26025,7 @@
|
|
|
27915
26025
|
if (this.dirtyBounds) {
|
|
27916
26026
|
return;
|
|
27917
26027
|
}
|
|
27918
|
-
this.dirtyBounds = new Bounds();
|
|
26028
|
+
this.dirtyBounds = new vutils.Bounds();
|
|
27919
26029
|
let plugin = this.pluginService.findPluginsByName('DirtyBoundsPlugin')[0];
|
|
27920
26030
|
if (!plugin) {
|
|
27921
26031
|
plugin = new DirtyBoundsPlugin();
|
|
@@ -28131,7 +26241,7 @@
|
|
|
28131
26241
|
throw new Error('暂不支持');
|
|
28132
26242
|
}
|
|
28133
26243
|
pick(x, y) {
|
|
28134
|
-
const result = this.pickerService.pick(this.children, new Point(x, y), {
|
|
26244
|
+
const result = this.pickerService.pick(this.children, new vutils.Point(x, y), {
|
|
28135
26245
|
bounds: this.AABBBounds
|
|
28136
26246
|
});
|
|
28137
26247
|
if ((result === null || result === void 0 ? void 0 : result.graphic) || (result === null || result === void 0 ? void 0 : result.group)) {
|
|
@@ -28250,17 +26360,17 @@
|
|
|
28250
26360
|
'rect'
|
|
28251
26361
|
];
|
|
28252
26362
|
|
|
28253
|
-
const initMatrix = new Matrix(1, 0, 0, 1, 0, 0);
|
|
26363
|
+
const initMatrix = new vutils.Matrix(1, 0, 0, 1, 0, 0);
|
|
28254
26364
|
const globalPoint = { x: 0, y: 0 };
|
|
28255
26365
|
exports.EmptyContext2d = class EmptyContext2d {
|
|
28256
26366
|
get nativeContext() {
|
|
28257
26367
|
return this.path;
|
|
28258
26368
|
}
|
|
28259
26369
|
constructor(canvas, dpr) {
|
|
28260
|
-
this.matrix = new Matrix(1, 0, 0, 1, 0, 0);
|
|
26370
|
+
this.matrix = new vutils.Matrix(1, 0, 0, 1, 0, 0);
|
|
28261
26371
|
this.stack = [];
|
|
28262
26372
|
this.dpr = dpr;
|
|
28263
|
-
this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0);
|
|
26373
|
+
this.applyedMatrix = new vutils.Matrix(1, 0, 0, 1, 0, 0);
|
|
28264
26374
|
this.path = new CustomPath2D();
|
|
28265
26375
|
}
|
|
28266
26376
|
getCanvas() {
|
|
@@ -28630,7 +26740,7 @@
|
|
|
28630
26740
|
}
|
|
28631
26741
|
}
|
|
28632
26742
|
getNativeAABBBounds(dom) {
|
|
28633
|
-
return new AABBBounds();
|
|
26743
|
+
return new vutils.AABBBounds();
|
|
28634
26744
|
}
|
|
28635
26745
|
removeDom(dom) {
|
|
28636
26746
|
return false;
|
|
@@ -28777,7 +26887,7 @@
|
|
|
28777
26887
|
}
|
|
28778
26888
|
params.pickContext = this.pickContext;
|
|
28779
26889
|
this.pickContext && this.pickContext.clearMatrix(true, 1);
|
|
28780
|
-
const parentMatrix = new Matrix(1, 0, 0, 1, offsetX, offsetY);
|
|
26890
|
+
const parentMatrix = new vutils.Matrix(1, 0, 0, 1, offsetX, offsetY);
|
|
28781
26891
|
let group;
|
|
28782
26892
|
for (let i = graphics.length - 1; i >= 0; i--) {
|
|
28783
26893
|
if (graphics[i].isContainer) {
|
|
@@ -28859,7 +26969,7 @@
|
|
|
28859
26969
|
}
|
|
28860
26970
|
const transMatrix = group.transMatrix;
|
|
28861
26971
|
const currentGroupMatrix = matrixAllocate.allocateByObj(parentMatrix);
|
|
28862
|
-
const newPoint = new Point(point.x, point.y);
|
|
26972
|
+
const newPoint = new vutils.Point(point.x, point.y);
|
|
28863
26973
|
currentGroupMatrix.transformPoint(newPoint, newPoint);
|
|
28864
26974
|
const insideGroup = group.AABBBounds.containsPoint(newPoint);
|
|
28865
26975
|
if (!insideGroup && !group.stage.camera) {
|
|
@@ -28875,7 +26985,7 @@
|
|
|
28875
26985
|
if (group.attribute.childrenPickable !== false && !(pickedItem && pickedItem.graphic)) {
|
|
28876
26986
|
foreach(group, DefaultAttribute.zIndex, (graphic) => {
|
|
28877
26987
|
if (graphic.isContainer) {
|
|
28878
|
-
const newPoint = new Point(point.x, point.y);
|
|
26988
|
+
const newPoint = new vutils.Point(point.x, point.y);
|
|
28879
26989
|
const theme = getTheme(group).group;
|
|
28880
26990
|
const { scrollX = theme.scrollX, scrollY = theme.scrollY } = group.attribute;
|
|
28881
26991
|
newPoint.x -= scrollX;
|
|
@@ -28883,7 +26993,7 @@
|
|
|
28883
26993
|
result = this.pickGroup(graphic, newPoint, currentGroupMatrix, params);
|
|
28884
26994
|
}
|
|
28885
26995
|
else {
|
|
28886
|
-
const newPoint = new Point(point.x, point.y);
|
|
26996
|
+
const newPoint = new vutils.Point(point.x, point.y);
|
|
28887
26997
|
currentGroupMatrix.transformPoint(newPoint, newPoint);
|
|
28888
26998
|
const theme = getTheme(group).group;
|
|
28889
26999
|
const { scrollX = theme.scrollX, scrollY = theme.scrollY } = group.attribute;
|