Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix delete drawing tool to respect the selected layer #4263

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -51,11 +50,6 @@ public void fireViewSelectionChange() {
}
}

public void updateViewList() {
getLayerList()
.setSelectedValue(MapTool.getFrame().getCurrentZoneRenderer().getActiveLayer(), true);
}

private JList<Zone.Layer> getLayerList() {

if (list == null) {
Expand Down Expand Up @@ -83,7 +77,7 @@ private JList<Zone.Layer> getLayerList() {
}

public void setSelectedLayer(Zone.Layer layer) {
list.setSelectedValue(layer, true);
getLayerList().setSelectedValue(layer, true);
}

public interface LayerSelectionListener {
Expand Down
Loading