mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
improved d&d
fixed deadlock
This commit is contained in:
@@ -20,12 +20,12 @@
|
||||
</entry>
|
||||
</map>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>metric</string>
|
||||
<boolean>false</boolean>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>lastPath</string>
|
||||
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>metric</string>
|
||||
<boolean>true</boolean>
|
||||
</entry>
|
||||
</map>
|
||||
+10
-1
@@ -16,6 +16,7 @@ import java.awt.dnd.DropTarget;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
@@ -120,7 +121,7 @@ class CanvasPanel extends JComponent implements Autoscroll {
|
||||
}
|
||||
g.drawImage(bufferImage, 0, 0, this);
|
||||
} catch (NullPointerException e) {
|
||||
// Do nothing, it will be recreated in the next pass.
|
||||
createBufferImage();
|
||||
}
|
||||
} while (bufferImage == null || bufferImage.contentsLost());
|
||||
}
|
||||
@@ -139,6 +140,14 @@ class CanvasPanel extends JComponent implements Autoscroll {
|
||||
invalidate();
|
||||
}
|
||||
});
|
||||
addKeyListener(new KeyAdapter() {
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
plugInPort.mouseMoved(getMousePosition(), e.isControlDown(), e.isShiftDown(), e
|
||||
.isAltDown());
|
||||
}
|
||||
});
|
||||
addMouseMotionListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
|
||||
+10
@@ -76,6 +76,16 @@ public class ComponentProcessor {
|
||||
return cloner.deepClone(properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads all control points from the specified component class. Note than
|
||||
* control points are cached, so it may happen that control points returned
|
||||
* already have their values populated. Always use
|
||||
* {@link ControlPointWrapper#readFrom(IComponentInstance)} to update their
|
||||
* state from an actual component.
|
||||
*
|
||||
* @param clazz
|
||||
* @return
|
||||
*/
|
||||
public List<ControlPointWrapper> extractControlPoints(Class<? extends IComponentInstance> clazz) {
|
||||
if (controlPointCache.containsKey(clazz)) {
|
||||
return cloner.deepClone(controlPointCache.get(clazz));
|
||||
|
||||
+4
@@ -400,6 +400,10 @@ public class Presenter implements IPlugInPort {
|
||||
}
|
||||
}
|
||||
}
|
||||
// If CTRL is pressed, we only care about the top most component.
|
||||
if (altDown && components.size() > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!components.equals(componentsUnderCursor)) {
|
||||
componentsUnderCursor = components;
|
||||
|
||||
Reference in New Issue
Block a user