Skip to content

Commit

Permalink
fix: TransformScale & TransformOffset should also be applied for ever…
Browse files Browse the repository at this point in the history
…y member of an array
  • Loading branch information
tperale committed Dec 8, 2024
1 parent 1fb8010 commit 3fa56e0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/decorators/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ export function Transform<This, Value> (transformFunction: TransformerFunction<T
*/
export function TransformScale<This, Value> (scale: number, opt?: Partial<TransformerOptions>): DecoratorType<This, Value> {
return function (_: any, context: Context<This, Value>) {
transformerDecoratorFactory('transform-scale', x => x * scale, opt)(_, context)
transformerDecoratorFactory('transform-scale', x => x / scale, { ...opt, scope: ExecutionScope.OnWrite })(_, context)
transformerDecoratorFactory('transform-scale', x => x * scale, { ...opt, each: true })(_, context)
transformerDecoratorFactory('transform-scale', x => x / scale, { ...opt, each: true, scope: ExecutionScope.OnWrite })(_, context)
}
}

Expand All @@ -249,8 +249,8 @@ export function TransformScale<This, Value> (scale: number, opt?: Partial<Transf
*/
export function TransformOffset<This, Value> (off: number, opt?: Partial<TransformerOptions>): DecoratorType<This, Value> {
return function (_: any, context: Context<This, Value>) {
transformerDecoratorFactory('transform-offset', x => x + off, opt)(_, context)
transformerDecoratorFactory('transform-offset', x => x - off, { ...opt, scope: ExecutionScope.OnWrite })(_, context)
transformerDecoratorFactory('transform-offset', x => x + off, { ...opt, each: true })(_, context)
transformerDecoratorFactory('transform-offset', x => x - off, { ...opt, each: true, scope: ExecutionScope.OnWrite })(_, context)
}
}

Expand Down

0 comments on commit 3fa56e0

Please sign in to comment.