Rank: Advanced Member
Groups: Approved
Joined: 10/26/2020(UTC) Posts: 50 Location: Darmstadt Thanks: 15 times Was thanked: 2 time(s) in 2 post(s)
|
Hi,
I yesterday discovered this great successor to the old StrokesPlus and am amazed about its endless possibilities!
While learning the ropes, several questions arise on specific details. This is the first one:
I´m trying to develop a small script, activated by a hotkey, to restrict mouse movement to either horizontal or vertical line (that is, rectangle would be a 1px dimension). But I found information that it must have at least 50px - what is the reason for that and how can I circumvent it?
Thanks in advance, Rob Otter
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 post(s)
|
|
1 user thanked Rob for this useful post.
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 10/26/2020(UTC) Posts: 50 Location: Darmstadt Thanks: 15 times Was thanked: 2 time(s) in 2 post(s)
|
Many thanks for your superfast solution! Awesome! Works like a charm now.
|
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 10/26/2020(UTC) Posts: 50 Location: Darmstadt Thanks: 15 times Was thanked: 2 time(s) in 2 post(s)
|
Hi Rob, maybe it´s my mistake: I found that the minimum of 1px still let the mouse move 1px off the line - would it still work if limit is 0px? Currently, the least restriction is Quote: var mp = sp.GetCurrentMousePoint(); var rect = new Rectangle(uRect.X, mp.Y, uRect.Width, 1); where it would be better to have Quote: var mp = sp.GetCurrentMousePoint(); var rect = new Rectangle(uRect.X, mp.Y, uRect.Width, 0);
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 post(s)
|
Rectangles are weird like that...I'm stepping out to go to a doctor appointment, but I just changed to 0 and re-uploaded (same link as above).
Let me know if that works.
|
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 10/26/2020(UTC) Posts: 50 Location: Darmstadt Thanks: 15 times Was thanked: 2 time(s) in 2 post(s)
|
Well, it works fine for not moving off the line now, but if height is 0, the pointer jumps directly to the X coordinate instead of keeping its current position. Same of course for vertical movement restriction :-)
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 post(s)
|
There's a check in the MouseRestrictToRectangle method which checks to see if confining rectangle contains the current mouse point - to make sure the mouse starts inside the rectangle.
However, a 0 height/width rectangle has no area, so that call always returns false since the point cannot be inside a void.
I've updated the 0.3.9.7 download again to also check to see if the cursor is along the boundary and leave the location alone if so.
|
1 user thanked Rob for this useful post.
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 10/26/2020(UTC) Posts: 50 Location: Darmstadt Thanks: 15 times Was thanked: 2 time(s) in 2 post(s)
|
Many thanks, it´s working now as expected. Great support!!!
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The StrokesPlus.net Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close