Changeset 19
- Timestamp:
- 01/24/07 01:43:14 (2 years ago)
- Files:
-
- worldkit/com/brainoff/worldkitConfig.as (modified) (6 diffs)
- worldkit/com/brainoff/worldkitImages.as (modified) (8 diffs)
- worldkit/com/brainoff/worldkitInteraction.as (modified) (9 diffs)
- worldkit/com/brainoff/worldkitMain.as (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
worldkit/com/brainoff/worldkitConfig.as
r14 r19 106 106 var zoomc:Number; 107 107 var zoomifydir:String; 108 var zoomifynav:Boolean;109 108 var zoomselect:Boolean; 110 109 var zoomto:worldkitConfigCat; … … 173 172 zoomc = 1.5; 174 173 zoomifydir = "."; 175 zoomifynav = true;176 174 zoomselect = false; 177 175 … … 328 326 case "maxzoom": 329 327 case "toolbar": 330 case "zoomifynav":331 328 case "track": 332 329 case "uniqueurls": … … 536 533 //args passed in on url override config file 537 534 parseArgs(); 538 539 loaded = true; 540 main.signalDone("CONFIG"); 535 536 if (loadZoomifyConfig()) { 537 return; /* waiting for ImageProperties.xml to load, that will signalDone */ 538 } else { 539 loaded = true; 540 main.signalDone("CONFIG"); 541 } 541 542 } 542 543 … … 602 603 swftemplate[ id ].spanx = Math.ceil( (east - west ) / tiledeg ); 603 604 swftemplate[ id ].spany = Math.ceil( (north - south) / tiledeg ); 604 swftemplate[ id ].extent = west + "," + (90 - (tiledeg * swftemplate[ id ].spany)) + "," + (-180 + (tiledeg * swftemplate[ id ].spanx)) + "," + north; 605 swftemplate[ id ].extent = west + "," + (90 - (tiledeg * swftemplate[ id ].spany)) + "," + (-180 + (tiledeg * swftemplate[ id ].spanx)) + "," + north; /* BUG HERE in extent?? */ 605 606 } else { 606 607 swftemplate[ id ].extent = west + "," + south + "," + east + "," + north; … … 615 616 } 616 617 618 private function loadZoomifyConfig():Boolean { 619 if (displaytype == "zoomify") { 620 if (zoomifydir.charAt(zoomifydir.length-1) != "/") { zoomifydir = zoomifydir + "/"; } 621 displaytype = "day"; 622 dayimg = ""; 623 var config:worldkitConfig = this; 624 var loader:XML = new XML(); 625 loader.ignoreWhite = true; 626 loader.onLoad = function(success) { config.onZoomifyConfig(this,success); }; 627 loader.load( zoomifydir + "ImageProperties.xml" ); 628 return true; 629 } else { 630 return false; 631 } 632 } 633 634 public function onZoomifyConfig(xml:XML,success:Boolean):Void { 635 var val,i,node; 636 var zoomwidth, zoomheight, tilesize; 637 if (success) { 638 for (i = 0; i < xml.childNodes.length; i++) { 639 if (xml.childNodes[i].nodeName == "IMAGE_PROPERTIES") { 640 node = xml.childNodes[i]; 641 zoomwidth = node.attributes["WIDTH"]; 642 zoomheight = node.attributes["HEIGHT"]; 643 tilesize = node.attributes["TILESIZE"]; 644 } 645 } 646 647 var levelwidth = zoomwidth; 648 var levelheight = zoomheight; 649 while (((levelwidth / 2) > tilesize) || ((levelheight / 2) > tilesize)) { 650 levelwidth = levelwidth / 2; 651 levelheight = levelheight / 2; 652 } 653 var level = 1; 654 655 var usewidth; 656 var useheight; 657 var spanx, spany; 658 var id; 659 var wklevel = 1; 660 var tilecount = 1; 661 var tiledegw; 662 var tiledegh; 663 664 while ((levelwidth <= zoomwidth) && (levelheight <= zoomheight)) { 665 666 usewidth = levelwidth; //Math.floor(levelwidth); 667 useheight = levelheight; //Math.floor(levelheight); 668 spanx = Math.ceil( usewidth / tilesize); 669 spany = Math.ceil( useheight / tilesize); 670 tiledegw = tilesize * (east - west) / usewidth; 671 tiledegh = tilesize * (north - south) /useheight; 672 673 if (levelwidth >= this.w && levelheight >= this.h) { 674 675 id = "zoomify" + level; 676 swftemplate[ id ] = new Object(); 677 swftemplate[ id ].tilewidth = tilesize; 678 swftemplate[ id ].tileheight = tilesize; 679 swftemplate[ id ].url = zoomifydir; 680 swftemplate[ id ].zoomify = level; 681 swftemplate[ id ].tilecount = tilecount; 682 swftemplate[ id ].minscale = Math.pow(2, (wklevel - 1)); 683 swftemplate[ id ].maxscale = maxscale; 684 swftemplate[ id ].minview = Math.pow(2, (wklevel - 1)); 685 swftemplate[ id ].maxview = maxscale; 686 swftemplate[ id ].spanx = spanx; 687 swftemplate[ id ].spany = spany; 688 swftemplate[ id ].extent = west + "," + (north - (tiledegh * spany)) + "," + (west + (tiledegw * spanx)) + "," + north; 689 swftemplate[ id ].category = "zoomify"; 690 swftemplate[ id ].layer = swftemplatelayer; swftemplatelayer++; 691 692 wklevel++; 693 } 694 695 levelwidth = levelwidth * 2; 696 levelheight = levelheight * 2; 697 level++; 698 699 tilecount = tilecount + ( spanx * spany ); 700 } 701 } 702 loaded = true; 703 main.signalDone("CONFIG"); 704 } 705 706 617 707 public function getConfBySubject(option:String,cats:Array) { 618 708 for (var i=0; i<cats.length; i++) { worldkit/com/brainoff/worldkitImages.as
r14 r19 17 17 private var startLoading:Number; 18 18 private var loaderId:Number; 19 20 private var zmcb:Number;21 19 22 20 public function worldkitImages(main:worldkitMain) { … … 37 35 loadinglist = new Object(); 38 36 loadinglist.size = 0; 37 39 38 } 40 39 … … 55 54 layer++; 56 55 } 57 break;58 case("zoomify"):59 loadImage(imagemc, "day", conf.zoomifydir + "/zoomifyViewer.swf", layer, "Zoomify", 0, 0, undefined, undefined, undefined, true);60 layer++;61 56 break; 62 57 case("daynight"): … … 170 165 loadinglist.size++; 171 166 if (loaderId == -1) { 172 loaderId = setInterval( this, "MovieClipLoaderInterval", 250 ); 167 var i = 250; 168 loaderId = setInterval( this, "MovieClipLoaderInterval", i ); 173 169 } 174 170 } … … 287 283 } 288 284 289 public function Zoomify(mc:MovieClip, id:String):Void {290 mc[id].ToolbarStandardInstance._visible = 0;291 mc[id].ZoomifyViewerInstance.zoomifySplash_mc._visible = 0;292 mc[id].toolbarIcon_btn._visible = 0;293 mc[id].NavWindowInstance.navigationImage.zoomifySplash_mc._visible = false;294 if (conf.zoomifynav == false) {295 mc[id].NavWindowInstance._visible = 0;296 }297 mc[id].ZoomifyViewerInstance._x = conf.w / 2;298 mc[id].ZoomifyViewerInstance._y = conf.h / 2;299 mc[id].ZoomifyViewerInstance.setSize(conf.w,conf.h);300 mc[id].ZoomifyViewerInstance.setEnabled(false);301 mc[id].ZoomifyViewerInstance.setImagePath(conf.zoomifydir);302 mc[id].ZoomifyViewerInstance.worldKitImg = this;303 mc[id].ZoomifyViewerInstance.worldKitCb = function(t,p) {304 t.unregisterCallback("DownloadComplete", t.zmcb);305 t.worldKitImg.Pan();306 }307 var cb = targetPath(mc[id]) + ".ZoomifyViewerInstance.worldKitCb";308 mc[id].ZoomifyViewerInstance.zmcb = mc[id].ZoomifyViewerInstance.registerCallback("DownloadComplete", cb);309 mc[id].ZoomifyViewerInstance.updateView();310 }311 285 312 286 public function MakeInvisible(mc:MovieClip, id:String):Void { … … 341 315 mc[ id ]._visible = false; 342 316 } 343 }344 345 346 347 /*348 Called when model changes...349 */350 351 private function checkZoomify():Void {352 var id = "day";353 if (imagemc[id].ZoomifyViewerInstance == undefined) { return; }354 imagemc[id].ZoomifyViewerInstance.setEnabled(true);355 var w = imagemc[id].ZoomifyViewerInstance.getImageWidth();356 var h = imagemc[id].ZoomifyViewerInstance.getImageHeight();357 imagemc[id].ZoomifyViewerInstance.setZoom( interact.scale * 100 * conf.w / w );358 imagemc[id].ZoomifyViewerInstance.setX( .5 - interact.centerx / conf.w );359 imagemc[id].ZoomifyViewerInstance.setY( .5 - interact.centery / conf.h );360 imagemc[id].ZoomifyViewerInstance.setEnabled(false);361 imagemc[id].ZoomifyViewerInstance.updateView();362 317 } 363 318 … … 459 414 if (conf.swftemplate[id].tilemap) { 460 415 tileurl = tileurl + Math.log(conf.swftemplate[id].minscale)/Math.log(2) + "/" + i + "/" + (conf.swftemplate[id].spany - j - 1) + ".jpg"; 416 } else if (conf.swftemplate[id].zoomify != undefined) { 417 var group = Math.floor((conf.swftemplate[id].tilecount + i + (j * conf.swftemplate[id].spanx)) / 256); 418 tileurl = tileurl + "TileGroup" + group + "/" + conf.swftemplate[id].zoomify + "-" + i + "-" + j + ".jpg"; 419 trace(tileurl); 461 420 } else { 462 421 tileurl = worldkitUtil.myreplace(tileurl,"NORTH",tilenorth); … … 590 549 591 550 public function Pan():Void { 592 if (conf.displaytype == "zoomify") { 593 checkZoomify(); 594 } else { 595 interact.scaleAndPosition(imagemc,"day"); 596 } 551 interact.scaleAndPosition(imagemc,"day"); 597 552 if (conf.displaytype == "daynight") { 598 553 interact.scaleAndPosition(imagemc,"night"); worldkit/com/brainoff/worldkitInteraction.as
r18 r19 147 147 148 148 var maskx, masky; 149 if (conf.displaytype == "zoomify") { 150 maskx = conf.w; 151 masky = conf.h; 152 } else { 153 154 maskx=100, masky=100; 155 if (ratio >= 1) { 149 maskx=100, masky=100; 150 if (ratio >= 1) { 156 151 main.parent._xscale = conf.w/ratio; 157 152 main.parent._yscale = conf.h; … … 164 159 165 160 maskx = 100 * ratio; 166 } else {161 } else { 167 162 main.parent._xscale = conf.w; 168 163 main.parent._yscale = conf.h*ratio; … … 175 170 176 171 masky = 100 * ratio; 177 } 178 179 } 172 } 173 180 174 181 175 main.parent.worldkitMask.beginFill(0x000000); … … 194 188 componentScaleAndPosition("toolbar",conf.controlscale,0); 195 189 196 if (conf.toolbar == true || (conf.displaytype == "zoomify" && conf.toolbar == undefined)) {190 if (conf.toolbar == true) { 197 191 var b = new Array("Up","In","Out","Down","Left","Right"); 198 192 for (var i=0; i<b.length; i++) { … … 312 306 mc.grabber.origx = mc.grabber._xmouse; 313 307 mc.grabber.origy = mc.grabber._ymouse; 314 if (conf.displaytype == "zoomify") { 315 mc.grabber.origwidth = conf.w; 316 mc.grabber.origheight = conf.h; 317 } else if (conf.w > conf.h) { 308 if (conf.w > conf.h) { 318 309 mc.grabber.origwidth = (conf.w/conf.h) * 100; 319 310 mc.grabber.origheight = 100; … … 354 345 var offsetx = 0; 355 346 var offsety = 0; 356 if (conf.displaytype != "zoomify") { 357 if (ratio > 1) { 358 zoomboxw = 100 * ratio; zoomboxh = 100; 359 } else { 360 zoomboxw = 100; zoomboxh = 100 / ratio; 361 } 362 offsetx = (zoomboxw - 100); 363 offsety = (zoomboxh - 100); 364 } 347 if (ratio > 1) { 348 zoomboxw = 100 * ratio; zoomboxh = 100; 349 } else { 350 zoomboxw = 100; zoomboxh = 100 / ratio; 351 } 352 offsetx = (zoomboxw - 100); 353 offsety = (zoomboxh - 100); 365 354 366 355 var zoomxscale = scale * ( zoomboxw / Math.abs(mc.zoombox.origx - mc.zoombox._xmouse)); … … 602 591 if (args == undefined) { 603 592 var w, h, xoffset=0, yoffset=0; 604 if (conf.displaytype == "zoomify") { 605 w = conf.w; 606 h = conf.h; 607 } else { 608 if (ratio > 1) { 593 if (ratio > 1) { 609 594 w = 100 * ratio; h = 100; 610 595 xoffset = (w - h) / 2; 611 } else {596 } else { 612 597 h = 100 / ratio; w = 100; 613 598 yoffset = (h - w) / 2; 614 }615 599 } 616 600 var lon = ((x + xoffset)/w) * (ceast - cwest) + cwest; … … 894 878 var wfactor, hfactor; 895 879 896 if (conf.displaytype == "zoomify") { 897 w = conf.w; 898 h = conf.h; 899 wfactor = conf.w; 900 hfactor = conf.h; 901 } else { 902 if (ratio > 1) { 880 if (ratio > 1) { 903 881 w = 100 * ratio; h = 100; 904 } else {882 } else { 905 883 h = 100 / ratio; w = 100; 906 } 907 wfactor = 100; 908 hfactor = 100; 909 } 884 } 885 wfactor = 100; 886 hfactor = 100; 910 887 911 888 var wanother = 1; … … 955 932 var h = conf.h; 956 933 957 if (conf.displaytype != "zoomify") { 958 if (ratio > 1) { 934 if (ratio > 1) { 959 935 scalew = 100 * ratio / conf.w; 960 936 scaleh = 100 / conf.h; 961 } else {937 } else { 962 938 scalew = 100 / conf.w; 963 939 scaleh = 100 / (conf.h * ratio); 964 } 965 w = 100; 966 h = 100; 967 } 940 } 941 w = 100; 942 h = 100; 968 943 969 944 mc[id]._xscale = sc * scalew; worldkit/com/brainoff/worldkitMain.as
r18 r19 7 7 8 8 class com.brainoff.worldkitMain { 9 static var version:String = "3.1-200701 02";9 static var version:String = "3.1-20070123"; 10 10 11 11 var conf:worldkitConfig;
