Giter Club home page Giter Club logo

Comments (11)

susielu avatar susielu commented on May 27, 2024 1

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)
          })

over

from d3-annotation.

susielu avatar susielu commented on May 27, 2024

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.

lorenzopub avatar lorenzopub commented on May 27, 2024

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.

susielu avatar susielu commented on May 27, 2024

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.

lorenzopub avatar lorenzopub commented on May 27, 2024

this is what i tried but it's not working, but maybe i do something wrong or missing ;-)

from d3-annotation.

susielu avatar susielu commented on May 27, 2024

Gotchaaaaa I'll take a look probably a bug on my end. Will let you know when I have an update.

from d3-annotation.

lorenzopub avatar lorenzopub commented on May 27, 2024

thanks cool susie

from d3-annotation.

lorenzopub avatar lorenzopub commented on May 27, 2024

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.

susielu avatar susielu commented on May 27, 2024

Ahhhh okay understood thanks for the clarification.

from d3-annotation.

susielu avatar susielu commented on May 27, 2024

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.

lorenzopub avatar lorenzopub commented on May 27, 2024

hi susie,

i just tested and everything is fine & simplify my life ;-)

thanks

from d3-annotation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.