Skip to content

Commit

Permalink
Fixed issue #359.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsschmidt1337 committed Jul 22, 2016
1 parent 96404c6 commit c65049e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
23 changes: 19 additions & 4 deletions src/org/nschmidt/ldparteditor/helpers/Manipulator.java
Original file line number Diff line number Diff line change
Expand Up @@ -980,26 +980,41 @@ public void startTranslation2(Composite3D c3d) {
public void applyTranslation(Composite3D c3d) {
if (modified) {
c3d.getLockableDatFileReference().getVertexManager().transformSelection(accurateResult, null, Editor3DWindow.getWindow().isMovingAdjacentData());
modified = false;
}
resetTranslation();
}

public void applyTranslationAtSelect(Composite3D c3d) {
if (modified) {
c3d.getLockableDatFileReference().getVertexManager().transformSelection(accurateResult, null, Editor3DWindow.getWindow().isMovingAdjacentData());
modified = false;
}
resetTranslation();
x_Translate = false;
y_Translate = false;
// x_Translate = false;
// y_Translate = false;
}

public void resetTranslation() {
accurateResult = View.ACCURATE_ID;
accurateScale = View.ACCURATE_ID;
Matrix4f.setIdentity(result);
Matrix4f.setIdentity(scale);
x_Translate = false;
y_Translate = false;
z_Translate = false;
x_Rotate = false;
y_Rotate = false;
z_Rotate = false;
x_Scale = false;
y_Scale = false;
z_Scale = false;

x_rotatingForwards = false;
x_rotatingBackwards = false;
y_rotatingForwards = false;
y_rotatingBackwards = false;
z_rotatingForwards = false;
z_rotatingBackwards = false;
modified = false;
}

public Vector4f transform(Vector2f old_mouse_position, int new_x, int new_y, Composite3D c3d) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public MouseActions(Composite3D c3d) {
public void mouseDown(Event event) {

syncManipulator();
c3d.getManipulator().lock();

final DatFile datfile = c3d.getLockableDatFileReference();
if (!datfile.isDrawSelection()) return;
Expand All @@ -125,8 +126,7 @@ public void mouseDown(Event event) {
mouse_button_pressed = event.button;
old_mouse_position.set(event.x, event.y);
switch (event.button) {
case MouseButton.LEFT:
c3d.getManipulator().lock();
case MouseButton.LEFT:
final Editor3DWindow window = Editor3DWindow.getWindow();
if ((event.stateMask & SWT.SHIFT) == SWT.SHIFT && !window.isAddingSomething()) {
Manipulator M = c3d.getManipulator();
Expand Down Expand Up @@ -671,6 +671,7 @@ public void mouseMove(Event event) {
public void mouseUp(Event event) {

syncManipulator();
c3d.getManipulator().unlock();

final DatFile datfile = c3d.getLockableDatFileReference();
final VertexManager vm = datfile.getVertexManager();
Expand All @@ -682,8 +683,7 @@ public void mouseUp(Event event) {

mouse_button_pressed = 0;
switch (event.button) {
case MouseButton.LEFT:
c3d.getManipulator().unlock();
case MouseButton.LEFT:
c3d.setDoingSelection(false);
final Editor3DWindow window = Editor3DWindow.getWindow();
if (window.isAddingSomething() && !datfile.isReadOnly()) {
Expand Down Expand Up @@ -1273,6 +1273,7 @@ public void mouseUp(Event event) {
break;
}

c3d.getManipulator().resetTranslation();
syncManipulator();

}
Expand Down

0 comments on commit c65049e

Please sign in to comment.