Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error multitouch emit undefined inside move function #83

Closed
jjjkolkh opened this issue Mar 10, 2021 · 8 comments · Fixed by #84
Closed

Error multitouch emit undefined inside move function #83

jjjkolkh opened this issue Mar 10, 2021 · 8 comments · Fixed by #84

Comments

@jjjkolkh
Copy link

When using a device with multitouch I get an error when outside the chart something is pressed first and held down and afterwards pressing inside the chart.
The error is as following:
TypeError: Cannot read property 'brush' of undefined
TypeError: emitter(...).moved is not a function
TypeError: emitter(...).ended is not a function

Tracing the issue in the D3 bundle I found out that the move function is called before the emit variable is set:
image

Online debug information:
ContextListener is called first with a TouchStart event
image

Then inside the started function the move function will be called
image

Inside move function the emit variable is undefined, hence throwing the error
image

@jjjkolkh jjjkolkh changed the title Error multitouch when first holding outside chart and then pressing inside chart Error multitouch emit undefined inside move function Mar 10, 2021
@Fil
Copy link
Member

Fil commented Mar 10, 2021

thanks. can you share a (minimal) code to reproduce?

@jjjkolkh
Copy link
Author

See the following file:
D3issue.zip

In here I replicate how the XYChart is being handled in my application.

@Fil
Copy link
Member

Fil commented Mar 12, 2021

Can you please confirm that #84 would resolve this issue?

@jjjkolkh
Copy link
Author

Sure, thanks!
I need the touch panel to test it for sure though, so I'll do it on Monday morning as it's in the office.

@jjjkolkh
Copy link
Author

Hi Fil,
I can verify that on my system the error is now gone!
It's also behaving as expected.

@Fil
Copy link
Member

Fil commented Mar 15, 2021

Excellent! Thank you for the feedback.

mbostock pushed a commit that referenced this issue Jun 9, 2021
mbostock added a commit that referenced this issue Jun 10, 2021
* create emit before we use it; make move accept an event.

This seems to:
- fix #83
- possibly fix d3/d3-zoom#198
- help with d3/d3-zoom#222

* update dependencies

* brush.clear event

Co-authored-by: Mike Bostock <[email protected]>
@dvdwndrdl
Copy link

Hi, we are still having issues with this problem. Please see the stack trace below. We are using both packages d3 and d3-brush (as a dependency of d3) in the latest versions, i.e. 7.6.1 and 3.0.0, respectively. Please note that the error occurs only if using a touchscreen (e.g. by using the Google Chrome User Agent). Do you have any ideas or suggestions for us? Thanks in advance!

ERROR TypeError: emitter(...).ended is not a function
    at SVGGElement.touchended (brush.js:585:30)
    at SVGGElement.<anonymous> (on.js:3:14)
    at _ZoneDelegate.invokeTask (zone.js:443:35)
    at Object.onInvokeTask (core.mjs:26218:33)
    at _ZoneDelegate.invokeTask (zone.js:442:64)
    at Zone.runTask (zone.js:214:51)
    at ZoneTask.invokeTask [as invoke] (zone.js:525:38)
    at invokeTask (zone.js:1727:22)
    at globalCallback (zone.js:1758:31)
    at SVGGElement.globalZoneAwareCallback (zone.js:1794:20)

@Fil
Copy link
Member

Fil commented Nov 22, 2022

Please share a webpage or an observable notebook that exhibits the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants