If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
[Ruby] Circular Mouse Checks
11 posts
• Page 1 of 2 • 1, 2
[Ruby] Circular Mouse Checks
Nowadays GUIs have more and more circular objects, be it knobs or buttons. If you have more than one object in your view and want to detect mouse clicks on them, you have to create a method for it.
You can get away with a rectangular check, which is setting up the boundaries of a virtual rectangle around the object and then testing if the mouse position is inside that virtual rectangle.
But you can also check circular. If you draw a circle it has a center point and a radius. The trick is to test if the mouse position is inside the radius.
The schematic will show you how to do a circular check and why it is an advantage when dealing with circular objects.
You can get away with a rectangular check, which is setting up the boundaries of a virtual rectangle around the object and then testing if the mouse position is inside that virtual rectangle.
But you can also check circular. If you draw a circle it has a center point and a radius. The trick is to test if the mouse position is inside the radius.
The schematic will show you how to do a circular check and why it is an advantage when dealing with circular objects.
- Attachments
-
- check_circular.fsm
- (1.04 KiB) Downloaded 1305 times
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: [Ruby] Circular Mouse Checks
Hi T,
Man , that works really well. Cool.
Man , that works really well. Cool.
- RJHollins
- Posts: 1571
- Joined: Thu Mar 08, 2012 7:58 pm
Re: [Ruby] Circular Mouse Checks
thats very useful, if you would like to play this with any shape you like, there exists a comfortable methode,
the isVisible methode for graphicpaths (userguide p.162)
with this methode you can check if a point is inside a graphicpath, here is a small example based on the one you posted
greez
the isVisible methode for graphicpaths (userguide p.162)
with this methode you can check if a point is inside a graphicpath, here is a small example based on the one you posted
greez
- Attachments
-
- check_shape.fsm
- (707 Bytes) Downloaded 1350 times
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: [Ruby] Circular Mouse Checks
Yes, I know about this method, and it is nice to have. The thing is, polygon checks are much more cpu-intensive. If this is not a concern, then, this goes to everyone reading here, make use of it. If it is a concern, rectangular and circular checks are cheaper on cpu.
@RJHollins, thank you
@RJHollins, thank you
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: [Ruby] Circular Mouse Checks
Good stuff Guys.
Always appreciate the 'education' too !
Always appreciate the 'education' too !
- RJHollins
- Posts: 1571
- Joined: Thu Mar 08, 2012 7:58 pm
Re: [Ruby] Circular Mouse Checks
tulamide wrote:Yes, I know about this method, and it is nice to have. The thing is, polygon checks are much more cpu-intensive. If this is not a concern, then, this goes to everyone reading here, make use of it. If it is a concern, rectangular and circular checks are cheaper on cpu.
@RJHollins, thank you
thanks for this info, good to know!
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: [Ruby] Circular Mouse Checks
Perfect 4 my Endless knob with it's center button...
Keep on doing!
cheers,
Walter
Keep on doing!
cheers,
Walter
-
Walter Sommerfeld - Posts: 249
- Joined: Wed Jul 14, 2010 6:00 pm
- Location: HH - Made in Germany
Re: [Ruby] Circular Mouse Checks
Walter Sommerfeld wrote:Perfect 4 my Endless knob with it's center button...
Keep on doing!
cheers,
Walter
Hmmm Are you saying a way to control dual concentric rings ?? Like an API 5500 eq.
that would be so useful.
- RJHollins
- Posts: 1571
- Joined: Thu Mar 08, 2012 7:58 pm
Re: [Ruby] Circular Mouse Checks
RJHollins wrote:..control dual concentric rings ??..
for this you can use the widen methode on an arc path when you are using a pen to draw a path and you will need only the area from the pen line...
here is a very basic schematic to do this, but also tulamides methode would work, its without any eventhandling or presetmanagement, but this shouldn't be to hard..
- Attachments
-
- double_knob.fsm
- (1.04 KiB) Downloaded 1283 times
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
11 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 15 guests