Comments (6)
I love that design! Yes, it's possible to do this in principle. What would be needed is an extra SVG path
element that serves as mask. (See here for how to use path
to create holes.)
The code that handles the drawing while dragging a new box in Annotorious is here:
https://github.com/recogito/annotorious/blob/master/src/tools/rectangle/RubberbandRect.js
You'd basically just need to add another shape in addition to this.shape
(e.g. called this.mask
) for the masking path, and update it along with this.shape
.
Likewise, the code that handles the drawing for editing an existing shape (=the state in your screenshot above) is here:
https://github.com/recogito/annotorious/blob/master/src/tools/rectangle/EditableRect.js
Steps would need to be repeated there (or, better, of course, shared through some common base function.)
Last but not least, this should probably made optional through some kind of config parameter that users can set outside from the API. But that would be merely a bit of plumbing.
A pull request for this would be great! Let me know if you're interested in giving this a try.
from annotorious.
Just a quick update: I started playing with this and it seems to work pretty well. Will need to find some time to cleanly implement this, but itβs definitely going to come as a feature.
from annotorious.
Sorry I didn't respond sooner, but we have been busy with a newborn baby. I just wanted to let you know that I appreciate your update and I can't wait to grab the latest version of this plugin! Thanks again.
from annotorious.
I just published a new release & includes the mask feature. Two caveats:
- per default, the mask is hidden to keep things consistent with the previous versions for now
- it's only available for rectangle selection for now, but not yet for polygons
To switch it on: the mask is an extra SVG path element with CSS class a9s-selection-mask
. Just apply a style override of your choice, e.g.
.a9s-selection-mask {
fill: rgba(0, 0, 0, 0.6) !important;
}
from annotorious.
The feature is now available in the latest release and a bit of documentation + an example is available here:
https://recogito.github.io/guides/customizing-appearance/
It's not 100% as pixel perfect as in your example. (The annotation outline is centered on the mask hole, rather than aligned with it. Perhaps there are SVG experts out there who have an idea if and how this can be tweaked.)
from annotorious.
Just wanted to report that this works excellent! Looks really good, too! Thank you!
from annotorious.
Related Issues (20)
- Support for multiple `targets` attached to the same `Annotation` HOT 4
- Why the `AnnotationBodyIdentifier` is used? π€ HOT 2
- Missing ID for selected annotation in headless mode HOT 1
- Allow using the `Store` methods with the `TextAnnotation` model
- Rename the `AnnotoriousPlugin` cleanup callback `unmount` -> `destroy`
- Make `AnnotoriousPlugin` a generic container for any specific annotation types
- OpenSeadragon: filtering does not work after drawing an annotation HOT 5
- `AnnotoriousPlugin` component doesn't reapply the `plugin` on its change HOT 4
- Want to know why updates go into formatter twice after annotation dragging
- AnnotationBody 'purpose' field not getting auto-complete
- 'ImageAnnotator' only refers to a type, but is being used as a value here.
- I want the editor to support drop-down options, and I want the author to adopt them HOT 1
- Editor positioning problem, eager to know how the editor positioning is dynamically positioned next to the box HOT 2
- An error occurs in anno.addAnnotation(annotation); HOT 3
- More control over React ImageAnnotator div HOT 1
- Safari rendering bug - box around annotation isn't removed
- No way to remove an annotation that has no body
- Issues when displaying annotations with SVG <path> selector HOT 5
- Unmemoized `AnnotoriousContext` state forces too frequent re-renders for its children HOT 2
- How to customize more drawing tools? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from annotorious.