flok icon indicating copy to clipboard operation
flok copied to clipboard

p5js/hydra mouse and key events do not work in the editor

Open taconi opened this issue 1 year ago • 2 comments

I had this problem when working on #318. The mouse/keyboard events weren't being triggered.

The events are only sent when I'm outside the editor, but the only parts of the site outside the editor are, a small space at the top of the page between the button to change the target and the settings button and some parts of the edge of the site

Peek 04-01-2025 22-19

p5 = new P5()

p5.draw = () => {
  p5.fill(p5.mouseX/5, p5.mouseY/5, 255, 100)
  p5.rect(p5.mouseX, p5.mouseY, 30, 150)
}

s0.init({src: p5.canvas})

src(s0).out()

Peek 04-01-2025 22-28

shape()
  .scrollX(() => mouse.y / 1080, 0)
  .rotate(() => mouse.x / 1920, 0)
  .out()

taconi avatar Jan 05 '25 01:01 taconi

I've seen that events work with the editor hidden. That makes sense.

As the editor can be hidden with ctrl-shift-h, perhaps this is not a bug, but a desired behavior, when the editor is active the main function should be to edit.

I think documenting this behavior is enough

taconi avatar Jan 20 '25 17:01 taconi

Hi! I don't think it was a desired behavior, in fact, I'm quite surprised it's behaving like that, AFAIK there's nothing telling it to explicitly allow or disallow pointer events when hiding the editor, it only changes the opacity of the div 🤔

munshkr avatar Jan 26 '25 12:01 munshkr