zrender-nightly 5.5.0-dev.20221127 → 5.5.0-dev.20221129
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/zrender.js +59 -16
- package/dist/zrender.js.map +1 -1
- package/dist/zrender.min.js +1 -1
- package/lib/core/platform.js +2 -2
- package/lib/core/util.d.ts +10 -3
- package/lib/core/util.js +53 -11
- package/lib/svg/Painter.js +1 -1
- package/lib/svg/graphic.js +2 -1
- package/lib/zrender.d.ts +1 -1
- package/lib/zrender.js +1 -1
- package/package.json +1 -1
- package/src/core/platform.ts +3 -3
- package/src/core/util.ts +73 -17
- package/src/svg/Painter.ts +1 -1
- package/src/svg/graphic.ts +2 -1
- package/src/zrender.ts +1 -1
package/dist/zrender.js
CHANGED
|
@@ -124,8 +124,8 @@
|
|
|
124
124
|
else {
|
|
125
125
|
text = text || '';
|
|
126
126
|
font = font || DEFAULT_FONT;
|
|
127
|
-
var res =
|
|
128
|
-
var fontSize =
|
|
127
|
+
var res = /(\d+)px/.exec(font);
|
|
128
|
+
var fontSize = res && +res[1] || DEFAULT_FONT_SIZE;
|
|
129
129
|
var width = 0;
|
|
130
130
|
if (font.indexOf('mono') >= 0) {
|
|
131
131
|
width = fontSize * text.length;
|
|
@@ -578,11 +578,48 @@
|
|
|
578
578
|
function isPrimitive(obj) {
|
|
579
579
|
return obj[primitiveKey];
|
|
580
580
|
}
|
|
581
|
+
var MapPolyfill = (function () {
|
|
582
|
+
function MapPolyfill() {
|
|
583
|
+
this.data = {};
|
|
584
|
+
}
|
|
585
|
+
MapPolyfill.prototype["delete"] = function (key) {
|
|
586
|
+
var existed = this.has(key);
|
|
587
|
+
if (existed) {
|
|
588
|
+
delete this.data[key];
|
|
589
|
+
}
|
|
590
|
+
return existed;
|
|
591
|
+
};
|
|
592
|
+
MapPolyfill.prototype.has = function (key) {
|
|
593
|
+
return this.data.hasOwnProperty(key);
|
|
594
|
+
};
|
|
595
|
+
MapPolyfill.prototype.get = function (key) {
|
|
596
|
+
return this.data[key];
|
|
597
|
+
};
|
|
598
|
+
MapPolyfill.prototype.set = function (key, value) {
|
|
599
|
+
this.data[key] = value;
|
|
600
|
+
return this;
|
|
601
|
+
};
|
|
602
|
+
MapPolyfill.prototype.keys = function () {
|
|
603
|
+
return keys(this.data);
|
|
604
|
+
};
|
|
605
|
+
MapPolyfill.prototype.forEach = function (callback) {
|
|
606
|
+
var data = this.data;
|
|
607
|
+
for (var key in data) {
|
|
608
|
+
if (data.hasOwnProperty(key)) {
|
|
609
|
+
callback(data[key], key);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
return MapPolyfill;
|
|
614
|
+
}());
|
|
615
|
+
var isNativeMapSupported = typeof Map === 'function';
|
|
616
|
+
function maybeNativeMap() {
|
|
617
|
+
return (isNativeMapSupported ? new Map() : new MapPolyfill());
|
|
618
|
+
}
|
|
581
619
|
var HashMap = (function () {
|
|
582
620
|
function HashMap(obj) {
|
|
583
|
-
this.data = {};
|
|
584
621
|
var isArr = isArray(obj);
|
|
585
|
-
this.data =
|
|
622
|
+
this.data = maybeNativeMap();
|
|
586
623
|
var thisMap = this;
|
|
587
624
|
(obj instanceof HashMap)
|
|
588
625
|
? obj.each(visit)
|
|
@@ -591,24 +628,29 @@
|
|
|
591
628
|
isArr ? thisMap.set(value, key) : thisMap.set(key, value);
|
|
592
629
|
}
|
|
593
630
|
}
|
|
631
|
+
HashMap.prototype.hasKey = function (key) {
|
|
632
|
+
return this.data.has(key);
|
|
633
|
+
};
|
|
594
634
|
HashMap.prototype.get = function (key) {
|
|
595
|
-
return this.data.
|
|
635
|
+
return this.data.get(key);
|
|
596
636
|
};
|
|
597
637
|
HashMap.prototype.set = function (key, value) {
|
|
598
|
-
|
|
638
|
+
this.data.set(key, value);
|
|
639
|
+
return value;
|
|
599
640
|
};
|
|
600
641
|
HashMap.prototype.each = function (cb, context) {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
}
|
|
605
|
-
}
|
|
642
|
+
this.data.forEach(function (value, key) {
|
|
643
|
+
cb.call(context, value, key);
|
|
644
|
+
});
|
|
606
645
|
};
|
|
607
646
|
HashMap.prototype.keys = function () {
|
|
608
|
-
|
|
647
|
+
var keys = this.data.keys();
|
|
648
|
+
return isNativeMapSupported
|
|
649
|
+
? Array.from(keys)
|
|
650
|
+
: keys;
|
|
609
651
|
};
|
|
610
652
|
HashMap.prototype.removeKey = function (key) {
|
|
611
|
-
|
|
653
|
+
this.data["delete"](key);
|
|
612
654
|
};
|
|
613
655
|
return HashMap;
|
|
614
656
|
}());
|
|
@@ -7196,7 +7238,7 @@
|
|
|
7196
7238
|
function registerPainter(name, Ctor) {
|
|
7197
7239
|
painterCtors[name] = Ctor;
|
|
7198
7240
|
}
|
|
7199
|
-
var version = '5.5.0-dev.
|
|
7241
|
+
var version = '5.5.0-dev.20221129';
|
|
7200
7242
|
|
|
7201
7243
|
var STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));
|
|
7202
7244
|
var DEFAULT_COMMON_STYLE = {
|
|
@@ -16285,11 +16327,12 @@
|
|
|
16285
16327
|
builtinShpDef[0](shape, attrs, mul);
|
|
16286
16328
|
}
|
|
16287
16329
|
else {
|
|
16330
|
+
var needBuildPath = !el.path || el.shapeChanged();
|
|
16288
16331
|
if (!el.path) {
|
|
16289
16332
|
el.createPathProxy();
|
|
16290
16333
|
}
|
|
16291
16334
|
var path = el.path;
|
|
16292
|
-
if (
|
|
16335
|
+
if (needBuildPath) {
|
|
16293
16336
|
path.beginPath();
|
|
16294
16337
|
el.buildPath(path, el.shape);
|
|
16295
16338
|
el.pathUpdated();
|
|
@@ -17143,7 +17186,7 @@
|
|
|
17143
17186
|
else {
|
|
17144
17187
|
var _a = normalizeColor(backgroundColor), color = _a.color, opacity = _a.opacity;
|
|
17145
17188
|
bgVNode.attrs.fill = color;
|
|
17146
|
-
opacity < 1 && (bgVNode.attrs
|
|
17189
|
+
opacity < 1 && (bgVNode.attrs['fill-opacity'] = opacity);
|
|
17147
17190
|
}
|
|
17148
17191
|
}
|
|
17149
17192
|
return bgVNode;
|