P5.js: Dom Drop event does not receive drop Event

Created on 11 Mar 2019  Â·  2Comments  Â·  Source: processing/p5.js

Nature of issue?

  • [X] Found a bug
  • [ ] Existing feature enhancement
  • [ ] New feature request

Most appropriate sub-area of p5.js?

  • [ ] Color
  • [ ] Core/Environment/Rendering
  • [ ] Data
  • [ ] Events
  • [ ] Image
  • [ ] IO
  • [ ] Math
  • [ ] Typography
  • [ ] Utilities
  • [ ] WebGL
  • [X] Dom

Which platform were you using when you encountered this?

  • [ ] Mobile/Tablet (touch devices)
  • [X] Desktop/Laptop
  • [ ] Others (specify if possible)

Details about the bug:

  • p5.js version: v0.7.3 January 20, 2019
  • p5.dom.js version: v0.4.0
  • Web browser and version: Chrome 72.0.3626.121
  • Operating System: MacOSX 10.14.3 (18D109)
  • Steps to reproduce this:
    In this version ( v0.7.3/v0.4.0) using element.drop(fileCallback, eventCallback) the eventCallback never fires.
    I created a codepen that shows the bug: https://codepen.io/lyle/pen/aMypPY
    This bug does not emerge when using p5.js v0.5.3 / p5.dom.js v0.2.12
events bug

All 2 comments

It looks like this bug was introduced with PR #3303 - the newer p5.Element._attachListener method ensure's there can not be two event types attached at the same time. Considering .drop has two call backs passed in that bind to the same event, we could probably just wrap those two together into one closure that has two callbacks fired.
I am working on . test for the drop method that covers this case.

Thanks @lyle! That implementation sounds reasonable to me! ✨

Was this page helpful?
0 / 5 - 0 ratings