:Just before I posted I noticed Yincognito already answered, but I already wrote this stuff so I will publish it anyway, as I'm saying things differently and may also help you (or confuse you
).
Ok, let's continue.
Scaling with the mouse is actually a little bit trickier to understand. If you install the
Mouse Example skin that comes with
the plugin, you can see that when you move the mouse inside the skin the values on X and Y are changing. If you move left to right, then you are changing X, if you move it up and down, then you are changing Y.
This is important because this is what you are doing when you use the variables $MouseX$ and $MouseY$.
The example skin also comes with a second variant that is called dragging. If you check that one, you'll see the X and Y values change as you drag the ball.
I'm gonna use example code from my skin since I'm not sure how yours works.
In my skin I have:
LeftMouseDragAction=[!SetVariable MouseX $MouseX$][!SetVariable MouseY $MouseY$][!SetVariable backgroundW "(clamp([#MouseX]+[&dragger:W],[#MinW],[#MaxW]))"][!SetVariable backgroundH "(clamp([#MouseY]+[&dragger:H],[#MinH],[#MaxH]))"][!UpdateMeter *][!Redraw]
If we break it down, We have:
[!SetVariable MouseX $MouseX$][!SetVariable MouseY $MouseY$]
This is setting the MouseX and MouseY variables to the values of $MouseX$ and $MouseY$, so esentially it's capturing the X and Y coordinates of the pointer when I click on the dragger.
Then these new MouseX and MouseY variables will be used to Scale the skin:
[!SetVariable backgroundW "(clamp([#MouseX]+[&dragger:W],[#MinW],[#MaxW]))"][!SetVariable backgroundH "(clamp([#MouseY]+[&dragger:H],[#MinH],[#MaxH]))"]
I created a backgroundW and BackgroundH variables, these variables on my skin are literally the H and W values of the whole skin, and all the meters are relative to them, so if I change those variables, the size of every meter will change as well.
Now, I said it's trickier because you have to take into account that what you essentially want to do is to increase the value of H and W.
Let's say BackgroundH and BackgroundW = 10 again. What I want is that if I drag the mouse up or down, the H changes value, and if I do it left to right then the W.
That's this:
(clamp([#MouseX]+[&dragger:W],[#MinW],[#MaxW]))
and this
(clamp([#MouseY]+[&dragger:H],[#MinH],[#MaxH]))
Ignore the clamp and everything after the comma ' , ' for now.
What's happening here is that we are setting BackgroundH and BackgroundW to the value of MouseY and MouseX. I added the + [&Dragger:W] and [&Dragger:H] to account for the size of the dragger, to make sure that it starts at the dragger and not before or after. That is important so the mouse dragging works fine, and I also noticed that without it the mouse plugin starts buggin, trying to open inexistent files for some reason lol.
So I'm just adding the size of the dragger shape, which is an ellipse. And that's it.
So in the background what's happening is that the variable MouseX and MouseY become the value of the variables $MouseX$ and $MouseY$ and we make that the value of W and H.
The clamp function simply lets you add a min and max value so the skin is not scaling beyond a boundary I set.
Not sure if all of this makes sense to you. Your'e simply changing a variable, and then using that variable for the dimmensions of your skin. You can use those variables as you want, so you can use them to scale for example.
A way to test stuff is creating measures to really see what's going on, you can check the mouse example skin. Although it is doing it somewhat differently, but its the same process, the example skin is using SetOption instead of SetVariable.