Skip to content

Commit

Permalink
fix(geom): update applyTransforms()
Browse files Browse the repository at this point in the history
- always remove all spatial transform attribs
  • Loading branch information
postspectacular committed Dec 9, 2022
1 parent 8ecf443 commit b6262c2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/geom/src/apply-transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ import { scale } from "./scale.js";
import { transform } from "./transform.js";
import { translate } from "./translate.js";

const TX_ATTRIBS = ["transform", "translate", "rotate", "scale"];

/** @internal */
const __apply = ($: IShape) => {
let attribs = $.attribs;
if (!attribs) return $;
const { transform: tx, translate: t, rotate: r, scale: s } = attribs;
if (tx)
return transform(
$.withAttribs(withoutKeysObj(attribs, ["transform"])),
$.withAttribs(withoutKeysObj(attribs, TX_ATTRIBS)),
tx
);
if (!(t || r || s)) return $;
$ = $.withAttribs(
withoutKeysObj(attribs, ["translate", "rotate", "scale"])
);
$ = $.withAttribs(withoutKeysObj(attribs, TX_ATTRIBS));
if (r) $ = rotate($, r);
if (s) $ = scale($, s);
if (t) $ = translate($, t);
Expand Down

0 comments on commit b6262c2

Please sign in to comment.