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>
|
</entry>
|
||||||
</map>
|
</map>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>metric</string>
|
||||||
|
<boolean>false</boolean>
|
||||||
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>lastPath</string>
|
<string>lastPath</string>
|
||||||
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop</string>
|
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop</string>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
|
||||||
<string>metric</string>
|
|
||||||
<boolean>true</boolean>
|
|
||||||
</entry>
|
|
||||||
</map>
|
</map>
|
||||||
+10
-1
@@ -16,6 +16,7 @@ import java.awt.dnd.DropTarget;
|
|||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ComponentAdapter;
|
import java.awt.event.ComponentAdapter;
|
||||||
import java.awt.event.ComponentEvent;
|
import java.awt.event.ComponentEvent;
|
||||||
|
import java.awt.event.KeyAdapter;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
@@ -120,7 +121,7 @@ class CanvasPanel extends JComponent implements Autoscroll {
|
|||||||
}
|
}
|
||||||
g.drawImage(bufferImage, 0, 0, this);
|
g.drawImage(bufferImage, 0, 0, this);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
// Do nothing, it will be recreated in the next pass.
|
createBufferImage();
|
||||||
}
|
}
|
||||||
} while (bufferImage == null || bufferImage.contentsLost());
|
} while (bufferImage == null || bufferImage.contentsLost());
|
||||||
}
|
}
|
||||||
@@ -139,6 +140,14 @@ class CanvasPanel extends JComponent implements Autoscroll {
|
|||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
addKeyListener(new KeyAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void keyPressed(KeyEvent e) {
|
||||||
|
plugInPort.mouseMoved(getMousePosition(), e.isControlDown(), e.isShiftDown(), e
|
||||||
|
.isAltDown());
|
||||||
|
}
|
||||||
|
});
|
||||||
addMouseMotionListener(new MouseAdapter() {
|
addMouseMotionListener(new MouseAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+10
@@ -76,6 +76,16 @@ public class ComponentProcessor {
|
|||||||
return cloner.deepClone(properties);
|
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) {
|
public List<ControlPointWrapper> extractControlPoints(Class<? extends IComponentInstance> clazz) {
|
||||||
if (controlPointCache.containsKey(clazz)) {
|
if (controlPointCache.containsKey(clazz)) {
|
||||||
return cloner.deepClone(controlPointCache.get(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)) {
|
if (!components.equals(componentsUnderCursor)) {
|
||||||
componentsUnderCursor = components;
|
componentsUnderCursor = components;
|
||||||
|
|||||||
Reference in New Issue
Block a user