diff --git a/src/main/java/net/rptools/maptool/client/tool/DefaultTool.java b/src/main/java/net/rptools/maptool/client/tool/DefaultTool.java index b5c5bdab03..124543185b 100644 --- a/src/main/java/net/rptools/maptool/client/tool/DefaultTool.java +++ b/src/main/java/net/rptools/maptool/client/tool/DefaultTool.java @@ -82,7 +82,8 @@ protected void selectedLayerChanged(Zone.Layer layer) { protected void attachTo(ZoneRenderer renderer) { super.attachTo(renderer); this.renderer = renderer; - layerSelectionDialog.updateViewList(); + selectedLayer = renderer.getActiveLayer(); + layerSelectionDialog.setSelectedLayer(selectedLayer); } @Override diff --git a/src/main/java/net/rptools/maptool/client/tool/PointerTool.java b/src/main/java/net/rptools/maptool/client/tool/PointerTool.java index ab604560ed..91014d70da 100644 --- a/src/main/java/net/rptools/maptool/client/tool/PointerTool.java +++ b/src/main/java/net/rptools/maptool/client/tool/PointerTool.java @@ -139,7 +139,7 @@ protected void attachTo(ZoneRenderer renderer) { } htmlRenderer.attach(renderer); - if (renderer.getActiveLayer() != Zone.Layer.TOKEN) { + if (getSelectedLayer() != Zone.Layer.TOKEN) { MapTool.getFrame().getToolbox().setSelectedTool(StampTool.class); } } diff --git a/src/main/java/net/rptools/maptool/client/tool/drawing/AbstractDrawingTool.java b/src/main/java/net/rptools/maptool/client/tool/drawing/AbstractDrawingTool.java index ce333d34c6..1dd7d2d847 100644 --- a/src/main/java/net/rptools/maptool/client/tool/drawing/AbstractDrawingTool.java +++ b/src/main/java/net/rptools/maptool/client/tool/drawing/AbstractDrawingTool.java @@ -333,7 +333,7 @@ protected void completeDrawable(GUID zoneId, Pen pen, Drawable drawable) { return; } if (MapTool.getPlayer().isGM()) { - drawable.setLayer(renderer.getActiveLayer()); + drawable.setLayer(getSelectedLayer()); } else { drawable.setLayer(Layer.TOKEN); } diff --git a/src/main/java/net/rptools/maptool/client/tool/drawing/DeleteDrawingTool.java b/src/main/java/net/rptools/maptool/client/tool/drawing/DeleteDrawingTool.java index 5250322d98..e06ed88f72 100644 --- a/src/main/java/net/rptools/maptool/client/tool/drawing/DeleteDrawingTool.java +++ b/src/main/java/net/rptools/maptool/client/tool/drawing/DeleteDrawingTool.java @@ -33,7 +33,6 @@ import net.rptools.maptool.client.ui.zone.ZoneRenderer; import net.rptools.maptool.events.MapToolEventBus; import net.rptools.maptool.model.GUID; -import net.rptools.maptool.model.Zone.Layer; import net.rptools.maptool.model.ZonePoint; import net.rptools.maptool.model.drawing.DrawnElement; @@ -46,8 +45,6 @@ public class DeleteDrawingTool extends DefaultTool implements ZoneOverlay, Mouse private static final DrawPanelPopupMenu.DeleteDrawingAction deleteAction = new DrawPanelPopupMenu.DeleteDrawingAction(selectedDrawings); - private static Layer selectedLayer = Layer.TOKEN; - public DeleteDrawingTool() { new MapToolEventBus().getMainEventBus().register(this); } @@ -91,7 +88,7 @@ public void mouseClicked(MouseEvent e) { if (!multiSelect) selectedDrawings.clear(); - var drawableList = zone.getDrawnElements(selectedLayer); + var drawableList = zone.getDrawnElements(getSelectedLayer()); for (var element : drawableList) { var drawable = element.getDrawable(); var id = drawable.getId(); diff --git a/src/main/java/net/rptools/maptool/client/tool/layerselectiondialog/LayerSelectionDialog.java b/src/main/java/net/rptools/maptool/client/tool/layerselectiondialog/LayerSelectionDialog.java index fe8eab0b4b..40300b8d9f 100644 --- a/src/main/java/net/rptools/maptool/client/tool/layerselectiondialog/LayerSelectionDialog.java +++ b/src/main/java/net/rptools/maptool/client/tool/layerselectiondialog/LayerSelectionDialog.java @@ -20,7 +20,6 @@ import javax.swing.JList; import javax.swing.JPanel; import javax.swing.ListSelectionModel; -import net.rptools.maptool.client.MapTool; import net.rptools.maptool.client.swing.AbeillePanel; import net.rptools.maptool.model.Zone; @@ -51,11 +50,6 @@ public void fireViewSelectionChange() { } } - public void updateViewList() { - getLayerList() - .setSelectedValue(MapTool.getFrame().getCurrentZoneRenderer().getActiveLayer(), true); - } - private JList getLayerList() { if (list == null) { @@ -83,7 +77,7 @@ private JList getLayerList() { } public void setSelectedLayer(Zone.Layer layer) { - list.setSelectedValue(layer, true); + getLayerList().setSelectedValue(layer, true); } public interface LayerSelectionListener {