Rectangle Problem
David Burgun
dburgun at dsl.pipex.com
Wed Apr 6 03:52:03 EDT 2005
Hi,
I've looked at trying to use the Rectangle tool to do this but it
doesn't do exactly what I want. I suppose it might be to describe
what I am trying to do in more detail:
I have some hard copy (A0, A1 paper size) plans of buildings and am
using an accurate Crosshair mouse or Tablet in order to take
measurements from the plan. Each plan shows the scale factor (which
can be 10:1, 20:1, 50:1, 100:1 200:1 etc.). So the user enters the
scale factor, then uses the mouse to mark corners of door and window
openings. Since the DPI of the Mouse is known, it is possible to get
accurate (enough) measurements.
This is physically performed by clicking in the defined area (just a
pre-defined rectangle called "BoundingRect", the Script for doing
this is attached to this object) and then lining up the top/left
corner of the opening on the drawing with the mouse. The user then
clicks to define the Top/Left corner and then drags the mouse to
define Bottom/Right corner. An interactive rectangle is then
displayed using the "mouseStillDown" handler. Once the user does a
mouseUp, the rectangle is made permanent. While the drawing operation
is in progress the size in pixels and mm is being displayed in fields
at the top of the screen.
This works fine.
I now what to be able to:
1. Select the rectangles and move them about inside "BoundingRect"
I have this working, when I create the Rectangle Graphic, I just copy
a template rectangle that I have previously created using the RunRev
IDE. This Template Object contains scripts to handle the moving of
the Rectangle. This works quite well an it's neat that the Script
from the template can be duped and used so easilly (I have made it so
the script does not reference any "hard" names so it works
regardsless of the object being used, which is cool!).
2. Resize a rectangle using a method similar to the way in which the
IDE works (e.g. via the 8 resize boxes).
I am not sure how to do this? Do I create 8 more rectangle objects
and somehow "pin" them to the corners and middles of the bounding box
of the Rectangle? If not how to I draw and react to the 8 boxes?
3. Sometime in the future I will need to handle a different type of
object. It will have a rectanglular bounding box, but there could be
a lot of seperate openings within the bounds of the rectangle. e.g,
There could be a tic-tac-toe style (3x3) pattern. Any ideas on how to
implement that would be greatly appreciated too!
Thanks for your help, I am really pleased with what I have so far, I
do have one specific programming question too:
Given I have a "BoundingRect" and "UserRect", how can I check that
"UserRect" is inside "BoundingRect"? If it overlaps I want to either
clip the rectangle or stop it from moving outside of the BoundingRect
in the first place.
All the Best
Dave
>Look up the tool, style and templateGraphic properties and the
>newGraphic message in the docs.
>
>As for the style property, you are primarily interested in how it
>applies to graphic objects (you can skip a lot of material which
>applies to other types of objects).
>
>On Apr 5, 2005, at 5:05 PM, David Burgun wrote:
>
>>>On 4/5/05 12:51 PM, "David Burgun" <dburgun at dsl.pipex.com> wrote:
>>>Dave, is there any reason you're not using the built in functionality of Rev
>>
>>On big reason, I don't know how to do it?
>>
>>>- i.e. to set the tool to the rectangle tool and then after they finish
>>>drawing to switch to the pointer tool?
>>
>>Not sure what you mean? Exactly what code do I use and which
>>handler do I use? Oh and which object should I attach the script to?
More information about the use-livecode
mailing list