How do i make a when variable watcher is clicked/mouse down

Ok so i wanna make a block called: "wait until variable watcher [ v] is clicked"
the block how it works:

[wait until <[ v] is clicked/mouse down ?>]

Its simple, or it could just even do wait until <[ v] is clicked/mouse down ?> block too
Its like an button, you click in the variable watcher and it does something, is there way how?

you would either have to use javascript, or just create your own variable watchers.

yeah but whats the javascript code

I am working on that @danidanijr

edit; hm that's hard

You can try putting a black shape over the watcher


And then set it to nearly 100% invisible


yeah but i wanna a javascript version

okay so @bh how do i do that

I was going to make the same suggestion @cymplecy made: cover the watcher with an almost-transparent sprite. Why does it have to be in JS? <rant>Why do kids think it's more grown-up to write JS code than to write Snap! code?</rant>

well uh theres also a way to put the transparent sprite but
theres actually no way in how to do in another way?

the problem with that is when you change the value in the variable watcher to something that changes the size of the watcher, there's (almost) no way to change the size of the sprite to match the size of the variable watcher.

yeah, true

oh, yeah, and I'm actually working on making custom variable watchers

oh , can i see?

right now it's kind of laggy, and it looks bad in different sizes. It also can't display lists (that would take a lot longer to make). I have not added in the displaying first-class data (like sprites and grey rings). It's not good to share it now.

@bh okay so when the variable watcher changes size
thats the problem

Well unless your layout is very tight or your watcher sizes change by a large amount then I don't think it'd be a noticeable issue

Can you post a link (or a screenshot) of your project?

What's in the watcher? Is it a list? There's a maximum size to automatically generated watchers, although you can manually drag out the corner to resize it.

oh a text
its like a button, you click on it and yeah you know how it is

Well then just make the covering sprite the maximum width.

Alternatively, if the whole point of the watcher is to be a button, don't use a watcher at all. Use a sprite, and make costumes for it with all the possible texts. There's a "Text costumes" library you can use.

.-. ok i wish there could be a when variable is clicked block