Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge master to release #1052

Merged
merged 32 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
53a44fb
WIP(ssr): add emphasis style in ssr css apache/echarts#18334
Ovilia Mar 14, 2023
2088b3c
Merge branch 'master' into ssr
Ovilia Mar 28, 2023
26abab1
feat(ssr): add style in meta data
Ovilia Mar 31, 2023
4ca836e
fix(svg): duplicate id for background rect with multiple charts
Ovilia Apr 3, 2023
d7005b8
feat(ssr): improve code
Ovilia May 31, 2023
fb4c265
feat(ssr): provide registerSSRDataGetter
Ovilia Jun 13, 2023
58bcfcf
feat: add `lib/all.js` to sideEffects
liuyang0826 Aug 31, 2023
8129bd8
fix(svg): fix assigning style attribute does not work when CSP is enf…
alxnddr Sep 18, 2023
9263428
Merge pull request #1030 from alxnddr/fix-csp-issue
plainheart Sep 22, 2023
997c753
fix(canvas): remove `__painter` from `Layer` and inject `painter` in …
plainheart Sep 22, 2023
8288aa6
Merge pull request #1032 from ecomfe/fix-canvas-layer-painter
plainheart Sep 23, 2023
ac1bc40
Merge pull request #1029 from liuyang0826/patch-2
plainheart Sep 23, 2023
5e9add1
feat(matrix): allow rotating relative to a point different than the o…
ChepteaCatalin Sep 23, 2023
97f6e72
Merge pull request #1034 from ChepteaCatalin/fix-1033
Ovilia Sep 25, 2023
894f408
fix: detect node21.1.0
Uzlopak Nov 2, 2023
401e314
Merge pull request #1036 from Uzlopak/node-21
plainheart Nov 2, 2023
a78b088
fix(ssr): remove a not used method
Ovilia Nov 16, 2023
1ee4156
fix(svg): remove id
Ovilia Nov 16, 2023
8c6b137
fix: el null check
Ovilia Nov 16, 2023
78f84fd
Merge pull request #999 from ecomfe/ssr
Ovilia Nov 16, 2023
2c11063
Merge pull request #1002 from ecomfe/fix-18194
plainheart Nov 16, 2023
e8cc0f9
fix: avoid errors when executing unfinished operations after calling …
yechunxi Dec 19, 2023
0b21ebd
fix: add missing disposed check for some methods and fix format flaw
plainheart Dec 20, 2023
52e5155
chore: fix typo
plainheart Dec 20, 2023
c4fc3e0
Merge pull request #1031 from yechunxi/master
plainheart Dec 20, 2023
cd1f473
fix(type): make the last two parameters `ellipsis` & `options` of the…
plainheart Dec 31, 2023
03d4cec
fix(svg): skip to set SSR attributes with `undefined` values
plainheart Jan 2, 2024
e7caf87
Merge pull request #1048 from ecomfe/fix/svg-ssr/skip-undefined-attri…
Ovilia Jan 3, 2024
d53f1c8
Merge pull request #1047 from ecomfe/types/truncateText
Ovilia Jan 3, 2024
f3b0784
feat: change to default ESM package. For developer testing and node u…
100pah Jan 15, 2024
565dac5
[lint] enable comma-dangle, which has been deprecated in eslint.
100pah Jan 22, 2024
dbf1bd5
Merge pull request #1051 from ecomfe/module_default_esm
Ovilia Jan 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(matrix): allow rotating relative to a point different than the o…
…rigin. close #1033
  • Loading branch information
ChepteaCatalin committed Sep 23, 2023
commit 5e9add1f6d1b9815f3c24294b1eea2682f111101
11 changes: 8 additions & 3 deletions src/core/matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ export function translate(out: MatrixArray, a: MatrixArray, v: VectorArray): Mat
/**
* 旋转变换
*/
export function rotate(out: MatrixArray, a: MatrixArray, rad: number): MatrixArray {
export function rotate(
out: MatrixArray,
a: MatrixArray,
rad: number,
pivot: VectorArray = [0, 0]
): MatrixArray {
const aa = a[0];
const ac = a[2];
const atx = a[4];
Expand All @@ -93,8 +98,8 @@ export function rotate(out: MatrixArray, a: MatrixArray, rad: number): MatrixArr
out[1] = -aa * st + ab * ct;
out[2] = ac * ct + ad * st;
out[3] = -ac * st + ct * ad;
out[4] = ct * atx + st * aty;
out[5] = ct * aty - st * atx;
out[4] = ct * (atx - pivot[0]) + st * (aty - pivot[1]) + pivot[0];
out[5] = ct * (aty - pivot[1]) - st * (atx - pivot[0]) + pivot[1];
return out;
}

Expand Down
5 changes: 4 additions & 1 deletion src/tool/parseSVG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,10 @@ function parseTransformAttribute(xmlNode: SVGElement, node: Element): void {
break;
case 'rotate':
// TODO: zrender use different hand in coordinate system.
matrix.rotate(mt, mt, -parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);
matrix.rotate(mt, mt, -parseFloat(valueArr[0]) * DEGREE_TO_ANGLE, [
parseFloat(valueArr[1] || '0'),
parseFloat(valueArr[2] || '0')
]);
break;
case 'skewX':
const sx = Math.tan(parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);
Expand Down
21 changes: 21 additions & 0 deletions test/ut/spec/core/matrix.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { rotate } from '../../../../src/core/matrix';

describe('matrix', function () {
it('should rotate relative to a pivot point', function () {
const matrix = [
0.9659258262890683, 0.25881904510252074, -0.25881904510252074, 0.9659258262890683,
40.213201392710246, -26.96358986452364
];
const rad = -0.2617993877991494;
const pivot = [122.511, 139.243];

const result = rotate(matrix, matrix, rad, pivot);

expect(result[0]).toBeCloseTo(0.8660254037844387, 5);
expect(result[1]).toBeCloseTo(0.49999999999999994, 5);
expect(result[2]).toBeCloseTo(-0.49999999999999994, 5);
expect(result[3]).toBeCloseTo(0.8660254037844387, 5);
expect(result[4]).toBeCloseTo(86.03486175696463, 5);
expect(result[5]).toBeCloseTo(-42.600475299156585, 5);
});
});