zrender-nightly 5.7.0-dev.20250620 → 5.7.0-dev.20250621
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/README.md +1 -1
- package/build/prepublish.js +20 -0
- package/dist/zrender.js +563 -277
- package/dist/zrender.js.map +1 -1
- package/dist/zrender.min.js +1 -1
- package/lib/Element.d.ts +4 -0
- package/lib/Element.js +34 -16
- package/lib/Handler.js +1 -1
- package/lib/Storage.js +20 -20
- package/lib/canvas/graphic.js +1 -1
- package/lib/contain/text.d.ts +14 -2
- package/lib/contain/text.js +65 -15
- package/lib/core/BoundingRect.d.ts +25 -3
- package/lib/core/BoundingRect.js +182 -76
- package/lib/core/OrientedBoundingRect.d.ts +2 -2
- package/lib/core/OrientedBoundingRect.js +50 -34
- package/lib/core/PathProxy.d.ts +1 -0
- package/lib/core/PathProxy.js +16 -1
- package/lib/core/dom.d.ts +1 -0
- package/lib/core/dom.js +17 -0
- package/lib/core/env.js +15 -10
- package/lib/core/types.d.ts +1 -0
- package/lib/core/util.d.ts +1 -0
- package/lib/core/util.js +2 -1
- package/lib/graphic/Displayable.js +1 -1
- package/lib/graphic/Text.d.ts +4 -2
- package/lib/graphic/Text.js +23 -14
- package/lib/graphic/helper/parseText.d.ts +13 -4
- package/lib/graphic/helper/parseText.js +110 -54
- package/lib/svg-legacy/helper/ClippathManager.js +6 -6
- package/lib/tool/color.d.ts +3 -1
- package/lib/tool/color.js +6 -6
- package/lib/tool/parseSVG.js +11 -0
- package/lib/tool/path.js +7 -4
- package/lib/zrender.d.ts +1 -1
- package/lib/zrender.js +1 -1
- package/package.json +3 -2
- package/src/Element.ts +69 -16
- package/src/Handler.ts +1 -1
- package/src/Storage.ts +25 -24
- package/src/canvas/graphic.ts +1 -1
- package/src/canvas/helper.ts +1 -1
- package/src/contain/text.ts +103 -19
- package/src/core/BoundingRect.ts +308 -87
- package/src/core/OrientedBoundingRect.ts +86 -46
- package/src/core/PathProxy.ts +17 -1
- package/src/core/Transformable.ts +2 -0
- package/src/core/dom.ts +24 -0
- package/src/core/env.ts +31 -24
- package/src/core/matrix.ts +2 -1
- package/src/core/types.ts +2 -0
- package/src/core/util.ts +4 -2
- package/src/graphic/Displayable.ts +1 -3
- package/src/graphic/Group.ts +2 -0
- package/src/graphic/Text.ts +68 -21
- package/src/graphic/helper/parseText.ts +211 -83
- package/src/svg-legacy/helper/ClippathManager.ts +5 -5
- package/src/tool/color.ts +15 -11
- package/src/tool/parseSVG.ts +12 -1
- package/src/tool/path.ts +9 -4
- package/src/zrender.ts +1 -1
package/src/tool/parseSVG.ts
CHANGED
@@ -19,6 +19,7 @@ import RadialGradient, { RadialGradientObject } from '../graphic/RadialGradient'
|
|
19
19
|
import Gradient, { GradientObject } from '../graphic/Gradient';
|
20
20
|
import TSpan, { TSpanStyleProps } from '../graphic/TSpan';
|
21
21
|
import { parseXML } from './parseXML';
|
22
|
+
import * as colorTool from './color';
|
22
23
|
|
23
24
|
|
24
25
|
interface SVGParserOption {
|
@@ -627,9 +628,19 @@ function parseGradientColorStops(xmlNode: SVGElement, gradient: GradientObject):
|
|
627
628
|
// <stop stop-color="red"/>
|
628
629
|
const styleVals = {} as Dictionary<string>;
|
629
630
|
parseInlineStyle(stop, styleVals, styleVals);
|
630
|
-
|
631
|
+
let stopColor = styleVals.stopColor
|
631
632
|
|| stop.getAttribute('stop-color')
|
632
633
|
|| '#000000';
|
634
|
+
const stopOpacity = styleVals.stopOpacity
|
635
|
+
|| stop.getAttribute('stop-opacity');
|
636
|
+
if (stopOpacity) {
|
637
|
+
const rgba = colorTool.parse(stopColor);
|
638
|
+
const stopColorOpacity = rgba && rgba[3];
|
639
|
+
if (stopColorOpacity) {
|
640
|
+
rgba[3] *= colorTool.parseCssFloat(stopOpacity);
|
641
|
+
stopColor = colorTool.stringify(rgba, 'rgba');
|
642
|
+
}
|
643
|
+
}
|
633
644
|
|
634
645
|
gradient.colorStops.push({
|
635
646
|
offset: offset,
|
package/src/tool/path.ts
CHANGED
@@ -383,13 +383,16 @@ class SVGPath extends Path {
|
|
383
383
|
function isPathProxy(path: PathProxy | CanvasRenderingContext2D): path is PathProxy {
|
384
384
|
return (path as PathProxy).setData != null;
|
385
385
|
}
|
386
|
+
|
386
387
|
// TODO Optimize double memory cost problem
|
387
388
|
function createPathOptions(str: string, opts: SVGPathOption): InnerSVGPathOption {
|
388
389
|
const pathProxy = createPathProxyFromString(str);
|
389
390
|
const innerOpts: InnerSVGPathOption = extend({}, opts);
|
390
391
|
innerOpts.buildPath = function (path: PathProxy | CanvasRenderingContext2D) {
|
391
|
-
|
392
|
-
|
392
|
+
const beProxy = isPathProxy(path);
|
393
|
+
if (beProxy && path.canSave()) {
|
394
|
+
// path.setData(pathProxy.data);
|
395
|
+
path.appendPath(pathProxy);
|
393
396
|
// Svg and vml renderer don't have context
|
394
397
|
const ctx = path.getContext();
|
395
398
|
if (ctx) {
|
@@ -397,8 +400,10 @@ function createPathOptions(str: string, opts: SVGPathOption): InnerSVGPathOption
|
|
397
400
|
}
|
398
401
|
}
|
399
402
|
else {
|
400
|
-
const ctx = path;
|
401
|
-
|
403
|
+
const ctx = beProxy ? path.getContext() : path;
|
404
|
+
if (ctx) {
|
405
|
+
pathProxy.rebuildPath(ctx, 1);
|
406
|
+
}
|
402
407
|
}
|
403
408
|
};
|
404
409
|
|
package/src/zrender.ts
CHANGED
@@ -556,7 +556,7 @@ export function registerSSRDataGetter<T>(getter: ElementSSRDataGetter<T>) {
|
|
556
556
|
/**
|
557
557
|
* @type {string}
|
558
558
|
*/
|
559
|
-
export const version = '5.7.0-dev.
|
559
|
+
export const version = '5.7.0-dev.20250621';
|
560
560
|
|
561
561
|
|
562
562
|
export interface ZRenderType extends ZRender {};
|