Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
d7908563
Commit
d7908563
authored
Oct 22, 2024
by
Riegel
Browse files
Add camera dragging functionality to MeshView
parent
1ace848c
Pipeline
#10274
passed with stage
in 1 minute and 21 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/MainWindow.java
View file @
d7908563
...
@@ -876,6 +876,10 @@ public class MainWindow extends Application {
...
@@ -876,6 +876,10 @@ public class MainWindow extends Application {
dragX
=
me
.
getScreenX
();
dragX
=
me
.
getScreenX
();
dragY
=
me
.
getScreenY
();
dragY
=
me
.
getScreenY
();
}
}
if
(
me
.
getButton
()
==
MouseButton
.
SECONDARY
)
{
dragX
=
me
.
getScreenX
();
dragY
=
me
.
getScreenY
();
}
});
});
meshView
.
setOnScroll
(
se
->
{
meshView
.
setOnScroll
(
se
->
{
...
@@ -901,6 +905,18 @@ public class MainWindow extends Application {
...
@@ -901,6 +905,18 @@ public class MainWindow extends Application {
cameraZRotation
.
setAngle
(
cameraXRot
);
cameraZRotation
.
setAngle
(
cameraXRot
);
cameraXRotation
.
setAngle
(
cameraYRot
);
cameraXRotation
.
setAngle
(
cameraYRot
);
}
}
if
(
me
.
getButton
()
==
MouseButton
.
SECONDARY
)
{
double
translationSpeed
=
Math
.
abs
(
camera
.
getTranslateZ
())/
1000
;
double
deltaX
=
me
.
getScreenX
()
-
dragX
;
double
deltaY
=
me
.
getScreenY
()
-
dragY
;
dragX
=
me
.
getScreenX
();
dragY
=
me
.
getScreenY
();
camera
.
setTranslateX
(
camera
.
getTranslateX
()
-
deltaX
*
translationSpeed
);
camera
.
setTranslateY
(
camera
.
getTranslateY
()
-
deltaY
*
translationSpeed
);
logger
.
info
(
camera
.
getTranslateX
());
logger
.
info
(
camera
.
getTranslateY
());
}
});
});
}
}
...
@@ -1054,6 +1070,8 @@ public class MainWindow extends Application {
...
@@ -1054,6 +1070,8 @@ public class MainWindow extends Application {
double
d
=
longestSide
/
Math
.
tan
(
Math
.
toRadians
(
30
)
/
2
);
double
d
=
longestSide
/
Math
.
tan
(
Math
.
toRadians
(
30
)
/
2
);
translateZ
=
-
d
;
translateZ
=
-
d
;
camera
.
setTranslateZ
(
translateZ
);
camera
.
setTranslateZ
(
translateZ
);
camera
.
setTranslateX
(
0
);
camera
.
setTranslateY
(
0
);
highlightController
.
changeScaling
(-
translateZ
);
highlightController
.
changeScaling
(-
translateZ
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment