I would like the same convenience setters for Scene.scale and Scene.offset as follows.
set scale(value: (number | number[] | {x?: number; y?: number;})) {
if (typeof value === 'number') {
this.scale.x = this.scale.y = value;
} else if (Array.isArray(value)) {
// setter logic similar to SpriteView
} else if (typeof value === 'object') {
// setter logic similar to SpriteView
} else {
throw new TypeError('Argument must be a number, number array, or object.');
}
}
It seems like this isn't happening now because Scene.scale and Scene.offset are instances of DrawTriggerPoint, but it shouldn't be hard to move these to an internal private variable and convert the public interfaces to getters and setters. What might be more difficult to overcome is the philosophical desire to always be setting the x and y components of a DrawTriggerPoint directly.
The
SpriteView
implementation provides convenient setters for thePositionWorld
etc. properties as:I would like the same convenience setters for
Scene.scale
andScene.offset
as follows.It seems like this isn't happening now because
Scene.scale
andScene.offset
are instances ofDrawTriggerPoint
, but it shouldn't be hard to move these to an internalprivate
variable and convert the public interfaces to getters and setters. What might be more difficult to overcome is the philosophical desire to always be setting thex
andy
components of aDrawTriggerPoint
directly.