Onmouseup not working on Snap

This dude @dardoro was trying out my Smap! module

He said it keeps right clicking when he stops right clicking.
This is a problem on his side, not mine.
Anyone including @bh please come help
(I use oncontextmenu and onmouseup to detect right-click)

i don't think this would belong with the help with snap category because this is javascript

anyway the glitch is also occuring on my computer, so it's probably your code. and that is probably because oncontextmenu fires when the right mouse button is released. so instead you should probably instead use window.addEventListener("mousedown", function) or window.onmousedown, the event argument passed into function would contain information about which mouse button was pressed. and also make sure in the mouseup released function check if it was the right mouse button that was released, i'm pretty sure on a mouse you can hold down left and right click

and make sure it only runs that code once in the project, you don't want a hundred event listeners when the user clicks one hundred times. you can do this by storing a variable in the global scope that describes if the event listener was made and then using an if statement with that variable

This is built for snap module not javascript module... -_-

you are asking for javascript help

but this is FOR snap

yes but the block is programmed primarily in javascript and you are asking about javascript onmouseup

how do i get a eventlistener for right click then

there are a lot of information about javascript online


MINDBOGGLING I NEED EXTRA HELP
Can you help

on what?

I cant take all this info I need help

function onrightclick(event) {
  if (event.button === 2) {
    console.log("Right click");
  }
}

window.addEventListener("mousedown", onrightclick);
//or
window.onmousedown = onrightclick;

then for mouseup it's the same thing

idk...
you do it and I'll give you credit...
@bh This is NOT an offsite meeting
just send me the xml file through drive

Yes, exactly...
Smap! script pic (4)

does that work on your side?

does it not work on yours?

he can just copy the contents of the xml file and paste them into a post, then you can copy all of them, then paste them into a new text file, and call it something like "block.xml"

I haven't tried it...

well whats stopping you from trying it yourself? its only like 6 lines of code

Im too lazy UvU