File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 77} from "./drawGraphicsToCanvas"
88import { translateGraphics } from "./translateGraphics"
99import { mergeGraphics } from "./mergeGraphics"
10+ import { setStepOfAllObjects } from "./setStepOfAllObjects"
1011import {
1112 stackGraphicsHorizontally ,
1213 stackGraphicsVertically ,
@@ -35,6 +36,7 @@ export {
3536} from "./drawGraphicsToCanvas"
3637export { translateGraphics } from "./translateGraphics"
3738export { mergeGraphics } from "./mergeGraphics"
39+ export { setStepOfAllObjects } from "./setStepOfAllObjects"
3840export {
3941 stackGraphicsHorizontally ,
4042 stackGraphicsVertically ,
Original file line number Diff line number Diff line change 1+ import type { GraphicsObject } from "./types"
2+
3+ export function setStepOfAllObjects (
4+ graphics : GraphicsObject ,
5+ step : number ,
6+ ) : GraphicsObject {
7+ return {
8+ ...graphics ,
9+ points : graphics . points ?. map ( ( p ) => ( {
10+ ...p ,
11+ step,
12+ } ) ) ,
13+ lines : graphics . lines ?. map ( ( line ) => ( {
14+ ...line ,
15+ step,
16+ } ) ) ,
17+ rects : graphics . rects ?. map ( ( rect ) => ( {
18+ ...rect ,
19+ step,
20+ } ) ) ,
21+ circles : graphics . circles ?. map ( ( circle ) => ( {
22+ ...circle ,
23+ step,
24+ } ) ) ,
25+ texts : graphics . texts ?. map ( ( text ) => ( {
26+ ...text ,
27+ step,
28+ } ) ) ,
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments