iamsjy17 / Plotta.js

Javascript Functional Graph Library
MIT License
23 stars 5 forks source link

Zoom In/Zoom Out, Data table don't work #6

Open ashemetov opened 4 years ago

ashemetov commented 4 years ago

Really nice library with a great potential and the only one that do not use 'eval' so do not get blocked by CSP. However Zoom In/Zoom Out, Data table don't work in the popup created by browser extension (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserAction). I debugged a code a little bit, issue is that in the condition:

if (!_this.viewModel || !_this.viewModel.IsInGraph(mousePos)) return;

IsInGraph always return 'false' because 'mousePos' is always 'Object { x: 0, y: 0 }'.

Got zoom working by returning true, but obviously this is not a solution.

Any chance to add support for browser extensions?

iamsjy17 commented 4 years ago

thank you for your consderation in this matter.

I haven't considered browser extention yet. I will register it as an issue and test it.

girasole123 commented 1 year ago

Hi, I had the same problem with Firefox (both e.offsetX and e.offsetY are always 0). I've found a workaround in this answer to a question. It consists of replacing e.offsetX and e.offsetY by e.layerX and e.layerY in the mousePos object if the browser is Firefox.

var mousePos = navigator.userAgent.search("Firefox") < 0 ? { x: e.offsetX, y: e.offsetY } : {x: e.layerX, y: e.layerY};