From c8576e73b3a4816026deef88d82e48199022fb14 Mon Sep 17 00:00:00 2001 From: MiniPear Date: Tue, 25 Apr 2023 14:55:01 +0800 Subject: [PATCH] fix(label): support specified transform (close: #4881) (#4914) --- .../static/alphabetIntervalLabelRotate.png | Bin 0 -> 13812 bytes .../static/alphabet-interval-label-rotate.ts | 29 ++++++++++++++++++ __tests__/plots/static/index.ts | 1 + src/shape/label/label.ts | 15 +++++++-- src/shape/text/advance.ts | 13 ++++++-- 5 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 __tests__/integration/snapshots/static/alphabetIntervalLabelRotate.png create mode 100644 __tests__/plots/static/alphabet-interval-label-rotate.ts diff --git a/__tests__/integration/snapshots/static/alphabetIntervalLabelRotate.png b/__tests__/integration/snapshots/static/alphabetIntervalLabelRotate.png new file mode 100644 index 0000000000000000000000000000000000000000..bdb268b4f770d7c7ea494bfe8ff2948a46af7604 GIT binary patch literal 13812 zcmch82UJsAx9(0tl@0>Z1ws?)ASehN1Tj?M(7Pf{S^$AaOQI+?Km*c55Ge{MMS72@ zpwg5>l@>sXv;^tW-iqhmcgy(i{l|UdjyGToU}vqp*Pd&xZ_e+Vle-tq3|WrwAAul< z1$9B+5`y432!fFq=)e`VucP0=54y|7hWgMU_3K&FizEm-4x#k_u)<_6kA-JCg-4SQ z2h-n}I-q3jZE7+i$*0;LJ??jBAbTZ_;ZUK={?)!iADSE0E( z9;kU7ML_<4{LcF%el-k+itLIbM{%SLFP)(w=1%O81WJ6uI0(pm=YnC{3k0N36dxpk zB3QOT(kMc*GMz4pke93k8G#WGU>6BU84qS0m(#>%s&a7)*3t1g`Y_M6*N}izyA4Cb z7e@{(J;$1A=5{00uMCW@eP|Q~Q~KXQ8h^0dY6-483R@?SUu8%}qC%A*Gu_?ll8#qR zTbtE66kd-vx@t7zyZKRd8bf`*kSI%E70666dc^f}BW5CX?Qt+8PNss##;j#BmA=8V zvk+P*f6KJreb=KY2_7Nz2t2)TdGo2V?|2klxU0yc@f7TDcqxX6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139+=6F6mXhipCVJ+%S?iFFsULSM%|k)-^(5c)K0laW zbTO{y6xE-&V|B{3ZN?IcYRnNgO^Z;uHOGeTaxpsCE5s#?3BD1m<=oy{l{0MrVL zG_nQ9GDju7lhP}Kf#wiG5I1Fu7C$F}agP37Q~ zsZZ<<2;YYF{^Qk9b@L2y#CLO>XU3GN%$@Ga`}EQZ|38=Y?my1Y#GmaCqwNOmDP8?INKH0 zEla)f&mX9SFsydA6>{@c0prc>xW)u>JG$oTAh;>19Z6V0d*!-IEZv_z@dFM*jgebbBFi@pNd<< z>j)=eao`aN0T^D2Djr4EuFH!8cWaSh$-j|_+$UKInNcTL-WBicMg3LFdlZMGM=B$X4;D8fa6PE>-TE~pi zI#*S5`U4p$$0$UOES0?~pjiD^5RsR=a|n|+yy<*sW1$QFjSE5 = (options) => { return (points, value, coordinate, theme) => { - const { text, x, y, ...overrideStyle } = value; + const { + text, + x, + y, + transform: specifiedTS = '', + transformOrigin, + ...overrideStyle + } = value; const { rotate = 0, transform = '', @@ -56,7 +63,11 @@ export const Label: SC = (options) => { return select(new Advance()) .call(applyStyle, defaultStyle) .style('text', `${text}`) - .style('transform', `${transform}rotate(${+rotate})`) + .style( + 'labelTransform', + `${transform} rotate(${+rotate}) ${specifiedTS}`.trim(), + ) + .style('labelTransformOrigin', transformOrigin) .style('coordCenter', coordinate.getCenter()) .call(applyStyle, overrideStyle) .node(); diff --git a/src/shape/text/advance.ts b/src/shape/text/advance.ts index 1d8b69170b..51f0334c4e 100644 --- a/src/shape/text/advance.ts +++ b/src/shape/text/advance.ts @@ -40,6 +40,9 @@ type TextShapeStyleProps = Omit & connector?: boolean; startMarker?: boolean; endMarker?: boolean; + labelTransform?: string; + labelTransformOrigin?: string; + rotate?: number; }; function getConnectorPoint(shape: GText | Rect) { @@ -125,8 +128,9 @@ export const Advance = createElement((g) => { // Do not pass className class: className, transform, - // @ts-ignore rotate, + labelTransform, + labelTransformOrigin, x, y, x0 = x, @@ -147,7 +151,12 @@ export const Advance = createElement((g) => { const shape1 = select(g) .maybeAppend('text', 'text') .style('zIndex', 0) - .call(applyStyle, { textBaseline: 'middle', ...rest }) + .call(applyStyle, { + textBaseline: 'middle', + transform: labelTransform, + transformOrigin: labelTransformOrigin, + ...rest, + }) .node(); const shape2 = select(g)