antun
04-08-2003, 09:30 AM
If you've ever tried to align views visually, it can be frustrating guessing the coordinates, especially when there are transparent areas in the art assets (as in the coffee cup and ring images attached). Here's a niftier way:
<canvas debug="true">
<view x="75" y="30" resource="one_ring.png" />
<view resource="kaffe.png"
onmousedown="myDragger.apply()"
onmouseup="myDragger.remove();
debug.write( this.x + ', ' + this.y )">
<dragstate name="myDragger" />
</view>
</canvas>
It uses <dragstate> to let you position the cup, then writes out the coordinates when you let go.
Enjoy!
Thanks to Iconfactory (http://www.iconfactory.com/) for the images.
<canvas debug="true">
<view x="75" y="30" resource="one_ring.png" />
<view resource="kaffe.png"
onmousedown="myDragger.apply()"
onmouseup="myDragger.remove();
debug.write( this.x + ', ' + this.y )">
<dragstate name="myDragger" />
</view>
</canvas>
It uses <dragstate> to let you position the cup, then writes out the coordinates when you let go.
Enjoy!
Thanks to Iconfactory (http://www.iconfactory.com/) for the images.