StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Rob Otter  
#1 Posted : Monday, October 26, 2020 5:14:19 PM(UTC)
Rob Otter

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 10/26/2020(UTC)
Posts: 50
Germany
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
Rob  
#2 Posted : Monday, October 26, 2020 6:25:54 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,359
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 419 time(s) in 356 post(s)
It was an arbitrary minimum size I put in there.

I changed it to a minimum of 1x1 here: https://www.strokesplus.net/files/StrokesPlus.net_Setup_0.3.9.7.exe
thanks 1 user thanked Rob for this useful post.
Rob Otter on 10/26/2020(UTC)
Rob Otter  
#3 Posted : Monday, October 26, 2020 9:23:51 PM(UTC)
Rob Otter

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 10/26/2020(UTC)
Posts: 50
Germany
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.
Rob Otter  
#4 Posted : Tuesday, October 27, 2020 12:01:28 PM(UTC)
Rob Otter

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 10/26/2020(UTC)
Posts: 50
Germany
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);
Rob  
#5 Posted : Tuesday, October 27, 2020 12:34:37 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,359
United States
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.
Rob Otter  
#6 Posted : Tuesday, October 27, 2020 1:37:28 PM(UTC)
Rob Otter

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 10/26/2020(UTC)
Posts: 50
Germany
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 :-)
Rob  
#7 Posted : Tuesday, October 27, 2020 6:01:37 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,359
United States
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.
thanks 1 user thanked Rob for this useful post.
Rob Otter on 10/28/2020(UTC)
Rob Otter  
#8 Posted : Wednesday, October 28, 2020 7:11:18 AM(UTC)
Rob Otter

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 10/26/2020(UTC)
Posts: 50
Germany
Location: Darmstadt

Thanks: 15 times
Was thanked: 2 time(s) in 2 post(s)
Many thanks, it´s working now as expected. Great support!!!
Users browsing this topic
Guest
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.