From 44b1501b5c4cd60ea67cc3d0971ed53f53b594e6 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 05 May 2019 10:19:33 -0400
Subject: [PATCH] Support for right click.
---
ObjEditor.java | 2
Torus.java | 4 +-
Cone.java | 4 +-
CameraPane.java | 51 +++++++++++++------------
GroupEditor.java | 2
Object3D.java | 13 +++---
6 files changed, 39 insertions(+), 37 deletions(-)
diff --git a/CameraPane.java b/CameraPane.java
index 66e076a..8658cf7 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -13519,7 +13519,7 @@
public void mousePressed(MouseEvent e)
{
//System.out.println("mousePressed: " + e);
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
}
static long prevtime = 0;
@@ -13595,8 +13595,8 @@
// mode |= META;
//}
- SetMouseMode(WHEEL | e.getModifiersEx());
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
anchorX = ax;
anchorY = ay;
prevX = px;
@@ -13694,7 +13694,7 @@
javax.swing.Timer timer = new javax.swing.Timer(350, this);
- void clickStart(int x, int y, int modifiers)
+ void clickStart(int x, int y, int modifiers, int modifiersex)
{
if (!wasliveok)
return;
@@ -13711,7 +13711,7 @@
// touched = true; // main DL
if (isRenderer)
{
- SetMouseMode(modifiers);
+ SetMouseMode(modifiers, modifiersex);
}
selectX = anchorX = x;
@@ -13724,7 +13724,7 @@
clicked = true;
hold = false;
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
// june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
{
// System.out.println("RESTART II " + modifiers);
@@ -13755,7 +13755,7 @@
info.camera = renderCamera;
info.x = x;
info.y = y;
- info.modifiers = modifiers;
+ info.modifiers = modifiersex;
editObj = object.doEditClick(info, 0);
if (!editObj)
{
@@ -13784,7 +13784,7 @@
clickEnd(e.getX(), e.getY(), e.getModifiersEx());
}
else
- drag(e.getX(), e.getY(), e.getModifiersEx());
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
//try { Thread.sleep(1); } catch (Exception ex) {}
}
@@ -14021,7 +14021,7 @@
{
Globals.lighttouched = true;
}
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
}
//else
}
@@ -14121,7 +14121,7 @@
int X, Y;
boolean SX, SY;
- void drag(int x, int y, int modifiers)
+ void drag(int x, int y, int modifiers, int modifiersex)
{
if (IsFrozen())
{
@@ -14130,17 +14130,17 @@
drag = true; // NEW
- boolean continuous = (modifiers & COMMAND) == COMMAND;
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
X = x;
Y = y;
// floating state for animation
- MODIFIERS = modifiers;
- modifiers &= ~1024;
+ MODIFIERS = modifiersex;
+ modifiersex &= ~1024;
if (false) // modifiers != 0)
{
//new Exception().printStackTrace();
- System.out.println("mouseDragged: " + modifiers);
+ System.out.println("mouseDragged: " + modifiersex);
System.out.println("SHIFT = " + SHIFT);
System.out.println("CONTROL = " + COMMAND);
System.out.println("META = " + META);
@@ -14160,7 +14160,7 @@
info.camera = renderCamera;
info.x = x;
info.y = y;
- object.editWindow.copy.doEditDrag(info);
+ object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
} else
{
if (x < startX)
@@ -14361,7 +14361,7 @@
if (control || command || IsFrozen())
timeout = true;
- else
+// ?? May 2019 else
// timer.setDelay((modifiers & 128) != 0?0:350);
mouseDown = false;
if (!control && !command) // june 2013
@@ -14471,7 +14471,7 @@
System.out.println("keyReleased: " + e);
}
- void SetMouseMode(int modifiers)
+ void SetMouseMode(int modifiers, int modifiersex)
{
//System.out.println("SetMouseMode = " + modifiers);
//modifiers &= ~1024;
@@ -14483,7 +14483,7 @@
//if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
// return;
//System.out.println("SetMode = " + modifiers);
- if ((modifiers & WHEEL) == WHEEL)
+ if ((modifiersex & WHEEL) == WHEEL)
{
mouseMode |= ZOOM;
}
@@ -14493,15 +14493,15 @@
{
mouseMode |= VR; // BACKFORTH;
}
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
{
mouseMode |= SELECT;
}
- if ((modifiers & COMMAND) == COMMAND)
+ if ((modifiersex & COMMAND) == COMMAND)
{
mouseMode |= SELECT;
}
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
{
mouseMode &= ~VR;
mouseMode |= TRANSLATE;
@@ -14530,7 +14530,7 @@
if (isRenderer) //
{
- SetMouseMode(modifiers);
+ SetMouseMode(0, modifiers);
}
Globals.theRenderer.keyPressed(key);
@@ -14990,7 +14990,7 @@
//mode = ROTATE;
if ((MODIFIERS & COMMAND) == 0) // VR??
{
- SetMouseMode(modifiers);
+ SetMouseMode(0, modifiers);
}
}
@@ -15563,6 +15563,7 @@
public boolean mouseDown(Event evt, int x, int y)
{
System.out.println("mouseDown: " + evt);
+ System.exit(0);
/*
locked = true;
drag = false;
@@ -15606,7 +15607,7 @@
{
keyPressed(0, modifiers);
}
- clickStart(x, y, modifiers);
+ // clickStart(x, y, modifiers);
return true;
}
@@ -15724,7 +15725,7 @@
{
keyReleased(0, 0);
}
- drag(x, y, modifiers);
+ drag(x, y, 0, modifiers);
return true;
}
diff --git a/Cone.java b/Cone.java
index f8856e7..979cce1 100644
--- a/Cone.java
+++ b/Cone.java
@@ -314,13 +314,13 @@
return true;
}
- void doEditDrag(ClickInfo info)
+ void doEditDrag(ClickInfo info, boolean opposite)
{
if (hitSomething == 0)
return;
if (hitSomething == 1)
{
- super.doEditDrag(info);
+ super.doEditDrag(info, opposite);
return;
}
double deltaR = info.x - startX;
diff --git a/GroupEditor.java b/GroupEditor.java
index cbd2ec6..a0702c4 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -969,7 +969,7 @@
flashIt = false;
CameraPane pane = (CameraPane) target;
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
if (group.selection.size() == 1)
diff --git a/ObjEditor.java b/ObjEditor.java
index 466594b..9412bce 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -1939,7 +1939,7 @@
//? flashIt = false;
CameraPane pane = (CameraPane) cameraView;
- pane.clickStart(location.x, location.y, 0);
+ pane.clickStart(location.x, location.y, 0, 0);
pane.clickEnd(location.x, location.y, 0, true);
if (group.selection.size() == 1)
diff --git a/Object3D.java b/Object3D.java
index 6536ddc..76593d2 100644
--- a/Object3D.java
+++ b/Object3D.java
@@ -2477,13 +2477,13 @@
return retval;
}
- void doEditDrag(ClickInfo info)
+ void doEditDrag(ClickInfo info, boolean opposite)
{
switch (doSomething)
{
case 1: // '\001'
//super.
- doEditDrag0(info);
+ doEditDrag0(info, opposite);
break;
case 2: // '\002'
@@ -2496,11 +2496,11 @@
{
//sel.hitSomething = childToDrag.hitSomething;
//childToDrag.doEditDrag(info);
- sel.doEditDrag(info);
+ sel.doEditDrag(info, opposite);
} else
{
//super.
- doEditDrag0(info);
+ doEditDrag0(info, opposite);
}
}
break;
@@ -7012,7 +7012,7 @@
return true;
}
- void doEditDrag0(ClickInfo info)
+ void doEditDrag0(ClickInfo info, boolean opposite)
{
if (hitSomething == 0)
{
@@ -7039,7 +7039,7 @@
scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
- if (modified)
+ if (modified || opposite)
{
//assert(false);
/*
@@ -7133,6 +7133,7 @@
if (modified)
{
+ // Rotate 90 degrees
angle /= (Math.PI / 4);
angle = Math.floor(angle + 0.5);
angle *= (Math.PI / 4);
diff --git a/Torus.java b/Torus.java
index af74364..04aba57 100644
--- a/Torus.java
+++ b/Torus.java
@@ -176,13 +176,13 @@
return true;
}
- void doEditDrag(ClickInfo info)
+ void doEditDrag(ClickInfo info, boolean opposite)
{
if (hitSomething == 0)
return;
if (hitSomething == 1)
{
- super.doEditDrag(info);
+ super.doEditDrag(info, opposite);
return;
}
double deltaR = info.x - startX;
--
Gitblit v1.6.2