Comments (11)
Hmm I am able to trigger the events even in editMode
Here's the relevant code, maybe it's a bug related to the setup you have are you using webpack? rollup? the direct script?
Example code:
const makeAnnotations = d3.annotation()
.type(d3.annotationCalloutCircle)
.annotations(annotations)
.editMode(true)
.on('subjectover', function(){
console.log('subjectover', d3.event, d3.event.type)
})
.on('subjectout', function(){
console.log('subjectout', d3.event, d3.event.type)
})
.on('noteover', function(){
console.log('noteover', d3.event, d3.event.type)
})
from d3-annotation.
Hmmm I should be triggering those events in edit mode: https://github.com/susielu/d3-annotation/blob/master/src/Types-d3.js#L257
What is your use case? Maybe it's not being registered in the right way?
from d3-annotation.
i wanted to have access to the event like : .on('subjectover', ...., .on( 'subjectclick', etc, ....
my use case is : after a drag event end , i want to catch the new dx/dy position and store it in my database with the annotation.
the work around i do is not efficient : i have a toggle button to switch editMode. when it's switch to false i do a loop on all annotations to see which one as changed then save it to the database
from d3-annotation.
Ah okay do any of these events fit your use case?
https://github.com/susielu/d3-annotation/blob/master/src/Adapter-d3.js#L20
You should be able to register an on subjectout but let me know if you run into issues with it.
from d3-annotation.
this is what i tried but it's not working, but maybe i do something wrong or missing ;-)
from d3-annotation.
Gotchaaaaa I'll take a look probably a bug on my end. Will let you know when I have an update.
from d3-annotation.
thanks cool susie
from d3-annotation.
i use directly the plugin. but i just realise that my use case explanation was not clear.
in fact, my expectation is to have something like that :
.on('dragend',function(){
//execute my code
})
if i use
.on('noteout', function(){
//execute my code
})
it works but called each time i drag the anntotation
from d3-annotation.
Ahhhh okay understood thanks for the clarification.
from d3-annotation.
In the latest version 1.15.0 there are now dragstart and dragend events, let me know if you have any issues using it.
from d3-annotation.
hi susie,
i just tested and everything is fine & simplify my life ;-)
thanks
from d3-annotation.
Related Issues (20)
- Annotations type change dynamically HOT 5
- The property `subject` don't work when config the annotation in version 2.2.2 HOT 3
- Overlapping Demo is broken HOT 2
- Multiple colors and text justification within annotation label HOT 1
- Drag connector end when editMode is enabled HOT 3
- EditMode not working properly in ShadowDOM HOT 5
- Missing Typescript type - notePadding() HOT 1
- Custom orientation being overridden HOT 3
- d3 v5 HOT 5
- TypeScript type definition missing Annotation.on HOT 1
- Canvas scaling? HOT 2
- Note placement HOT 3
- text.annotation-note-label overlaps text.annotation-note-title (rather than offsetting)
- Typescript error when calling makeAnnotations from the example
- please upgrade to d3 v6
- editMode Does not work after d3 v6 HOT 1
- Is it possible to create a hyperlink for annotation's title?
- subjectout is triggered constanly when hovering (Firefox)
- annotations editable by end user
- Will the package be updated? Can we do PRs?
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 d3-annotation.