Introduced getters for executionSpeed
[Mograsim.git] / plugins / net.mograsim.logic.model / src / net / mograsim / logic / model / LogicUICanvas.java
index dda6753..34cfb09 100644 (file)
@@ -53,7 +53,11 @@ public class LogicUICanvas extends ZoomableCanvas
                                setBackground(background);// this.setBackground, not gc.setBackground to have the background fill the canvas
                        renderer.render(gc, new Rectangle(-offX / zoom, -offY / zoom, gW / zoom, gH / zoom));
                });
-               model.setRedrawHandler(this::redrawThreadsafe);
+               model.setRedrawHandler(() ->
+               {
+                       if (!isDisposed())
+                               redrawThreadsafe();
+               });
 
                addListener(SWT.MouseDown, this::mouseDown);
 
@@ -63,7 +67,7 @@ public class LogicUICanvas extends ZoomableCanvas
 
        private void mouseDown(Event e)
        {
-               if (e.button == 1)
+               if (e.button == Preferences.current().getInt("net.mograsim.logic.model.button.action"))
                {
                        Point click = canvasToWorldCoords(e.x, e.y);
                        for (ModelComponent component : model.getComponentsByName().values())