Thanks for the information, and after reading a lot of code... I came up
with the answer... I guess I did not explain myself clearly, but here it the
code. Ugly but works... Does, anyone know of a cleaner way of doing the
below?
// Sets the Smaller' ScaleViewerContainer' =100 (Scalled Down) layer, based
on
// the 'ViewWin' = 300 larger (Original Size) Layer.
// Each time the Larger 'ViewLyr' a child of 'ViewWin' layer is resized,
moved, draged, etc.. I call this funtion.
// and change to change the size of 'ScaleViewer' a child of
ScaleViewerContainer.
// function setViewWindow does the same thing but for setting the ViewLry
v.setScaleViewer = function(lyrid){
if(this.ViewLyr[lyrid]){
this.rh =
this.ViewLyr[lyrid].getHeight()/this.ScaleViewerContainer.getHeight();
//ratio Height
this.rw =
this.ViewLyr[lyrid].getWidth()/this.ScaleViewerContainer.getWidth(); //ratio
Width
this.sw =this.ViewWin.getWidth()/this.rw;
this.sh =this.ViewWin.getHeight()/this.rh;
this.rx = (this.ViewLyr[lyrid].getX()*-1)/this.rw;
this.ry = (this.ViewLyr[lyrid].getY()*-1)/this.rh;
this.ScaleViewer.setSize(this.sw,this.sh);
this.ScaleViewer.setLocation(this.rx,this.ry);
//
//this.ScaleViewer.setHTML("<font color=white>"+this.rx+" :
"+this.ry+"<br>"+this.rh+" : "+this.rw+"</font>");
//alert(this.nw);
}
};
v.setViewWindow = function(lyrid){
if(this.ViewLyr[lyrid]){
this.rh =
this.ViewWin.getHeight()/this.ScaleViewer.getHeight(); //ratio Height
this.rw =
this.ViewWin.getWidth()/this.ScaleViewer.getWidth(); //ratio Width
this.sw =this.ScaleViewerContainer.getWidth()*this.rw;
this.sh =this.ScaleViewerContainer.getHeight()*this.rh;
this.rx = this.ScaleViewer.getX()*this.rw;
this.ry = this.ScaleViewer.getY()*this.rh;
this.ViewLyr[lyrid].setSize(this.sw,this.sh);
this.ViewLyr[lyrid].setLocation(this.rx*-1,this.ry*-1);
}
};
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Raymond Irving
Sent: Monday, September 29, 2003 10:05 AM
To: [EMAIL PROTECTED]
Subject: Re: [Dynapi-Help] Setting the scale for one object based on
another.
You might want to try using the onresize and onlocationchange events to make
the adjustments.
I believe a LayoutManager is in the making but it you can create one then
that would be cool.
--
Raymond Irving
--- Brian Hayes <[EMAIL PROTECTED]> wrote:
> Hello everyone, I have been at this for about (well all night) and I
> seem to be missing something... What am I trying?
>
> Well, When one layer grows, I need another layer to shring
> accourdingly..
> Plus, if I move one layer I need to other layer to move accourdingly..
> Everything I have tried seems to be close, but not there... Not to
> mention looking at the code in scrollbar.js, but being a little week
> in math?? Well, lets say its not my cup of tee..
>
> Please help...
>
> example:
>
> ViewWin is my larger Window and ScaleViewerContainer is my smaller
> window..
> The two objects that need to interact are ViewLyr[lyrid] where lyrid
> is the layer in focus (larger) and ScaleViewer the smaller one.
> -Both of the obove are contained in there parent layers ViewWin ->
> ViewLyr[lyrid] and ScaleViewerContainer -> ScaleViewer..
>
> this.rh =
>
this.ViewWin.getHeight()/this.ScaleViewer.getHeight();
> //ratio
> this.rw =
> this.ViewWin.getWidth()/this.ScaleViewer.getWidth();
> this.sw =(this.ViewLyr[lyrid].getWidth() -
> (this.ScaleViewer.getWidth()/this.rw))/this.rw;
> this.sh =(this.ViewLyr[lyrid].getHeight() -
> (this.ScaleViewer.getHeight()/this.rh))/this.rh;
>
> this.nh = this.ScaleViewerContainer.getHeight() -
> (this.sh-this.ScaleViewer.getHeight());
> this.nw = this.ScaleViewerContainer.getWidth() -
> (this.sw-this.ScaleViewer.getWidth());
> //this.rh =
> this.ViewWin.h/this.ScaleViewerContainer.h; //ratio
> //this.rw =
> this.ViewWin.w/this.ScaleViewerContainer.w;
> this.rx = (this.ViewLyr[lyrid].getX()*-1)/this.rw;
> this.ry = (this.ViewLyr[lyrid].getY()*-1)/this.rh;
>
>
> this.ScaleViewer.setSize(this.nw,this.nh);
>
>
this.ScaleViewer.setLocation((this.rx/this.rw),(this.ry/this.rh));
>
> Thanks, Brian Hayes
>
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help