thipperudra
04-14-2004, 05:46 AM
Hi Antun,
<canvas debug="true">
<class name="topleftresizestate" extends="state" >
<attribute name="xroffset" value="$once{this.getMouse('x')}" />
<attribute name="initx" value="$once{this.x}" />
<attribute name="initwidth" value="$once{this.width}" />
<attribute name="width"
value="${this.initwidth+this.initx
-this.immediateParent.getMouse('x')+xroffset}" />
<attribute name="x"
value="${this.immediateParent.getMouse('x')
-this.xroffset}" />
<attribute name="yroffset" value="$once{this.getMouse('y')}" />
<attribute name="inity" value="$once{this.y}" />
<attribute name="initheight" value="$once{this.height}" />
<attribute name="height"
value="${this.initheight+this.inity
-this.immediateParent.getMouse('y')+yroffset}" />
<attribute name="y"
value="${this.immediateParent.getMouse('y')
-this.yroffset}" />
</class>
<class name="rotbox" extends="view"
width="100" height="100">
</class>
<rotbox />
<view>
<rotbox id="v1" bgcolor="yellow" x="120" y="120"
yoffset="${this.height /2}"
xoffset="${this.width / 2}" clickable="true" onmousedown="draggable.apply();" onmouseup="draggable.remove();" >
<attribute name="f1" value="20" type="number"/>
<attribute name="f2" value="-20" type="number"/>
<resizestate name="rs"/>
<topleftresizestate name="trrs"/>
<dragstate name="draggable"/>
<view name="crb" align="right" valign="bottom"
width="7" height="7" bgcolor="blue"
onmousedown="parent.rs.apply();"
onmouseup="parent.rs.remove()" />
<view name="crb2" align="left" valign="top"
width="7" height="7" bgcolor="red"
onmousedown="parent.trrs.apply();"
onmouseup="parent.trrs.remove()" />
</rotbox>
</view>
<button text="clockwise" y="160" >
<method event="onclick">
v1.animate('rotation',v1.f1++,1000,true);
Debug.write("clockwise"+v1.f1);
</method>
</button>
<button text="anticlockwise" x="150" y="160">
<method event="onclick">
v1.animate('rotation',-v1.f1,1000,true);
Debug.write("anticlockwise"+v1.f1);
</method>
</button>
</canvas>
I have problems on above code:
1.If i mousedown or click on the yellow view it moves upward.
2.It is rotating fine both clcokwise and anticlockwise,but when i want to resize the rotated yellow view by using red and blue square boxes it won't resize correctly.
Could you tell me how to rectify all these problems.
Thanks in adavance
Rudresh
<canvas debug="true">
<class name="topleftresizestate" extends="state" >
<attribute name="xroffset" value="$once{this.getMouse('x')}" />
<attribute name="initx" value="$once{this.x}" />
<attribute name="initwidth" value="$once{this.width}" />
<attribute name="width"
value="${this.initwidth+this.initx
-this.immediateParent.getMouse('x')+xroffset}" />
<attribute name="x"
value="${this.immediateParent.getMouse('x')
-this.xroffset}" />
<attribute name="yroffset" value="$once{this.getMouse('y')}" />
<attribute name="inity" value="$once{this.y}" />
<attribute name="initheight" value="$once{this.height}" />
<attribute name="height"
value="${this.initheight+this.inity
-this.immediateParent.getMouse('y')+yroffset}" />
<attribute name="y"
value="${this.immediateParent.getMouse('y')
-this.yroffset}" />
</class>
<class name="rotbox" extends="view"
width="100" height="100">
</class>
<rotbox />
<view>
<rotbox id="v1" bgcolor="yellow" x="120" y="120"
yoffset="${this.height /2}"
xoffset="${this.width / 2}" clickable="true" onmousedown="draggable.apply();" onmouseup="draggable.remove();" >
<attribute name="f1" value="20" type="number"/>
<attribute name="f2" value="-20" type="number"/>
<resizestate name="rs"/>
<topleftresizestate name="trrs"/>
<dragstate name="draggable"/>
<view name="crb" align="right" valign="bottom"
width="7" height="7" bgcolor="blue"
onmousedown="parent.rs.apply();"
onmouseup="parent.rs.remove()" />
<view name="crb2" align="left" valign="top"
width="7" height="7" bgcolor="red"
onmousedown="parent.trrs.apply();"
onmouseup="parent.trrs.remove()" />
</rotbox>
</view>
<button text="clockwise" y="160" >
<method event="onclick">
v1.animate('rotation',v1.f1++,1000,true);
Debug.write("clockwise"+v1.f1);
</method>
</button>
<button text="anticlockwise" x="150" y="160">
<method event="onclick">
v1.animate('rotation',-v1.f1,1000,true);
Debug.write("anticlockwise"+v1.f1);
</method>
</button>
</canvas>
I have problems on above code:
1.If i mousedown or click on the yellow view it moves upward.
2.It is rotating fine both clcokwise and anticlockwise,but when i want to resize the rotated yellow view by using red and blue square boxes it won't resize correctly.
Could you tell me how to rectify all these problems.
Thanks in adavance
Rudresh