zrender-nightly 5.4.4-dev.20230925 → 5.4.4-dev.20230926

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.
@@ -5,7 +5,7 @@ export declare function identity(out: MatrixArray): MatrixArray;
5
5
  export declare function copy(out: MatrixArray, m: MatrixArray): MatrixArray;
6
6
  export declare function mul(out: MatrixArray, m1: MatrixArray, m2: MatrixArray): MatrixArray;
7
7
  export declare function translate(out: MatrixArray, a: MatrixArray, v: VectorArray): MatrixArray;
8
- export declare function rotate(out: MatrixArray, a: MatrixArray, rad: number): MatrixArray;
8
+ export declare function rotate(out: MatrixArray, a: MatrixArray, rad: number, pivot?: VectorArray): MatrixArray;
9
9
  export declare function scale(out: MatrixArray, a: MatrixArray, v: VectorArray): MatrixArray;
10
10
  export declare function invert(out: MatrixArray, a: MatrixArray): MatrixArray | null;
11
11
  export declare function clone(a: MatrixArray): MatrixArray;
@@ -43,7 +43,8 @@ export function translate(out, a, v) {
43
43
  out[5] = a[5] + v[1];
44
44
  return out;
45
45
  }
46
- export function rotate(out, a, rad) {
46
+ export function rotate(out, a, rad, pivot) {
47
+ if (pivot === void 0) { pivot = [0, 0]; }
47
48
  var aa = a[0];
48
49
  var ac = a[2];
49
50
  var atx = a[4];
@@ -56,8 +57,8 @@ export function rotate(out, a, rad) {
56
57
  out[1] = -aa * st + ab * ct;
57
58
  out[2] = ac * ct + ad * st;
58
59
  out[3] = -ac * st + ct * ad;
59
- out[4] = ct * atx + st * aty;
60
- out[5] = ct * aty - st * atx;
60
+ out[4] = ct * (atx - pivot[0]) + st * (aty - pivot[1]) + pivot[0];
61
+ out[5] = ct * (aty - pivot[1]) - st * (atx - pivot[0]) + pivot[1];
61
62
  return out;
62
63
  }
63
64
  export function scale(out, a, v) {
@@ -554,7 +554,10 @@ function parseTransformAttribute(xmlNode, node) {
554
554
  matrix.scale(mt, mt, [parseFloat(valueArr[0]), parseFloat(valueArr[1] || valueArr[0])]);
555
555
  break;
556
556
  case 'rotate':
557
- matrix.rotate(mt, mt, -parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);
557
+ matrix.rotate(mt, mt, -parseFloat(valueArr[0]) * DEGREE_TO_ANGLE, [
558
+ parseFloat(valueArr[1] || '0'),
559
+ parseFloat(valueArr[2] || '0')
560
+ ]);
558
561
  break;
559
562
  case 'skewX':
560
563
  var sx = Math.tan(parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);
package/lib/zrender.d.ts CHANGED
@@ -84,7 +84,7 @@ export declare function dispose(zr: ZRender): void;
84
84
  export declare function disposeAll(): void;
85
85
  export declare function getInstance(id: number): ZRender;
86
86
  export declare function registerPainter(name: string, Ctor: PainterBaseCtor): void;
87
- export declare const version = "5.4.4-dev.20230925";
87
+ export declare const version = "5.4.4-dev.20230926";
88
88
  export interface ZRenderType extends ZRender {
89
89
  }
90
90
  export {};
package/lib/zrender.js CHANGED
@@ -261,5 +261,5 @@ export function getInstance(id) {
261
261
  export function registerPainter(name, Ctor) {
262
262
  painterCtors[name] = Ctor;
263
263
  }
264
- export var version = '5.4.4-dev.20230925';
264
+ export var version = '5.4.4-dev.20230926';
265
265
  ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zrender-nightly",
3
- "version": "5.4.4-dev.20230925",
3
+ "version": "5.4.4-dev.20230926",
4
4
  "description": "A lightweight graphic library providing 2d draw for Apache ECharts",
5
5
  "keywords": [
6
6
  "canvas",
@@ -79,7 +79,12 @@ export function translate(out: MatrixArray, a: MatrixArray, v: VectorArray): Mat
79
79
  /**
80
80
  * 旋转变换
81
81
  */
82
- export function rotate(out: MatrixArray, a: MatrixArray, rad: number): MatrixArray {
82
+ export function rotate(
83
+ out: MatrixArray,
84
+ a: MatrixArray,
85
+ rad: number,
86
+ pivot: VectorArray = [0, 0]
87
+ ): MatrixArray {
83
88
  const aa = a[0];
84
89
  const ac = a[2];
85
90
  const atx = a[4];
@@ -93,8 +98,8 @@ export function rotate(out: MatrixArray, a: MatrixArray, rad: number): MatrixArr
93
98
  out[1] = -aa * st + ab * ct;
94
99
  out[2] = ac * ct + ad * st;
95
100
  out[3] = -ac * st + ct * ad;
96
- out[4] = ct * atx + st * aty;
97
- out[5] = ct * aty - st * atx;
101
+ out[4] = ct * (atx - pivot[0]) + st * (aty - pivot[1]) + pivot[0];
102
+ out[5] = ct * (aty - pivot[1]) - st * (atx - pivot[0]) + pivot[1];
98
103
  return out;
99
104
  }
100
105
 
@@ -845,7 +845,10 @@ function parseTransformAttribute(xmlNode: SVGElement, node: Element): void {
845
845
  break;
846
846
  case 'rotate':
847
847
  // TODO: zrender use different hand in coordinate system.
848
- matrix.rotate(mt, mt, -parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);
848
+ matrix.rotate(mt, mt, -parseFloat(valueArr[0]) * DEGREE_TO_ANGLE, [
849
+ parseFloat(valueArr[1] || '0'),
850
+ parseFloat(valueArr[2] || '0')
851
+ ]);
849
852
  break;
850
853
  case 'skewX':
851
854
  const sx = Math.tan(parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);
package/src/zrender.ts CHANGED
@@ -485,7 +485,7 @@ export function registerPainter(name: string, Ctor: PainterBaseCtor) {
485
485
  /**
486
486
  * @type {string}
487
487
  */
488
- export const version = '5.4.4-dev.20230925';
488
+ export const version = '5.4.4-dev.20230926';
489
489
 
490
490
 
491
491
  export interface ZRenderType extends ZRender {};