Changeset 33

Show
Ignore:
Timestamp:
10/11/07 02:03:29 (1 year ago)
Author:
mikel
Message:

conf.roundtextbox

Files:

Legend:

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

    r24 r33  
    205205            } 
    206206            // should maybe try to position this to the right of the point, or dynamically dependent on zoom) 
    207             if (w - x < textboxsize) { textx = x - (textboxsize / interact.scale); } 
     207            var boxmargin = 0; 
     208            if (conf.roundtextbox) { 
     209              boxmargin = 10; 
     210            } 
     211            if (w - x < (boxmargin + textboxsize)) { textx = x - (boxmargin + textboxsize / interact.scale); } 
    208212            if (h - y < 100) { texty = y - (50 / interact.scale); }      
    209213 
     
    219223                mc[textname].image.loadMovie(photo); 
    220224            } else { 
    221                 var htmlText = "<font color=\"#555555\" face=\"Verdana,Arial,_sans\" size=\"" + conf.textsize + "\"><b>" + title + "</b><br>" + summary + "</font>"; 
    222225                var textheight = 100; 
    223226                if (conf.textboxsize != 0) { 
    224                     mc[textname].createTextField("text",1,0,0,textboxsize,textheight); 
     227                    var htmlText; 
     228                    if (conf.roundtextbox) { 
     229                        mc[textname].createTextField("text",1,5,5,textboxsize,textheight); 
     230                        mc[textname].text.border = false; 
     231                        mc[textname].text.background = true; 
     232                        htmlText = "<font color=\"#0000F0\" face=\"Verdana,Arial,_sans\" size=\"" + conf.textsize + "\"><b>" + title + "</b></font><br><font color=\"#000000\" face=\"Verdana,Arial,_sans\" size=\"" + conf.textsize + "\">" + summary + "</font>"; 
     233                    } else { 
     234                        mc[textname].createTextField("text",1,0,0,textboxsize,textheight); 
     235                        mc[textname].text.border = true; 
     236                        mc[textname].text.backgroundColor = 0xFFFFFF; 
     237                        mc[textname].text.background = true; 
     238                        htmlText  = "<font color=\"#555555\" face=\"Verdana,Arial,_sans\" size=\"" + conf.textsize + "\"><b>" + title + "</b><br>" + summary + "</font>"; 
     239                    } 
    225240                    mc[textname].text.html = true; //REVISIT this might be trouble with non-roman chars 
    226241                    mc[textname].text.multiline = true; 
    227242                    mc[textname].text.wordWrap = true; 
    228                     mc[textname].text.border = true; 
    229243                    mc[textname].text.autoSize ="center"; 
    230                     mc[textname].text.background = true; 
    231                     mc[textname].text.backgroundColor = 0xFFFFFF;                
    232244                    mc[textname].text.htmlText = htmlText; 
     245 
     246                    if (conf.roundtextbox) { 
     247                        // turn box into a rounded rectangle 
     248                        var cstroke = {width:2, color:0x808080, alpha:100}; 
     249                        var ccolor = {color:0xf0f0f0, alpha:100}; 
     250                        rrectangle( 
     251                                mc[textname], 
     252                                mc[textname]._width + boxmargin, 
     253                                mc[textname]._height + boxmargin + 3, 
     254                                6, 
     255//                              ((textx+w+16) > Stage.width ) ? (Stage.width-w-16) : textx, 
     256                                textx, 
     257                                texty, 
     258                                cstroke, 
     259                                ccolor); 
     260 
     261                        // add a dropshadow 
     262                        var dropShadow = new flash.filters.DropShadowFilter(); 
     263                        dropShadow.blurX = 4; 
     264                        dropShadow.blurY = 4; 
     265                        dropShadow.distance = 4; 
     266                        dropShadow.angle = 45; 
     267                        dropShadow.quality = 2; 
     268                        dropShadow.alpha = 0.75; 
     269                        mc[textname].filters = [dropShadow]; 
     270                    } 
    233271                } 
    234272            } 
     
    237275        } 
    238276 
     277    } 
     278 
     279    // Rounded rectangle made only with actionscript. 
     280    // Code taken and modified from http://www.actionscript-toolbox.com 
     281    // w = rectangle width 
     282    // h = rectangle height 
     283    // rad = rounded corner radius 
     284    // x = x  start point for rectangle 
     285    // y = y  start point for rectangle 
     286    //  
     287    private function rrectangle( mc:MovieClip, w:Number, h:Number, rad:Number, x:Number, y:Number, stroke:Object, fill:Object) : Void { 
     288        x = Math.round(x); 
     289        y = Math.round(y); 
     290        w = Math.round(w); 
     291        h = Math.round(h); 
     292 
     293        mc.lineStyle(stroke.width, stroke.color, stroke.alpha); 
     294        mc.beginFill(fill.color, fill.alpha); 
     295        mc.moveTo(0+rad, 0); 
     296        mc.lineTo(w-rad, 0); 
     297        mc.curveTo(w, 0, w, rad); 
     298        mc.lineTo(w, h-rad); 
     299        mc.curveTo(w, h, w-rad, h); 
     300        mc.lineTo(0+rad, h); 
     301        mc.curveTo(0, h, 0, h-rad); 
     302        mc.lineTo(0, 0+rad); 
     303        mc.curveTo(0, 0, 0+rad, 0); 
     304        mc.endFill(); 
     305        mc._x = x; 
     306        mc._y = y; 
    239307    } 
    240308 
  • worldkit/com/brainoff/worldkitConfig.as

    r32 r33  
    7575    var resultssince:Boolean; 
    7676    var restingplotcolor:worldkitConfigCat; 
     77    var roundtextbox:Boolean; 
    7778    var rssiconwidth:Number; 
    7879    var rssbbox:Boolean; 
     
    147148        projection = "none"; 
    148149        resultssince = false; 
     150        roundtextbox = false; 
    149151        rssbbox = false; 
    150152        rssiconwidth = 20; 
     
    345347        case "rssbbox": 
    346348        case "zoomifypreload": 
     349        case "roundtextbox": 
     350        case "zoomifypreload": 
    347351 
    348352            if (value == "true") { 
  • worldkit/com/brainoff/worldkitMain.as

    r32 r33  
    77 
    88class com.brainoff.worldkitMain { 
    9     static var version:String = "3.3-20070820"; 
     9    static var version:String = "3.3-20071011"; 
    1010 
    1111    var conf:worldkitConfig;