PDA

View Full Version : Dragging Issue Help Me


malay
03-13-2008, 09:41 PM
Hi,

How can i dragg a view diagonally(only diagonally)?

aimeeq
03-14-2008, 12:11 AM
Hi,

How can i dragg a view diagonally(only diagonally)?


Hello malay,

You can see this link:http://labs.openlaszlo.org/trunk-nightly/docs/developers/input-devices.html.

A simple example here:
<canvas>
<view name="test" bgcolor="0xdddddd" width="30" height="30" onmousedown="dragger.apply()" onmouseup="dragger.remove()">
<dragstate name="dragger"></dragstate>
</view>
</canvas>


Aimee

malay
03-14-2008, 08:30 PM
Dear aimeeq,

I know how to drag a view but my problem is that dragging a view diagonally only, not vertically or horizontally.

aimeeq
03-16-2008, 07:10 PM
Hi Malay,

Sorry for my misunderstanding your question. I hope below code can help you.
Actually, I only override the 'x' attribute and change its value to equal with 'y' attribute.


<canvas debug="true">
<view name="test" bgcolor="0xdddddd" width="30" height="30"
onmousedown="dragger.apply()" onmouseup="dragger.remove()">
<dragstate name="dragger" >
<attribute name="x"
value="(this.drag_axis == 'both' || this.drag_axis == 'x') ?
__dragstate_getnewpos('y',
this.immediateparent.getMouse( 'y' ) + this.__dragstate_ydoffset)
: this.y"
when="always"/>
</dragstate>
</view>
</canvas>