Is it necessary to add toolSelectedCallback feature?
See original GitHub issuePrerequisites
- Are you running the latest version?
- Are you reporting to the correct repository?
- Did you perform a cursory search?
For more information, see the CONTRIBUTING
guide.
Description
There is the method that pointNearTool
and toolSelectedCallback
that I can only select the tool by mousedown near the handle, but I want to select the tool by mousedown inner the measurement by the pointInnerTool
setted by myself. So I changed the mouseDown.js
:
const annotationToolsWithPointInnerClick = activeAndPassiveTools.filter(
tool => {
const toolState = getToolState(element, tool.name);
const isInnerPoint =
toolState &&
toolState.data &&
tool.pointInnerTool &&
toolState.data.some(data =>
tool.pointInnerTool(element, data, coords, 'mouse')
);
return isInnerPoint;
}
);
if (annotationToolsWithPointInnerClick.length > 0) {
const firstToolInnerPoint = annotationToolsWithPointInnerClick[0];
const toolState = getToolState(element, firstToolInnerPoint.name);
const firstAnnotationInnerPoint = toolState.data.find(data =>
firstToolInnerPoint.pointInnerTool(element, data, coords)
);
if (firstAnnotationInnerPoint && firstToolInnerPoint.innerSelectedCallback) {
firstToolInnerPoint.innerSelectedCallback(
evt,
firstAnnotationInnerPoint,
'mouse'
);
return;
}
}
I Have add my custom feature in my version(forked from the official), @dannyrb If you think it’s necessary to add it , I will create PR.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
API Docs - Cornerstone Tools
This function is a callback to be overwriten in order to provide the wanted feature modal, overlay, popup or any kind of interaction...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@JamesAPetts I’m not consider this problem,now i just choose the first annotation of the array.I need to consider it.
Thanks for the suggestion of @dannyrb ,i will talk about this suggestion with our doctors, now i think it’s not necessary to add this feature, maybe.Thanks!
It’s cool to see other people playing around in the listeners/dispatchers ^_^
Tools that implement
pointNearTool
are basically saying that, if this is true, I want to handle the incoming event, and I want to do it in the library standard way of dragging all handles (unless I’ve overridden the default behavior).Do you see
pointInnerTool
being used for behavior other than dragging all annotation handles? Do you have any practical real world examples of different behavior we might want to use when this is true? Is this behavior that should be a default implementation forinnerSelectedCallback
onBaseAnnotationTool
?To me, the biggest questions/risks are:
pointInnerTool
has a higher chance of multiple tools reporting backtrue
annotation::selected
stateCC: @JamesAPetts
Thanks for the suggestion, @xingbofeng! It’s really encouraging to get feedback and feature requests for this part of the library.