Here's a quick and dirty example. It isn't pretty - but works. I tested it on IE5.5.
<html> <head> <script type="text/javascript" src="dynapi/src/dynapi.js" language="Javascript"></script> <script language="javascript"> Map = function() { this.base = new DynLayer(null,0,0,500,500); DynAPI.document.addChild(this.base); this.base.css.borderColor="#000000"; this.base.css.borderWidth="1px"; this.base.css.borderStyle="solid"; this.listener = new EventListener(this.base); this.listener.onmousedown = function(e) { var target = e.getTarget(); area = new DynLayer(null,e.x,e.y,2,2); e.getTarget().addChild(area); area.css.borderColor="#ff0000"; area.css.borderWidth="1px"; area.css.borderStyle="solid"; document.onmousemove=function() { area.setWidth(window.event.x-area.getX()); area.setHeight(window.event.y-area.getY()); } } this.listener.onmouseup = function(e) { document.onmousemove=function() {} } this.base.addEventListener(this.listener); } DynAPI.setLibraryPath('dynapi/src/lib/') DynAPI.include('dynapi.api.*') DynAPI.onLoad=function() { myMap = new Map(); } </script> </head> <body> </body> </html> -----Original Message----- From: Kralidis, Tom [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 12:00 PM To: Abre Chase Cc: '[EMAIL PROTECTED]' Subject: RE: [Dynapi-Help] can dynapi2 do this? Thanks for the info. I couldn't find anything in the archives for 'rubber banding', or 'bounding box'. Do you have any online examples? Thanks ..Tom > -----Original Message----- > From: Abre Chase [mailto:[EMAIL PROTECTED]] > Sent: Monday, June 24, 2002 11:40 AM > To: [EMAIL PROTECTED] > Subject: RE: [Dynapi-Help] can dynapi2 do this? > > > I've done something similar to this and I just used a > transparent layer with a border. > > In a nutshell, I created a base layer (Map). The Map layer > listens for onmousedown events and will create a (MapArea) > layer . As the mouse moves, the MapArea is resized. When > the onmouseup occurs, the size of the MapArea is set. > > Really wasn't too difficult - thanks to the DynAPI. I've > seen some other traffic on the newsgroup about 'rubber > banding' - you may want to search the archives. > > - Abre > > -----Original Message----- > From: DCT Jared Smith [mailto:[EMAIL PROTECTED]] > Sent: Monday, June 24, 2002 11:24 AM > To: [EMAIL PROTECTED] > Subject: Re: [Dynapi-Help] can dynapi2 do this? > > > It'll take a little bit o'code, but I know JavaScript will > render it quickly enough that it will not 'seem' like > you're drawing four lines. > > You'll be creating four layers, one pixel wide. > > Make a function that takes an upper left coordinate > and a lower right coordinate, and adjusts the length > and position of four layers. The layers are 1 pixel wide, > and their length depends on the coordinates to the > function. > > Then, in your dragEvents, simply call that function with > the beginpoint and the current coordinates of the mouse. > > The four layers will update to make the box 'enlarge' > or 'reduce' quite nicely. > > As for the X marking a click-down event, that should > be relatively easy, either with a transparent GIF or > with two criss-crossed layers of 1 pixel wide, 10 pixels > long. > > That's how I'd do it. Does anyone know how to create a > transparent layer, the border of which would be your > bounding box? That would take less code. > > -Jared > > > > > ------------------------------------------------------- > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Dynapi-Help mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/dynapi-help > > > ------------------------------------------------------- > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Dynapi-Help mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/dynapi-help > ------------------------------------------------------- Sponsored by: ThinkGeek at http://www.ThinkGeek.com/ _______________________________________________ Dynapi-Help mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dynapi-help