Skip to content

fix(measure): show a real total in the Measure panel - #1465

Merged
giswqs merged 1 commit into
mainfrom
fix/issue-1460-measure-total
Jul 27, 2026
Merged

fix(measure): show a real total in the Measure panel#1465
giswqs merged 1 commit into
mainfrom
fix/issue-1460-measure-total

Conversation

@giswqs

@giswqs giswqs commented Jul 27, 2026

Copy link
Copy Markdown
Member

Fixes #1460

Problem

Controls -> Measure showed Total Distance / Total Area as 0.00 no matter how much the user measured. The reporter's screenshot captures it exactly: a completed polygon of 1324428.31 Square Kilometers sits in the results list while the readout above reads 0.00.

Root cause

Upstream, in maplibre-gl-components' MeasureControl. The readout rendered only state.currentValue (the drawing in progress). Finishing a measurement re-arms the tool for the next one, and re-arming resets currentValue to zero, so the number labelled "Total" collapsed to 0.00 the instant a measurement completed.

Fix

Bumps maplibre-gl-components to 0.28.1 (opengeos/maplibre-gl-components#124), where the readout now:

  • sums every completed measurement of the active mode plus the one being drawn, so it matches its "Total" label. Measurements from the other mode are excluded, so switching Distance/Area does not mix square kilometers into a distance total.
  • refreshes when a measurement is deleted from the list.
  • stays on screen after Escape while saved measurements remain (including legitimately zero-valued ones); Clear All still hides it.
  • follows the panel's unit selector, which now also re-renders the saved measurements list in the new unit instead of leaving the previous unit's numbers.

No GeoLibre-side wiring changes were needed. main already tracked ^0.28.0, so this is the patch bump plus the lockfile.

Verification

Driven in a browser against the published 0.28.1, in light and dark themes:

Step Result
Draw a distance, finish with Enter total holds at 4300.03 Kilometers, matching the list entry
Add a second measurement total sums to the two entries
Switch unit km -> miles total and both list entries convert
Delete the first entry total drops to the remaining measurement
Escape mid-draw with a saved measurement total stays visible
Escape mid-draw with nothing saved readout hides
Area mode label switches to Total Area, resets per mode, holds after finish; the terrain panel's surface area agrees
Clear All readout and list hide

Gate: npm run build clean, npm run test:frontend 3951 passing, npm run test:worker clean, pre-commit run --files <changed> passing. Upstream: 247 tests passing (7 new MeasureControl cases), lint and build clean, CodeRabbit approved.

Summary by CodeRabbit

  • Bug Fixes
    • Updated the mapping components to a newer patch version, providing the latest available fixes and improvements.

The Measure panel's "Total Distance" / "Total Area" readout dropped to 0.00
the moment a measurement was completed, even though the result was listed
right below it. The readout rendered only the in-progress drawing's value,
and finishing a measurement re-arms the tool, which resets that value to
zero.

Fixed upstream in maplibre-gl-components 0.28.1
(opengeos/maplibre-gl-components#124): the readout now sums the completed
measurements of the active mode plus the one being drawn, refreshes when a
measurement is deleted, and stays on screen after Escape while measurements
remain. The panel's unit selector also re-renders the saved measurements
list in the new unit instead of leaving the previous unit's numbers.

Fixes #1460
Copilot AI review requested due to automatic review settings July 27, 2026 13:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b2d30e13-6a5d-4c61-a732-c212ec7fc486

📥 Commits

Reviewing files that changed from the base of the PR and between 011bdaa and 449cb8a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • apps/geolibre-desktop/package.json
  • packages/plugins/package.json

📝 Walkthrough

Walkthrough

The pull request updates maplibre-gl-components from ^0.28.0 to ^0.28.1 in the desktop application and plugins package manifests.

Changes

Dependency Update

Layer / File(s) Summary
Align dependency constraints
apps/geolibre-desktop/package.json, packages/plugins/package.json
Both package manifests now require maplibre-gl-components version ^0.28.1.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: copilot

Poem

I’m a bunny with a package to bump,
Two manifests hop in a jump.
From twenty-eight-zero to one,
The update is neatly done.
Nibble, review, and onward we run!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the user-visible Measure panel fix delivered by the dependency upgrade.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-1460-measure-total

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

@giswqs
giswqs merged commit 8884678 into main Jul 27, 2026
18 checks passed
@giswqs
giswqs deleted the fix/issue-1460-measure-total branch July 27, 2026 13:21
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.

[Bug]: Total Distance / Total Area in Measure panel shown as 0

2 participants