[fixes #439] May now delete points again, in the FreeformFinSetConfig window
This commit is contained in:
parent
8dfd4bfd53
commit
3593b2197b
@ -397,11 +397,6 @@ public class FreeformFinSetConfig extends FinSetConfig {
|
|||||||
public void mousePressed(MouseEvent event) {
|
public void mousePressed(MouseEvent event) {
|
||||||
int mods = event.getModifiersEx();
|
int mods = event.getModifiersEx();
|
||||||
|
|
||||||
if (event.getButton() != MouseEvent.BUTTON1 || (mods & ANY_MASK) != 0) {
|
|
||||||
super.mousePressed(event);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final int pressIndex = getPoint(event);
|
final int pressIndex = getPoint(event);
|
||||||
if ( pressIndex >= 0) {
|
if ( pressIndex >= 0) {
|
||||||
dragIndex = pressIndex;
|
dragIndex = pressIndex;
|
||||||
@ -432,16 +427,15 @@ public class FreeformFinSetConfig extends FinSetConfig {
|
|||||||
super.mousePressed(event);
|
super.mousePressed(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseDragged(MouseEvent event) {
|
public void mouseDragged(MouseEvent event) {
|
||||||
int mods = event.getModifiersEx();
|
int mods = event.getModifiersEx();
|
||||||
if (dragIndex <= 0 || (mods & (ANY_MASK | MouseEvent.BUTTON1_DOWN_MASK)) != MouseEvent.BUTTON1_DOWN_MASK) {
|
if (dragIndex <= 0 || (mods & (ANY_MASK | MouseEvent.BUTTON1_DOWN_MASK)) != MouseEvent.BUTTON1_DOWN_MASK) {
|
||||||
super.mouseDragged(event);
|
super.mouseDragged(event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Point2D.Double point = getCoordinates(event);
|
|
||||||
|
|
||||||
|
Point2D.Double point = getCoordinates(event);
|
||||||
try {
|
try {
|
||||||
finset.setPoint(dragIndex, point.x, point.y);
|
finset.setPoint(dragIndex, point.x, point.y);
|
||||||
} catch (IllegalFinPointException ignore) {
|
} catch (IllegalFinPointException ignore) {
|
||||||
@ -451,7 +445,6 @@ public class FreeformFinSetConfig extends FinSetConfig {
|
|||||||
updateFields();
|
updateFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseReleased(MouseEvent event) {
|
public void mouseReleased(MouseEvent event) {
|
||||||
dragIndex = -1;
|
dragIndex = -1;
|
||||||
@ -460,24 +453,22 @@ public class FreeformFinSetConfig extends FinSetConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent event) {
|
public void mouseClicked(MouseEvent event) {
|
||||||
int mods = event.getModifiersEx();
|
int mods = event.getModifiersEx();
|
||||||
if (event.getButton() != MouseEvent.BUTTON1 || (mods & ANY_MASK) != MouseEvent.CTRL_DOWN_MASK) {
|
if(( event.getButton() == MouseEvent.BUTTON1) && (0 < (MouseEvent.CTRL_DOWN_MASK & mods))) {
|
||||||
super.mouseClicked(event);
|
int clickIndex = getPoint(event);
|
||||||
return;
|
if ( 0 < clickIndex) {
|
||||||
}
|
// if ctrl+click, delete point
|
||||||
|
try {
|
||||||
int index = getPoint(event);
|
finset.removePoint(clickIndex);
|
||||||
if (index < 0) {
|
} catch (IllegalFinPointException ignore) {
|
||||||
super.mouseClicked(event);
|
log.error("Ignoring IllegalFinPointException while dragging, dragIndex=" + dragIndex + ". This is likely an internal error.");
|
||||||
return;
|
}
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
try {
|
}
|
||||||
finset.removePoint(index);
|
|
||||||
} catch (IllegalFinPointException ignore) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
super.mouseClicked(event);
|
||||||
|
}
|
||||||
|
|
||||||
private int getPoint(MouseEvent event) {
|
private int getPoint(MouseEvent event) {
|
||||||
Point p0 = event.getPoint();
|
Point p0 = event.getPoint();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user