After moving the selection with the “MoveMask” command, the following three scripts do not work correctly (no error occurs and nothing changes).
However, if I call the “DeselectMask” command, it will work correctly.
I think it’s probably a bug.
- Change the selection by calling the Selection:select method.
local sprite = app.activeSprite
local bounds = Rectangle(0, 0, 10, 10)
sprite.selection:select(bounds)
app.command.MoveMask{
target='content',
direction='down',
units='pixel',
quantity=10,
wrap=false
}
-- app.command.DeselectMask{} --Uncommenting this line will make it work as expected
local newBounds = Rectangle(0, 0, 20, 20)
sprite.selection:select(newBounds) -- not working
- Call the Selection:deselect method to deselect the selection.
local sprite = app.activeSprite
local bounds = Rectangle(0, 0, 10, 10)
sprite.selection:select(bounds)
app.command.MoveMask{
target='content',
direction='down',
units='pixel',
quantity=10,
wrap=false
}
sprite.selection:deselect() -- not working but app.command.DeselectMask is working
- Assign a value to Selection.origin to move the selection.
local sprite = app.activeSprite
local bounds = Rectangle(0, 0, 10, 10)
sprite.selection:select(bounds)
app.command.MoveMask{
target='content',
direction='down',
units='pixel',
quantity=10,
wrap=false
}
-- app.command.DeselectMask{} --Uncommenting this line will make it work as expected
-- sprite.selection:select(bounds)
sprite.selection.origin = Point(0, 0) -- not working
Thanks for reading!