-
Notifications
You must be signed in to change notification settings - Fork 307
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
Add annotation color as a tool in the layer's render tab #692
Open
aranega
wants to merge
14
commits into
google:master
Choose a base branch
from
MetaCell:feature/CC-163
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
annotation layers
When a key is inserted in the localToolBinder, the "toJSON()" method is called on the tool. The JSON retrieved from this call is stringyfied and used as key. The "toJSON()" method acts differently on Tool and LegacyTool. When a LayerTool (inheriting from Tool) is created, the "jsonId" is returned by "toJSON()", the strinfigication of this value leads then to insert in the localToolBinder map "mykey" (with quotes) instead of simply mykey. This result in the need to explicitally use "JSON.stringify(...)" on a key before calling "removeJsonString(...)", which is not ideal. This patch on "removeJsonString" searches first for the key and fallsback on the "JSON.stringify(...)" if the key cannot be found in the first place.
CC-201 Style tooltip in local annotation layer
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.
Summary
This PR moves the widget for color management for local annotation from the annotation tab to the rendering tab, improving UI organization and aligning widget placement with its functionality. The local annotation default color widget is also now part of a
Tool
so that it can be used in the new tool palettes.Additionally, this PR fixes an issue in the
removeJsonString
function to handle tool keys, resolving inconsistencies caused by differences in thetoJSON()
method acrossTool
andLegacyTool
classes.User Interaction
Widget Relocation: The widget previously located in the state tab is now found in the rendering tab as a tool. This change simplifies navigation for users working with segment-related settings.
![shadercolor](https://private-user-images.githubusercontent.com/2317394/397787558-cb60af5d-6f2b-493a-a2f0-b6b399af4af0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MTA2NzcsIm5iZiI6MTczODkxMDM3NywicGF0aCI6Ii8yMzE3Mzk0LzM5Nzc4NzU1OC1jYjYwYWY1ZC02ZjJiLTQ5M2EtYTJmMC1iNmIzOTlhZjRhZjAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDdUMDYzOTM3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWI1NTA4OTJiNGRmZWNhOTNmNmEwZWFiNmFmNzY5ZGE2YjA0YTQ1MjZlY2YwNWQ0NjQwNjQwMzM3NWU0MmI3MyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.QDzT792HHVRmEWhqn_M43ERu47rsvJER8bhImTCOV3E)
To notify the user that the default color widget moved to the "rendering tab", a new icon with a question mark is displayed in the local-annotation layer, next to the buttons that allows to create new annotations, with a tooltip stating what are the buttons used for, and where is located the color control.
Implementation
Widget Relocation:
Code Changes: Updates in
layer/annotation/index.ts
moved the initialization and rendering logic of the widget to the rendering tab.removeJsonString
Fix:Problem: The
toJSON()
method forTool
andLegacyTool
behaves differently. ForLayerTool
(inheriting fromTool
),toJSON()
returns ajsonId
value, causing keys inlocalToolBinder
to include quotes (e.g.,"mykey"
instead ofmykey
). This created mismatches when usingremoveJsonString()
, as it required explicitJSON.stringify()
calls.Solution: The fix first attempts to locate the key directly. If it is not found, it falls back to checking the
JSON.stringify()
version. This approach ensures compatibility with bothTool
andLegacyTool
implementations.