could be better if area have right bottom corner positon, then width and height set to auto. its like div margin
this situation is more common
for example
area.left
area.top
area.right
area.bottom
area.width=auto - default
area.height=auto - default
if area.width or height is custom then right and bottom = auto (i have no idea about align)
area sizes and position
-
-
Hi,
thanks, good idea!
I think in this case a new area "mode" would be good,
e.g.
area.mode="border"
area.left="..."
area.top="..."
area.right="..."
area.bottom="..."and let width/height alway be automatic in this mode,
I will add that to the next releasebest regards,
Klaus -
That's great!
Thanks!
-
HE Klaus,
that's what i mean with the area margins..
Tuur
-
this would be possible with an action.
Code<events onresize="setMargin(10,10,10,10);" /> <!-- setMargin(leftmargin,topmargin,bottommargin,rightmargin); --> <action name="setMargin"> <-- calculate remaining width. stagewidth - marginleft - marginright = area width --> sub(tmp1, stagewidth, %1); sub(tmp2, tmp1, %4); set(area.width, tmp2); <!-- calculate remaining height. stageheight - margintop - marginbottom = area height --> sub(tmp3, stageheight, %2); sub(tmp4, tmp3, %3); set(area.height, tmp4); <!--move the area--> set(area.x, %1); set(area.y, %2); </action>
the other away around would be possible to. Defining a fixed area size and the posistion it in the center no mather what resolution.
Code
Display More<events onresize="define_area_size(1008,571);" /> <action name="define_area_size"> div(halfstagewidth, stagewidth, 2); div(halfareawidth, %1, 2); sub(dest_area_x, halfstagewidth, halfareawidth); copy(area.x, dest_area_x); div(halfstageheight, stageheight, 2); div(halfareaheight, %2, 2); sub(dest_area_y, halfstageheight, halfareaheight); copy(area.y, dest_area_y); set(area.width, %1); set(area.height, %2); </action>
sorry if there's some faults in the code. it's late ;p
-
Hi Zephir ,
Quotesorry if there's some faults in the code. it's late ;p
You are right... it is late ...
set(area.width, tmp2); returns temp2
set(area.height, tmp4); returns temp4
Should be:
set(area.width, get(temp2)); or copy(area.width, tmp2);Here the first code corrected:
Code<events onresize="setMargin(10,10,10,10);" /> <!-- setMargin(leftmargin,topmargin,bottommargin,rightmargin); --> <action name="setMargin"> <!-- calculate remaining width. stagewidth - marginleft - marginright = area width --> sub(tmp1, stagewidth, %1); sub(tmp2, tmp1, %4); copy(area.width, tmp2); <!-- calculate remaining height. stageheight - margintop - marginbottom = area height --> sub(tmp3, stageheight, %2); sub(tmp4, tmp3, %3); copy(area.height, tmp4); <!--move the area--> set(area.x, %1); set(area.y, %2); </action>
Anyway, that's great... thanks to share ...
SAlut.
-
MASTERS!!!
Tuur
-
Hi all ^^
That's great !!
Would it be possible to add a fixed aspect ratio to this code part ? :Code<events onresize="setMargin(10,10,10,10);" /> <!-- setMargin(leftmargin,topmargin,bottommargin,rightmargin); --> <action name="setMargin"> <!-- calculate remaining width. stagewidth - marginleft - marginright = area width --> sub(tmp1, stagewidth, %1); sub(tmp2, tmp1, %4); copy(area.width, tmp2); <!-- calculate remaining height. stageheight - margintop - marginbottom = area height --> sub(tmp3, stageheight, %2); sub(tmp4, tmp3, %3); copy(area.height, tmp4); <!--move the area--> set(area.x, %1); set(area.y, %2); </action>
Thanks in advance ^^
Best regards. -
It could be done, but you wouldnt have a fixed margin then. You would have maybe 100px black left and right, or 70px top and bottom, depending which resolution it would fit best.
let me think about it, my head is bit cloudy atm :P
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!