Ignore:
Timestamp:
2019-07-05T19:42:13+12:00 (5 years ago)
Author:
ak19
Message:

Any map-editor opened now centres on the shape overlays instead of always centering on on Uni of Waikato. It will now only continue to do the latter if a map editor has no shapes/overlays

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/map-scripts-editor.js

    r33150 r33300  
    313313    var that = this;
    314314
     315    // By default, the map editor will be centred on Waikato Uni at a particular zoom
    315316    this.map = new google.maps.Map(document.getElementById("map-" + this.id), {
    316317            center: {
     
    496497    var nodeID = this.id; // documentID, hopefully contains section ID too
    497498    var metaname = gps_metadata_name;
    498        
     499   
    499500    // collection, site, documentID, metadataName, metadataPosition, responseFunction
    500501    gs.functions.getArchivesMetadata(collection, site_name, nodeID, metaname, 0, function(responseText){
     
    507508                that.LOAD(JSONString, nodeID);
    508509                that.savedOverlays = JSONString;
     510               
     511                // centre on the map's overlays now they're loaded up
     512                var map_editor = gsmap_store["map-"+nodeID];
     513                var overlayBounds = ShapesUtil.overlayBounds(map_editor.overlays);
     514                if(map_editor.overlays.length === 1 && map_editor.overlays[0].type === google.maps.drawing.OverlayType.MARKER) {
     515                    that.map.setCenter(overlayBounds.getCenter());
     516                    that.map.setZoom(18);
     517                } else {                   
     518                    that.map.fitBounds(overlayBounds);
     519                }
    509520            }
    510521        }
Note: See TracChangeset for help on using the changeset viewer.