margins for within function ?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

margins for within function ?

Post by jmburnod » Wed Jun 17, 2009 10:15 pm

Hi All,

Is there a default margin for the function within ?


I watch it when using this function. The screen result is diifferent (4 pixels)

Code: Select all

function fRectInside pGrc1,pGrc2
   put within(grc pGrc1,the topleft of grc pGrc2) into DTL
   put within(grc pGrc1,the topRight of grc pGrc2) into DTR
   put within(grc pGrc1,the bottomRight of grc pGrc2) into DBR
   put within(grc pGrc1,the bottomLeft of grc pGrc2) into DBL
   put DTL&","&DTR&","&DBR&","&DBL into rRectInside
   return rRectInside
end fRectInside
Thank for your help

Jean-Marc

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Wed Jun 17, 2009 10:59 pm

Hi Jean-Marc,

First of all, the within function works fine here. There is no weird margin. Second, you might want to readabout the intersect function in the docs.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Margin for within function ?

Post by jmburnod » Thu Jun 18, 2009 7:49 am

Hi Mark,

Yes, within work fine but with a margin of 4 pixels. Can i send you an snapshot of it ?

Intersect work fine also but i need to know if the topleft,topright,botright and botleft are within an other object. Intersect return true if a part of object is within.

All the best

Jean-Marc

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Margin for within function ?

Post by jmburnod » Sat Jun 20, 2009 10:38 am

Hi Mark,

You can watch on this picture:

within(grc 1,the topleft of grc 2) return true

[img]
http://alternatic.ch/jmb/devrev/marginrectInside.png
[/img]

Regards

Jean-Marc

Post Reply