Changeset 9287

Show
Ignore:
Timestamp:
05/06/08 06:19:30 (3 months ago)
Author:
leibovic
Message:

Minor tweaks

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • my-mit-maps/trunk/api/scripts/buildings.js

    r9234 r9287  
    1111    }, 
    1212    minZoom: 17, 
     13    fullZoom: 20, 
    1314    maxZoom: 22, 
    1415    tileData: { 
  • my-mit-maps/trunk/api/scripts/flooroverlay.js

    r9265 r9287  
    33 */ 
    44  
    5 // GLatLngBounds bounds - bounds for location of overlay over floor plan 
    6 function FloorOverlay(floorNumber, buildingNumber, bounds) { 
     5// GLatLng center - center for location of overlay over floor plan 
     6function FloorOverlay(floorNumber, buildingNumber, center) { 
    77        this.floor_ = floorNumber; 
    88        this.building_ = buildingNumber; 
    9         this.bounds_ = bounds
     9        this.center_ = center
    1010} 
    1111  
     
    1616        //div.setAttribute("class", "floor-overlay"); // TODO: set .floor-overlay style in CSS 
    1717        div.style.position = "absolute"; 
    18         div.style.border = "1px solid #000000"; 
    19         div.style.background = "#ffffff"; 
     18        div.style.border = "2px solid #000000"; 
     19        div.style.opacity = "0.5"; 
     20        div.style.background = "#888"; 
     21    div.style.color = "white"; 
    2022         
    21         div.innerHTML = "<span>"+this.floor_+" - "+this._building+"</span>" ; 
     23        var span = document.createElement("span"); 
     24        span.innerHTML = "<center>"+this.building_+" - "+this.floor_+"</center>"; 
     25        span.style.padding = "4px 0px"; 
     26    span.style.font = "24pt bold Helvetica"; 
     27        div.appendChild(span); 
    2228         
    2329        map.getPane(G_MAP_MAP_PANE).appendChild(div); 
    2430        this.map_ = map;  
    2531        this.div_ = div; 
    26         console.log(div); 
    2732} 
    2833 
     
    3944        if (!force) return; 
    4045         
    41         var c1 = this.map_.fromLatLngToDivPixel(this.bounds_.getSouthWest())
    42         var c2 = this.map_.fromLatLngToDivPixel(this.bounds_.getNorthEast())
     46        this.div_.style.width = "100px"
     47        this.div_.style.height = "50px"
    4348         
    44         this.div_.style.width = Math.abs(c2.x - c1.x) + "px"; 
    45         this.div_.style.height = Math.abs(c2.y - c1.y) + "px"; 
    46         this.div_.style.left = (Math.min(c2.x, c1.x) - 1) + "px"; 
    47         this.div_.style.top = (Math.min(c2.y, c1.y) - 1) + "px"; 
    48         console.log(this.bounds_); 
    49          
     49        var c = this.map_.fromLatLngToDivPixel(this.center_); 
     50        this.div_.style.left = (Math.floor(c.x - 50)) + "px"; 
     51        this.div_.style.top = (Math.floor(c.y) - 25) + "px"; 
    5052} 
    5153 
  • my-mit-maps/trunk/api/scripts/lines.js

    r9263 r9287  
    2222    var latlng = clickedPoint; 
    2323     
    24     map.panTo(clickedPoint); // get rid of this but keep double click working 
     24    map.panTo(clickedPoint); // TODO get rid of this but keep double click working 
    2525        newLine.points.push(clickedPoint); 
    2626        if(newLine.points.length == 1) { 
     
    126126    } 
    127127    var line = new GPolyline(latlngs, feature.color); // weight, opacity 
    128     var marker = new GMarker(latlngs[latlngs.length-1], { icon: new GIcon(G_DEFAULT_ICON) }); 
     128    var marker = new GMarker(latlngs[Math.floor(latlngs.length/2)], { icon: new GIcon(G_DEFAULT_ICON) }); 
    129129    var onclick = function() { onFeatureClick(feature, marker); }; 
    130130     
    131131    GEvent.addListener(line, "click", onclick); 
    132     GEvent.addListener(marker, "click", onclick); 
    133132    map.addOverlay(line); 
    134133    map.addOverlay(marker); 
     134    marker.hide() 
    135135    feature.line = line; 
    136136    feature.marker = marker; 
  • my-mit-maps/trunk/api/scripts/mit-floor-plans.js

    r9265 r9287  
    107107        map.showFloors(map._floors); 
    108108    }; 
    109      
    110     // create FloorOverlay 
    111     var floorNavBounds = new GLatLngBounds(new GLatLng(42.361584231438876, -71.09073758125305), 
    112         new GLatLng(42.36174872923669,-71.0904210805893)); 
    113     map.addOverlay(new FloorOverlay(1, 32, floorNavBounds)); 
    114109     
    115110    return map; 
     
    271266    MITFloorPlans.createControls(currentFloor); 
    272267    document.getElementById("search-textbox").onkeypress = onSearchKeyPress; 
    273  
    274268} 
    275269 
     
    323317    var html = []; 
    324318    var floors = currentBuilding.floors; 
    325     for (var f = floors.length - 1; f >= 0; f--) { // TODO generalize 
     319    for (var f = floors.length - 1; f >= 0; f--) {  
    326320        html.push( 
    327321            "<a class='" + (floors[f] == currentFloor ? "floor-link-selected" : "floor-link") + "' href='javascript:MITFloorPlans.setFloor(" + floors[f] + ");' id='floor-link-" + floors[f] + "'>" + 
     
    333327    container.innerHTML = html.join(""); 
    334328     
    335     recreateFeatures(initialFloor); 
     329    recreateFeatures(initialFloor);  
     330    MITFloorPlans.renderFloorOverlay(); 
    336331} 
    337332 
    338333MITFloorPlans.setFloor = function(f, cont) { 
    339334    if (f != currentFloor) { 
     335        /* 
    340336        var floorIndicator = document.getElementById("floor-indicator"); 
    341337        floorIndicator.innerHTML = "<span>floor " + f + "</span>"; 
    342338        floorIndicator.style.display = "block"; 
     339        */ 
    343340         
    344341        document.getElementById("floor-link-" + currentFloor).className = "floor-link"; 
     
    351348            recreateFeatures(f); 
    352349             
     350            /* 
    353351            window.setTimeout(function() { 
    354352                floorIndicator.style.display = "none"; 
    355353            }, 500); 
     354            */ 
    356355             
    357356            if (cont) { 
     
    403402} 
    404403 
     404MITFloorPlans.renderFloorOverlay = function() { 
     405        var floorNavCenter = new GLatLng(42.36174872923669,-71.0904210805893); 
     406        map.addOverlay(new FloorOverlay(currentFloor, currentBuilding.id, floorNavCenter)); 
     407} 
     408 
    405409function encodeUrlString(s) { 
    406410    return encodeURIComponent(encodeJavascriptString(s)); 
  • my-mit-maps/trunk/api/scripts/records.js

    r9263 r9287  
    2525                } 
    2626        } 
     27        MITFloorPlans.renderFloorOverlay(); 
    2728} 
    2829