Skip to content

Fix zoom transformations to be based on display coordinates instead of data coordinates - #602

Merged
wirew0rm merged 6 commits into
mainfrom
fixZoomTransformations
Aug 17, 2023
Merged

wirew0rm merged 6 commits into
mainfrom
fixZoomTransformations

Conversation

@wirew0rm

@wirew0rm wirew0rm commented Aug 16, 2023

Copy link
Copy Markdown
Member

Previously the zoomer would perform the scroll-zoom and panning calculations in data coordinates. This is identical to pixel coordinates for linear axes, but for e.g. log axes this leads to strange behaviour since it can result in negative data values.

This changes the Pan and pan and scroll behaviour, the rectangle zoom was naturally always using screen coordinates anyway, so this should also be more consistent.

To archive this a change to AbstractAxis was necessary to update cached variables on range change.

If the axis gets changed multiple times during event handling, but the cache is only updated during layout, axes transforms from the event handlers use outdated transformations. This has the effect that e.g. panning only applies the first mouse event in each pulse and the panning is a lot slower than the actual mouse movement.

Also incorporates a small fix in the pom to use valid automatic module names, converts the ErrorDataSetRendererStylingSample to a correct FxSampler sample and fixes 2 small bugs:

  • the cached value of isLogAxis in NumericAxis was never updated so it could not be switched by its property
  • the Plugins have been changed to use Panes instead of Groups for Positioning, resolving a bug where relayouting during an ongoing zoom action would shift the zoom rect to the upper left corner.

@wirew0rm
wirew0rm temporarily deployed to coverage August 16, 2023 17:52 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 16, 2023 17:52 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 16, 2023 17:52 — with GitHub Actions Inactive
@pr-explainer-bot

Copy link
Copy Markdown

Pull Request Report

Changes

  1. Updated chartfx-acc/pom.xml:
    • Changed <project.moduleName> from io.fair-acc.acc to io.fair_acc.acc.
    • Updated <javalin.version> to 3.9.0.
    • Updated <jetty.version> to 9.4.29.v20200521.
    • Updated <micrometer.version> to 1.5.1.
  2. Updated chartfx-chart/pom.xml:
    • Changed <project.moduleName> from io.fair-acc.chartfx to io.fair_acc.chartfx.
    • Updated <sass.version> to 1.64.2.
    • Updated <scss.inputDir> to ${project.basedir}/src/main/resources/io/fair_acc/chartfx/.
    • Updated <css.outputDir> to ${scss.inputDir}.
  3. Updated chartfx-chart/src/main/java/io/fair_acc/chartfx/axes/spi/AbstractAxisParameter.java:
    • Added code to update cached variables after setting min and max properties.
  4. Updated chartfx-chart/src/main/java/io.fair_acc/chartfx/plugins/Zoomer.java:
    • Modified panChart method to fix panning behavior.
    • Modified zoomOnAxis method to fix zooming behavior.
  5. Updated chartfx-dataset/pom.xml:
    • Changed <project.moduleName> from io.fair-acc.dataset to io.fair_acc.dataset.
  6. Updated chartfx-generate/pom.xml:
    • Changed <project.moduleName> from io.fair-acc.generate to io.fair_acc.generate.
  7. Updated chartfx-math/pom.xml:
    • Changed <project.moduleName> from io.fair-acc.math to io.fair_acc.math.
  8. Updated chartfx-report/pom.xml:
    • Changed <project.moduleName> from io.fair-acc.chartfx_report to io.fair_acc.chartfx_report.
  9. Updated `chartfx-s

@wirew0rm
wirew0rm temporarily deployed to deploy August 16, 2023 17:52 — with GitHub Actions Inactive
@codecov

codecov Bot commented Aug 16, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 58.62% and no project coverage change.

Comparison is base (14fcc0c) 49.62% compared to head (e63d771) 49.62%.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #602   +/-   ##
=========================================
  Coverage     49.62%   49.62%           
- Complexity     6238     6239    +1     
=========================================
  Files           378      379    +1     
  Lines         37583    37593   +10     
  Branches       6158     6159    +1     
=========================================
+ Hits          18652    18657    +5     
- Misses        17701    17710    +9     
+ Partials       1230     1226    -4     
Files Changed Coverage Δ
...t/src/main/java/io/fair_acc/chartfx/axes/Axis.java 0.00% <0.00%> (ø)
.../main/java/io/fair_acc/chartfx/plugins/Zoomer.java 25.92% <0.00%> (-0.38%) ⬇️
.../fair_acc/chartfx/axes/spi/DefaultNumericAxis.java 68.53% <75.00%> (+0.13%) ⬆️
...chart/src/main/java/io/fair_acc/chartfx/Chart.java 79.41% <100.00%> (-0.28%) ⬇️
...ava/io/fair_acc/chartfx/axes/spi/AbstractAxis.java 80.89% <100.00%> (ø)
...ir_acc/chartfx/axes/spi/AbstractAxisParameter.java 92.66% <100.00%> (+0.02%) ⬆️
...io/fair_acc/chartfx/axes/spi/OscilloscopeAxis.java 75.15% <100.00%> (ø)
...c/main/java/io/fair_acc/chartfx/utils/FXUtils.java 89.34% <100.00%> (+0.25%) ⬆️

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wirew0rm
wirew0rm temporarily deployed to deploy August 16, 2023 17:56 — with GitHub Actions Inactive
@wirew0rm wirew0rm changed the title Fix zoom transformations to be based on display coordinates rather than Fix zoom transformations to be based on display coordinates instead of data coordinates Aug 16, 2023
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 08:46 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 08:46 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 08:46 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 08:46 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 08:46 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 08:46 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to deploy August 17, 2023 08:49 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to deploy August 17, 2023 08:50 — with GitHub Actions Inactive
wirew0rm and others added 3 commits August 17, 2023 13:56
There was a small bug in the logAxis properties invalidation listener.
It updated the cached value with a method that used the cached value
resulting in a nop instead of updating it with the new value of the
property.
@wirew0rm
wirew0rm force-pushed the fixZoomTransformations branch from c05ad2f to 10d7173 Compare August 17, 2023 11:59
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 11:59 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 11:59 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 11:59 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 11:59 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 11:59 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 11:59 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to deploy August 17, 2023 12:02 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to deploy August 17, 2023 12:02 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 13:03 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 13:03 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 13:03 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 13:03 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 13:03 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 13:03 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to deploy August 17, 2023 13:07 — with GitHub Actions Inactive
@wirew0rm
wirew0rm requested a review from ennerf August 17, 2023 13:07
@wirew0rm
wirew0rm temporarily deployed to deploy August 17, 2023 13:07 — with GitHub Actions Inactive
Comment thread chartfx-chart/src/main/java/io/fair_acc/chartfx/Chart.java Outdated
ennerf
ennerf previously approved these changes Aug 17, 2023
wirew0rm and others added 3 commits August 17, 2023 15:31
If the axis gets changed multiple times during event handling, but the
cache is only updated during layout, axes transforms from the event
handlers use outdated transformations.

This has the effect that e.g. panning only applies the first mouse event
in each pulse and the panning is a lot slower than the actual mouse
movement.

This adds a method to the axes which can be called by plugins which use
and update the axis range.
Previously the zoomer would perform the scroll-zoom and panning
calculations in data coordinates. This is identical to pixel coordinates
for linear axes, but for e.g. log axes this leads to strange behaviour
since it can result in negative data values.

This changes the Pan and pan and scroll behaviour, the rectangle zoom
was naturally always using screen coordinates anyway, so this should
also be more consistent.
It seems that groups are not well suited to positioning nodes on top of
the graph. Replacing the Groups for the Plugins by Panes fixes an issue
where the zoom rectangle would shift to the upper left corner of the
chart area whenever there was a relayout while a rectangle zoom was
ongoing.
@wirew0rm
wirew0rm force-pushed the fixZoomTransformations branch from 07a3168 to e63d771 Compare August 17, 2023 13:32
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 13:32 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 13:32 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 13:32 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 13:32 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 13:32 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to coverage August 17, 2023 13:32 — with GitHub Actions Inactive
@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@wirew0rm
wirew0rm temporarily deployed to deploy August 17, 2023 13:36 — with GitHub Actions Inactive
@wirew0rm
wirew0rm temporarily deployed to deploy August 17, 2023 13:36 — with GitHub Actions Inactive
@wirew0rm
wirew0rm merged commit ca15519 into main Aug 17, 2023
@wirew0rm
wirew0rm deleted the fixZoomTransformations branch August 17, 2023 14:05

This branch was previously deployed

2 inactive deployments
deploy e63d7711 Deployed Aug 17, 2023 by wirew0rm
coverage e63d7711 Deployed Aug 17, 2023 by wirew0rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants