Constrain Graphic dimensions
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Constrain Graphic dimensions
I should like to set up a series of graphics that can be resized by end-users but in a constrained way.
-
Re: Constrain Graphic dimensions
Should be a simple maths trick.
How do you want them to be constrained? Do you want the rhombus to resize relative to the text, the text relative to the rhombus, or do you want the rhombus to change shape (be wider) so the text fits in the rhombus?
Xero
How do you want them to be constrained? Do you want the rhombus to resize relative to the text, the text relative to the rhombus, or do you want the rhombus to change shape (be wider) so the text fits in the rhombus?
Xero
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Constrain Graphic dimensions
It probably is a simple maths trick . . .
pseudocode:
on resize
do some mathematics
make sure everything is proportional
end resize
But I was only on my first cup of coffee this morning.
Probably sort out the whole thing in about 3 hours time after my afternoon online teaching.
pseudocode:
on resize
do some mathematics
make sure everything is proportional
end resize
But I was only on my first cup of coffee this morning.
Probably sort out the whole thing in about 3 hours time after my afternoon online teaching.
Re: Constrain Graphic dimensions
on mousedown
Get current size
end mousedown
on resize
Get new size of one thing
Put (new size)/(old size) into scalefactor
Set the new size of the other thing to oldsize * scalefactor
end resize
Just depends on what you want to do with the resizing (i.e. whether you want the text size to dictate the rhombus size)
There is a stack somewhere on the forum about proportional resizing of windows, and that would suffice. I have it in an app that I am working on and can copy and paste if needed.
X
Get current size
end mousedown
on resize
Get new size of one thing
Put (new size)/(old size) into scalefactor
Set the new size of the other thing to oldsize * scalefactor
end resize
Just depends on what you want to do with the resizing (i.e. whether you want the text size to dictate the rhombus size)
There is a stack somewhere on the forum about proportional resizing of windows, and that would suffice. I have it in an app that I am working on and can copy and paste if needed.
X