Changeset 24

Show
Ignore:
Timestamp:
02/16/07 09:51:02 (2 years ago)
Author:
mikel
Message:

fixes off by one error in zoomify, and various other small bugs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • worldkit/com/brainoff/worldkitAnnotation.as

    r14 r24  
    210210            mc[ textname ]._x = textx; if (textx != x) { mc[textname].leftpos = true; } 
    211211            mc[ textname ]._y = texty; if (texty != y) { mc[textname].bottompos = true; } 
    212          
     212 
     213 
    213214            mc[textname]._xscale = scale;     
    214215            mc[textname]._yscale = scale; 
     
    542543                rss.setActive(this); 
    543544            } 
     545 
     546            var ratio = conf.w / conf.h; 
     547            var stagew, stageh, textx, texty; 
     548            if (ratio > 1) { stagew  = 100 * ratio; stageh = 100; } 
     549            else { stageh = 100 / ratio; stagew = 100; } 
     550 
     551            var mousex = conf.w * (_root._xmouse / stagew); 
     552            var mousey = conf.h * (_root._ymouse / stageh); 
     553 
     554            if (mc.origwidth - mousex < conf.textboxsize) { textx = mousex - (conf.textboxsize / interact.scale); } 
     555            if (mc.origheight - y < 100) { texty = mousey - (50 / interact.scale); }    
     556 
     557            mc[ textname ]._x = textx; if (textx != x) { mc[textname].leftpos = true; } 
     558            mc[ textname ]._y = texty; if (texty != y) { mc[textname].bottompos = true; } 
     559 
    544560            mc[ textname ]._visible = 1;  
    545561        } else { 
  • worldkit/com/brainoff/worldkitConfig.as

    r19 r24  
    404404                } 
    405405                if (attr.minscale != undefined) { 
    406                     this.swflayer[attr.id].minscale = attr.minscale; 
     406                    this.swflayer[attr.id].minview = attr.minscale; 
    407407                } 
    408408                if (attr.maxscale != undefined) { 
    409                     this.swflayer[attr.id].maxscale = attr.maxscale; 
     409                    this.swflayer[attr.id].maxview = attr.maxscale; 
    410410                } 
    411411                if (attr.preload != undefined) { 
     
    457457                    this.wms[ attr.id ] = new Object(); 
    458458                    this.wms[ attr.id ].url = value; 
     459                    if (attr.path) { 
     460                        this.wms[ attr.id ].url = this.wms[ attr.id ].url + attr.path; 
     461                    } else { 
     462                        this.wms[ attr.id ].url = this.wms[ attr.id ].url + "ZOOM/XTILE/YTILE.jpg"; 
     463                    } 
     464                    if (attr.origin) { 
     465                        this.wms[ attr.id ].origin = attr.origin; 
     466                    } else { 
     467                        this.wms[ attr.id ].origin = "sw"; 
     468                    } 
    459469                    this.wms[ attr.id ].width = 256; 
    460470                    this.wms[ attr.id ].height = 256; 
     
    590600                if (wms[ s ].tilemap) { 
    591601                        swftemplate[ id ].url = wms[ s ].url; 
     602                        swftemplate[ id ].origin = wms[ s ].origin; 
    592603                        swftemplate[ id ].tilemap = true; 
    593604                } else { 
     
    626637            loader.onLoad = function(success) { config.onZoomifyConfig(this,success); }; 
    627638            loader.load( zoomifydir + "ImageProperties.xml" );  
     639 
     640            if (toolbar == undefined) { 
     641                toolbar = true; 
     642            } 
    628643            return true; 
    629644        } else { 
  • worldkit/com/brainoff/worldkitImages.as

    r21 r24  
     1 
    12import com.brainoff.worldkitMain; 
    23import com.brainoff.worldkitConfig; 
     
    9091        for (var s in conf.swftemplate) { 
    9192            imagemc.createEmptyMovieClip(s, layer + conf.swftemplate[s].layer); 
    92             if (conf.swftemplate[s].layer > l) { 
    93                     l = conf.swftemplate[s].layer; //REVIST tangled interplay of config iterator, layer, etc 
    94             } 
    9593        }  
    96         layer += l
     94        layer += conf.swftemplatelayer
    9795 
    9896//      checkSwfTemplate(); 
     
    103101        */ 
    104102        for (var swf in conf.swflayer) { 
    105             if (conf.swflayer[swf].preload != false && ! conf.swflayer[swf].fromtemplate) { //need to save layer level if not preload 
     103            if (conf.swflayer[swf].preload != false && conf.swflayer[swf].fromtemplate != true) { //need to save layer level if not preload 
    106104                loadImage(imagemc, "swflayer" + swf, conf.swflayer[swf].url, layer, "AdjustSwf", 0,1, conf.swflayer[swf].w, conf.swflayer[swf].h, conf.swflayer[swf].extent, true); 
    107                 conf.swflayer[swf].parent = imagemc; 
    108105                layer++; 
    109             } 
     106             } 
     107             conf.swflayer[swf].parent = imagemc; 
    110108        } 
    111109 
     
    220218                target_mc.origwidth = target_mc._width; 
    221219            } 
     220            target_mc.actualwidth = target_mc._width; 
    222221 
    223222            if (imglist[key].height != undefined) { 
     
    226225                target_mc.origheight = target_mc._height; 
    227226            } 
     227            target_mc.actualheight = target_mc._height; 
    228228        } 
    229229 
     
    318318            clip.setMask( clip[ "masker"] ); 
    319319        } 
    320         interact.scaleAndPosition(mc, id, conf.swflayer[confid].extent); 
     320        interact.scaleAndPosition(mc, id, conf.swflayer[confid].extent, true); 
    321321        mc[ id ]._alpha = 100; 
    322322         
     
    335335            if (mc[id] == undefined) { 
    336336                loadImage(mc, id, conf.swflayer[confid].url, layer, "AdjustSwf", 0, 1, conf.swflayer[confid].w, conf.swflayer[confid].h, conf.swflayer[confid].extent); 
     337                layer++; 
    337338            } else if (mc[id].loaded == true) { 
    338                 interact.scaleAndPosition(mc, id, conf.swflayer[confid].extent); 
     339                interact.scaleAndPosition(mc, id, conf.swflayer[confid].extent, true); 
     340                var wsen = conf.swflayer[confid].extent.split(','); 
     341                //interact.onJRSSComm("<rss><channel><item><description>" + conf.swflayer[confid].extent + "</description><georss:box>" + wsen[1] + " " + wsen[0] + " " + wsen[3] + " " + wsen[2] + "</georss:box></item></channel></rss>");     
    339342                mc[ id ]._visible = true; 
    340343                //setTimeNavAlpha(mc,id); 
     
    425428 
    426429                if (conf.swftemplate[id].tilemap) { 
    427                         tileurl = tileurl + Math.log(conf.swftemplate[id].minscale)/Math.log(2) + "/" +  i + "/" + (conf.swftemplate[id].spany - j - 1) + ".jpg"; 
     430                        tileurl = worldkitUtil.myreplace(tileurl,"ZOOM", (Math.log(conf.swftemplate[id].minscale)/Math.log(2)).toString()); 
     431                        tileurl = worldkitUtil.myreplace(tileurl,"XTILE", i); 
     432                        if (conf.swftemplate[ id ].origin == "nw") { 
     433                                tileurl = worldkitUtil.myreplace(tileurl,"YTILE", j); 
     434                        } else { 
     435                                tileurl = worldkitUtil.myreplace(tileurl,"YTILE", (conf.swftemplate[id].spany -j - 1).toString()); 
     436                        } 
     437                                 
     438                                 
     439                        //tileurl = tileurl + Math.log(conf.swftemplate[id].minscale)/Math.log(2) + "/" +  i + "/" + (conf.swftemplate[id].spany - j - 1) + ".jpg"; 
    428440                } else if (conf.swftemplate[id].zoomify != undefined) { 
    429441                        var group = Math.floor((conf.swftemplate[id].tilecount + i + (j * conf.swftemplate[id].spanx)) / 256); 
  • worldkit/com/brainoff/worldkitInteraction.as

    r19 r24  
    223223            } else { 
    224224                mc.toolbar["DragOn"]._visible = 0; 
     225                conf.grabber = true; 
    225226            } 
    226227        } else { 
     
    490491 
    491492        Zoom(); 
     493 
     494        if (conf.onzoompan) { 
     495                var args = "extent=" + cwest + "," + csouth + "," + ceast + "," + cnorth; 
     496                //getURL( conf.onzoompan + "(\"" + args + "\");" ); 
     497                ExternalInterface.call( conf.onzoompan.substr(11), args); 
     498        } 
    492499    } 
    493500 
     
    803810    } 
    804811 
    805     public function geo2xy(lat:Number,lon:Number,point:Boolean):Array { 
     812    public function geo2xy(lat:Number,lon:Number,point:Boolean,over:Boolean):Array { 
    806813 
    807814        var w = conf.w; 
     
    831838            y = lon; 
    832839        } else if (conf.west >= conf.east) { 
    833             if (lon <= ea) { 
     840            if (lon <= ea || over) { 
    834841                x = ((lon - we + 360)/(ea + 360 - we)) * w; 
    835842            } else { 
     
    873880      The black magic of worldKit. Fit images to a map with dynamically determing width/heigh 
    874881    */ 
    875     public function scaleAndPosition(parent:MovieClip, id:String, extent:String):Void {  
     882    public function scaleAndPosition(parent:MovieClip, id:String, extent:String, tiled:Boolean):Void {  
    876883         
    877884        var w, h; 
     
    890897        var xanother = 0; 
    891898        var yanother = 0; 
     899        var xy; 
     900 
    892901        if (extent == 1) { 
    893902            hanother = 180/(conf.north - conf.south); 
    894903            wanother = 360/(conf.east - conf.west); 
    895904             
    896             var xy = geo2xy(90,-180); 
     905            xy = geo2xy(90,-180); 
    897906            xanother = xy[0] * w / conf.w; 
    898907            yanother = xy[1] * h / conf.h; 
     908 
    899909        } else if (extent != undefined) { 
    900910            var no,so,ea,we; 
     
    904914            wanother = (ea - we)/(conf.east - conf.west); 
    905915             
    906             var xy = geo2xy( no, we); 
     916            xy = geo2xy( no, we); 
    907917            xanother = xy[0] * scale * w / conf.w; 
    908918            yanother = xy[1] * scale * h / conf.h; 
     919 
    909920        } 
    910921         
     
    915926            clip = parent[id]; 
    916927        } 
    917         clip._xscale = scale * 100 * ( w / clip.origwidth) * wanother; 
    918         clip._yscale = scale * 100 * ( h / clip.origheight) * hanother; 
     928 
     929 
     930        var xscale = scale * 100 * ( w / clip.origwidth) * wanother; 
     931        var yscale = scale * 100 * ( h / clip.origheight) * hanother; 
    919932 
    920933        var xoffset = scale * ((conf.w / 2) - centerx) * (w / conf.w); 
    921934        var yoffset = scale * ((conf.h / 2) - centery) * (h / conf.h); 
    922935         
    923         clip._x = - ((w - wfactor) / 2 + ((scale - 1) * w / 2)) + xoffset + xanother; 
    924         clip._y = - ((h - hfactor) / 2 + ((scale - 1) * h / 2)) + yoffset + yanother; 
     936        var xp = - ((w - wfactor) / 2 + ((scale - 1) * w / 2)) + xoffset + xanother; 
     937        var yp = - ((h - hfactor) / 2 + ((scale - 1) * h / 2)) + yoffset + yanother; 
     938 
     939        if (tiled) { 
     940                var width = clip.actualwidth * xscale / 100; 
     941                var height = clip.actualheight * yscale / 100;   
     942 
     943                var x2 = Math.floor(xp * 20) / 20; 
     944                var y2 = Math.floor(yp * 20) / 20; 
     945 
     946                width = width + (xp - x2); 
     947                height = height + (yp - y2); 
     948 
     949                width = Math.ceil(width * 20) / 20; 
     950                height = Math.ceil(height * 20) / 20; 
     951 
     952                if (clip.actualwidth < clip.origwidth) { 
     953                        width = Math.ceil(width); 
     954                } 
     955                if (clip.actualheight < clip.origheight) { 
     956                        height = Math.ceil(height); 
     957                } 
     958 
     959                clip._width = width; 
     960                clip._height = height; 
     961 
     962 
     963                clip._x = x2; 
     964                clip._y = y2;    
     965        } else { 
     966                clip._xscale = xscale; 
     967                clip._yscale = yscale; 
     968                clip._x = xp; 
     969                clip._y = yp; 
     970        } 
     971 
     972        if (tiled && false) { 
     973                var wsen = extent.split(","); 
     974                xy = geo2xy(wsen[1], wsen[2], undefined, true); 
     975                xanother = xy[0] * scale * w / conf.w; 
     976                yanother = xy[1] * scale * h / conf.h; 
     977 
     978                var x2 = - ((w - wfactor) / 2 + ((scale - 1) * w / 2)) + xoffset + xanother; 
     979                var y2 = - ((h - hfactor) / 2 + ((scale - 1) * h / 2)) + yoffset + yanother; 
     980                x2 = Math.round(x2 * 20) / 20; 
     981                y2 = Math.round(y2 * 20) / 20; 
     982                trace( id + " " + clip._x + " " + clip._y); 
     983                trace( id + " " + x2 + "," + y2 + " " + (clip._x + clip._width) + "," + (clip._y + clip._height) ); 
     984 
     985                //clip._width += (x2 - (clip._x + clip._width)); 
     986                //clip._height += (y2 - (clip._y + clip._height)); 
     987                var xdiff = x2 - (clip._x + clip._width); 
     988                var ydiff = y2 - (clip._y + clip._height); 
     989                if (xdiff > 0.0001 && xdiff < 1) { 
     990                        clip._width += xdiff; 
     991                }  
     992                if (ydiff > 0.0001 && ydiff < 1) {       
     993                        clip._height += ydiff;    
     994                        //trace( id + " " + x2 + "," + y2 + " " + (clip._x + clip._width) + "," + (clip._y + clip._height) ); 
     995                } 
     996                trace( id + " " + x2 + "," + y2 + " " + (clip._x + clip._width) + "," + (clip._y + clip._height) ); 
     997        } 
    925998    } 
    926999 
  • worldkit/com/brainoff/worldkitMain.as

    r23 r24  
    77 
    88class com.brainoff.worldkitMain { 
    9     static var version:String = "3.1-20070125"; 
     9    static var version:String = "3.1-20070201"; 
    1010 
    1111    var conf:worldkitConfig; 
  • worldkit/com/brainoff/worldkitRSS.as

    r17 r24  
    351351                break; 
    352352            case("pubdate"): //RSS 2.0 
    353             case("issued"): //Atom 
     353            case("issued"): //Atom 0.3 
     354            case("updated"): //Atom 1.0 
    354355            case("dc:date"): //RSS 1.0 
    355356            case("ev:startdate"): //for consistency