tiled icon indicating copy to clipboard operation
tiled copied to clipboard

Fix selection highlight issue for unordered layer lists set by script

Open lhiginbotham opened this issue 1 year ago • 2 comments

  • fixes #3451 where layer selection highlighting was bugging out if the newly set selection was not ordered by layer ID
  • this seems to be an event interplay issue with the following sequence:
    • script sets the layer selection to some array
    • first step in handling that is to set the currently selected layers to be the full array, triggering LayerView::selectedLayersChanged to select the whole range
    • second step is to make sure that the mCurrentLayer variable is pointing to an object within that array selection, which in this bad case it is not, so we end up calling setSelectedLayers with one item, triggering LayerView::selectedLayersChanged again with a single item and effectively clearing out the selection we had just highlighted
  • fix this by doing the second step before the first step

lhiginbotham avatar Oct 24 '22 23:10 lhiginbotham