Skip to content

Commit

Permalink
fix issue with multiple non consecutive layer movement
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolaos Pringouris <[email protected]>
  • Loading branch information
nprigour authored and fgdrf committed Feb 13, 2018
1 parent 6b4ee67 commit 467f237
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,17 @@ public String getName() {
public void run( IProgressMonitor monitor ) throws Exception {
// need to reverse otherwise nothing happens on multiselect
Collections.reverse(selection);
int lastAllowedIndex = 0;
for( ILayer layer : selection ) {
int layerIndex = layer.getZorder();
if (layerIndex == lastAllowedIndex) {
lastAllowedIndex++;
continue;
}
getMap().lowerLayer((Layer) layer);
}
}

public void rollback( IProgressMonitor monitor ) throws Exception {
for( ILayer layer : selection ) {
getMap().raiseLayer((Layer) layer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,17 @@ public String getName() {
}

public void run( IProgressMonitor monitor ) throws Exception {
int maxAllowedIndex = getMap().getLayersInternal().size()-1;
for( ILayer layer : selection ) {
int layerIndex = layer.getZorder();
if (layerIndex == maxAllowedIndex) {
maxAllowedIndex--;
continue;
}
getMap().raiseLayer((Layer) layer);
}
}

public void rollback( IProgressMonitor monitor ) throws Exception {
// need to reverse otherwise nothing happens on multiselect
Collections.reverse(selection);
Expand Down

0 comments on commit 467f237

Please sign in to comment.