Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disables the lock when the camera is dynamic #353

Merged
merged 2 commits into from
Oct 28, 2024
Merged

Conversation

AlexisDrogoul
Copy link
Member

No description provided.

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

Change in average Code Health of affected files: -0.02 (9.44 -> 9.42)

  • Declining Code Health: 1 findings(s) 🚩

View detailed results in CodeScene

@AlexisDrogoul
Copy link
Member Author

Should fix #350

@AlexisDrogoul AlexisDrogoul added About UI This is an UI-related issue or request 📺 Display Java2D This issue or request concerns only Java2D displays 🖥 Display OpenGL This issue or request concerns only OpenGL displays labels Oct 12, 2024
@AlexisDrogoul AlexisDrogoul changed the title Disables the zoom when the camera is dynamic Disables the lock when the camera is dynamic Oct 12, 2024
@lesquoyb
Copy link
Contributor

It works, but one side effect is that setting a camera with locked: true facet will completely disable locking/unlocking on the display during the simulation.
Is this intended?
I have no opinion on this, just checking before merging

The "dynamic" and "locked" states are now clearly separated in terms of logic. While "dynamic: true" prevents the camera to be manipulated and disables the lock button, "locked: true" will allow the user to overcome the state from the UI.
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: FAILED

Change in average Code Health of affected files: -0.04 (8.00 -> 7.96)

  • Declining Code Health: 5 findings(s) 🚩

View detailed results in CodeScene

Comment on lines +105 to +111
if (cameraLocked != null) {
boolean locked = view.isCameraLocked();
boolean dynamic = view.isCameraDynamic();
tb.setSelection(cameraLocked, locked || dynamic);
// If the camera is dynamic, we disable the control (see #350)
cameraLocked.setEnabled(!dynamic);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Getting worse: Complex Method
install increases in cyclomatic complexity from 13 to 14, threshold = 9

Suppress

@@ -688,7 +688,12 @@ public void setZFar(final Double zF) {
public void update(final IScope scope, final Facets facets) {

if (cameraNameExpression != null) {
boolean isLocked = camera == null ? false : camera.isLocked();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ New issue: Bumpy Road Ahead
update has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function

Suppress

@@ -144,7 +143,7 @@ public void update(final IScope scope) {
*/
@Override
public boolean setLocation(final GamaPoint loc) {
if (!isInteractive() || loc == null) return false;
if (isLocked() || isDynamic() || loc == null) return false;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ New issue: Complex Conditional
setLocation has 1 complex conditionals with 2 branches, threshold = 2

Suppress

@@ -159,7 +158,7 @@ public boolean setLocation(final GamaPoint loc) {
*/
@Override
public boolean setTarget(final GamaPoint loc) {
if (!isInteractive() || loc == null) return false;
if (isLocked() || isDynamic() || loc == null) return false;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ New issue: Complex Conditional
setTarget has 1 complex conditionals with 2 branches, threshold = 2

Suppress


@Override
public boolean setDistance(final Double d) {
if (!isInteractive() || d == null) return false;
if (isLocked() || isDynamic() || d == null) return false;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ New issue: Complex Conditional
setDistance has 1 complex conditionals with 2 branches, threshold = 2

Suppress

@lesquoyb lesquoyb merged commit 808c9b7 into 2024-06 Oct 28, 2024
4 of 6 checks passed
@lesquoyb lesquoyb deleted the Addresses-#350 branch October 28, 2024 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
About UI This is an UI-related issue or request 📺 Display Java2D This issue or request concerns only Java2D displays 🖥 Display OpenGL This issue or request concerns only OpenGL displays
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants