PDA

View Full Version : problem in resizing multiple images


mallesh
01-13-2004, 06:11 AM
Hi Antun,

I want to resize the images (which i have uploaded on to the product).But resizing the images by draging on the small view at the left corner of the image is not functioning properly.Here is the code i used

<class name="clipartView">


<view name="v" width="90" height="90" datapath="clipdataset:/" >
<clipItem datapath="ClipArtImg" stretches="both" width="90" height="90" clickable="true" onmouseup="this.xdragger.remove(); this.ydragger.remove();" >
<method event="oninit">
this.initwidth = this.width;
this.initheight = this.height;
</method>
<method event="onmousedown">
var ydoffset = Math.round( this.getMouse('y') * this.yScale );
var xdoffset = Math.round( this.getMouse('x') * this.xScale );
this.setAttribute('ydoffset', ydoffset);
this.setAttribute('xdoffset', xdoffset);
this.xdragger.apply();
this.ydragger.apply();
//brbb.setVisible(true);

</method>
<horizDrag name="xdragger" xdmin="$once{40-this.width}" xdmax="110" />
<verticalDrag name="ydragger" ydmin="$once{10-this.height}" ydmax="220" />

<resizestate name="rs"/>
<view bgcolor="green" width="5" height="5" align="right" valign="bottom"
onmousedown="parent.rs.apply()" onmouseup="parent.rs.remove()"/>


</clipItem>


</view>

</class>

<class name="clipItem" >

<clipartimage stretches="both" width="90" height="90" datapath="ClipArt/text()" >

</clipartimage>

Actually i am using the http dataset for getting the images.

Thanks
Mallesh.

antun
01-13-2004, 09:31 AM
I tried to run the code you posted, but it didn't work. Perhaps not all of it was copied?

Also, have you checked out this thread about resizing:

http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=528&highlight=resiz%2A

-Antun

mallesh
01-14-2004, 05:34 AM
Hi Antun,

Here i am sending the complete source code.Actually i am using the jsp for getting the images from the database but here i am sending the xml file for simplification.I can't drag the images untill unless clicked on the one of the red spot on the images.
And also bottom red view is not placing properly on the right bottom corner of the images.

So how do i rectify those problems?

Thanks
Mallesh.

antun
01-14-2004, 09:30 AM
You really should take a look at the link I sent in my last post. It contains a working example that fixes both of the problems that you are asking about.

The problem in the code you posted is that the stretches attribute is not on the view with the resource. stretches="both" is used to stretch a resource to its view's dimensions. If you use it on a view with sibling views, you get unexpected results.

A solution would be to:

[list=a]
Give the view with the resource (i.e. the view you call setSource() on) a stretches="both" attribute.
Don't give it any children.
Make it a child of the view that gets resized.
Constrain it to the view that does get resized.
[/list=a]

-Antun