Workaround for LayerMoveToPrev/Next not selecting correct layer.
Inkscape does not reliably select the previous or next layer when using LayerMoveToPrev or LayerMoveToNext.
This commit is contained in:
parent
5c05570730
commit
9f3e7bf14d
1 changed files with 12 additions and 7 deletions
|
|
@ -78,15 +78,20 @@ class InkscapeCommandLine(object):
|
|||
|
||||
target_index = self._layers.index(layer)
|
||||
|
||||
while True:
|
||||
if self._current_layer_index < target_index:
|
||||
if self._current_layer_index < target_index:
|
||||
for _ in range(target_index - self._current_layer_index):
|
||||
self.apply_to_document('LayerMoveToNext' if with_selection else 'LayerNext')
|
||||
self._current_layer_index += 1
|
||||
elif self._current_layer_index > target_index:
|
||||
elif self._current_layer_index > target_index:
|
||||
for _ in range(self._current_layer_index - target_index):
|
||||
self.apply_to_document('LayerMoveToPrev' if with_selection else 'LayerPrev')
|
||||
self._current_layer_index -= 1
|
||||
else:
|
||||
break
|
||||
else:
|
||||
return
|
||||
|
||||
if with_selection:
|
||||
# When using LayerMoveToNext and LayerMoveToPrev, inkscape does not reliably select the next/previous layer.
|
||||
self._current_layer_index = None
|
||||
else:
|
||||
self._current_layer_index = target_index
|
||||
|
||||
def duplicate_layer(self, layer):
|
||||
self.apply_to_layer(layer, 'LayerDuplicate')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue