Ignore:
Timestamp:
2019-07-02T21:04:34+12:00 (5 years ago)
Author:
wy59
Message:
  1. References to new Array() changed to [] and _docList now no longer initalised with new Array but with {} because it was being used as a map. 2. Added toggleMapSection and modified httpMapBrowseRequest() to do as Dr Bainbridge had suggested: httpMapBrowseRequest would add the JSON info for the docs returned for the expanded classifier into a data attribute for the expanded classifier ID. Then on expanding during toggling a classifier, the map would add the doc info for each of the docs stored in the data attribute for the toggled section into the _docList map, and on closing the bookshelf when toggling a classifier the affected docs (those referenced in the toggled section's data attribute) would be removed from the _docList. 3. This did not solve the original problem that performSearchForMarkers() was always being called when the map bounds were extended since _docList maintained not just the expanded visible docs but also the nearbyDocs from the proximity search for what else could be displayed on the map. Dr Bainbridge solved all this by cleaning up the existing code (e.g. renaming functions like performSearchForMarkers changed to performProximitySearch and renaming variables like _nearbyDocs to _nearbyDocsByDistance) and introducing new variables like the new array nearbyDocListByProximity. The array nearbyDocListByProximity is emptied and repopulated by the performProximitySearch() function. These docs only need to be displayed on the map, so the list can be recreated on every expanded bookshelf. performProximitySearch() will first empty the _nearbyDocListByProximity array after removing its markers from the current map, then it will perform the search and add each document found that's not already in _docList (i.e. not already visible in one of the expanded classifiers) to _nearbyDocListByProximity. These docs' shapes are then drawn on the map at lower opacity but on updateMap)() these docs won't trigger a bounds_changed, as the bounds are only calculated based on the main docs, the ones in the now reduced _docList, and not based on the nearby docs in _nearbyDocListByProximity. 4. Dr Bainbridge fixed an issue whereby expanding the first node would not get nearby docs for it with performProximitySearch() as the map bounds were invalid due to incomplete map initialisation. The culprit was with setting the map display to hidden, turning it on thereafter with display block never changed the map bounds from 0 back to something valid when the map bounds were printed before the fitBounds() call. Also, setting the map's visibility to hidden with 0px height and then to visible with a positive height would result in the map bounds calculated longitude to be 0. The solution Dr Bainbridge came up with was to only use visibility rather than display, but not set the height, instead on hidden map setting the position to absolute would allow the visible elements to continue to flow on the page and when the map was set to visible, its position property should be returned to relative. 5. Added debugging and info logging functions.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/classifier_scripts.js

    r33286 r33289  
    2929    if(section.length !== 0)
    3030    {
     31        var expanding = false;
    3132        if(isExpanded(sectionID))
    3233        {
     34            expanding = false;
    3335            section.css("display", "none");
    3436            sectionToggle.attr("src", gs.imageURLs.expand);
     
    4143        else
    4244        {
     45            expanding = true;
    4346            section.css("display", "block");
    4447            sectionToggle.attr("src", gs.imageURLs.collapse);
     
    4649        }
    4750        updateOpenClassifiers();
    48         if(typeof mapEnabled !== 'undefined' && mapEnabled){
     51        if(typeof mapEnabled !== 'undefined' /*&& mapEnabled*/){
    4952            //console.log("Classifier scripts -> updateMap()");
     53            toggleMapSection({"expand": expanding, "nodeID": sectionID});
    5054            updateMap();
    5155        }
Note: See TracChangeset for help on using the changeset viewer.