fix(marker): respect markLine z2 when computing label z2 in traverseUpdateZ (Fixes #21650) - #21721
Open
waterWang wants to merge 1 commit into
Open
fix(marker): respect markLine z2 when computing label z2 in traverseUpdateZ (Fixes #21650)#21721waterWang wants to merge 1 commit into
waterWang wants to merge 1 commit into
Conversation
…pdateZ When the user sets a `z2` value on a markLine, the label's `z2` should reflect this value so the label stacks correctly relative to other series elements. Currently, `traverseUpdateZ` only uses `-Infinity` as the initial `maxZ2`, and the label's `z2` is computed as `maxZ2 + 2` from child elements. If the child elements' z2 is not set before `traverseUpdateZ` runs, the label gets a default z2 of 2. This fix adds an optional `modelZ2` parameter to `traverseUpdateZ` that seeds the `maxZ2` starting value, ensuring the label's z2 is at least the model's z2 + 2. The marker `updateZ` function now passes the marker model's `z2` to `traverseUpdateZ`. Fixes apache#21650
|
Thanks for your contribution! Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only. To reviewers: If this PR is going to be described in the changelog in the future release, please make sure this PR has one of the following labels: This message is shown because the PR description doesn't contain the document related template. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brief Information
This pull request is in the type of:
What does this PR do?
When the user sets a
z2value on a markLine, the label'sz2should reflect this value so the label stacks correctly relative to other series elements.Root cause
traverseUpdateZuses-Infinityas the initialmaxZ2value, and the label'sz2is computed asmaxZ2 + 2from child elements. If the child elements'z2is not set (or set to 0) beforetraverseUpdateZruns, the label gets a defaultz2of 2, regardless of the markLine'sz2setting.Fix
src/util/graphic.ts: Added an optionalmodelZ2parameter totraverseUpdateZ(). When provided, it seeds themaxZ2starting value, ensuring the label'sz2is at leastmodelZ2 + 2.src/component/marker/MarkerView.ts: TheupdateZfunction now reads the marker model'sz2value and passes it totraverseUpdateZ().Fixed issues
Before: What was the problem?
Setting
markLine.z2had no effect on the label's z-order. The label would always render at a default z2 level regardless of the markLine's z2 configuration.After: How does it fix the problem?
The label's z2 now respects the markLine's z2 setting. The label's z2 is computed as
max(modelZ2, childZ2) + 2, ensuring the label is always above the markLine elements and respects the user's z2 configuration.Other information
This is a minimal fix that only affects the marker (markLine/markPoint/markArea) components. The
traverseUpdateZfunction's existing behavior is preserved for all other callers (themodelZ2parameter is optional).