mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
painting issue fix
This commit is contained in:
+6
-3
@@ -63,10 +63,11 @@ public class MainFrame extends JFrame implements IView {
|
||||
presenter.installPlugin(new HelpManager());
|
||||
|
||||
presenter.installPlugin(new StatusBar());
|
||||
presenter.installPlugin(new CanvasPlugin());
|
||||
CanvasPlugin canvasPlugin = new CanvasPlugin();
|
||||
presenter.installPlugin(canvasPlugin);
|
||||
|
||||
Project project = new Project();
|
||||
// project.getComponents().add(new MockComponentInstance());
|
||||
// project.getComponents().add(new MockComponentInstance());
|
||||
presenter.loadProject(project, true);
|
||||
|
||||
addWindowListener(new WindowAdapter() {
|
||||
@@ -81,7 +82,9 @@ public class MainFrame extends JFrame implements IView {
|
||||
presenter.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: hack to fix painting issues with rulers in the scroll pane.
|
||||
// Find a better solution if possible.
|
||||
canvasPlugin.refresh();
|
||||
// setGlassPane(new CustomGlassPane());
|
||||
// getGlassPane().setVisible(true);
|
||||
}
|
||||
|
||||
+12
-1
@@ -2,6 +2,7 @@ package com.diyfever.diylc.plugins.canvas;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.swing.SwingConstants;
|
||||
@@ -103,6 +104,16 @@ public class CanvasPlugin implements IPlugIn {
|
||||
Dimension d = plugInPort.getCanvasDimensions(true);
|
||||
canvasPanel.setSize(d);
|
||||
canvasPanel.setPreferredSize(d);
|
||||
scrollPane.setZoomLevel(plugInPort.getZoomLevel());
|
||||
getScrollPane().setZoomLevel(plugInPort.getZoomLevel());
|
||||
}
|
||||
|
||||
/**
|
||||
* Causes ruller scroll pane to refresh by sending a fake mouse moved
|
||||
* message to the canvasPanel.
|
||||
*/
|
||||
public void refresh() {
|
||||
MouseEvent event = new MouseEvent(canvasPanel, MouseEvent.MOUSE_MOVED, System
|
||||
.currentTimeMillis(), 0, 0, 0, 0, false);
|
||||
canvasPanel.dispatchEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user