• Resolved matthieulllrc

    (@matthieulllrc)


    Hello

    The Adapt map to screen height map option does not work.

    Because the option works in Google Maps Easy, another of your products, I compared the two plugins, looking for the code that implement the feature.

    For Google Maps Easy, it’s gmpGoogleMap.prototype.resizeMapByHeight in \google-maps-easy\modules\gmap\js\core.gmap.js.

    There is no equivalent function in \ultimate-maps-by-supsystic\modules\maps\js\core.maps.js.

    Regards.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter matthieulllrc

    (@matthieulllrc)

    Hello,

    Until it is fixed, here is a temporary solution:

    In \ultimate-maps-by-supsystic\modules\maps\js\core.maps.js, I created the umsBaseMap.prototype.resizeMapByHeight function.

    umsBaseMap.prototype.resizeMapByHeight = function() {
    	if(!UMS_DATA.isAdmin && parseInt(this.getParam('adapt_map_to_screen_height')) && this.getRawMapInstance().map_display_mode != 'popup') {
    		var self = this;
    
    		function resizeHeight() {
    			var viewId = self.getParam('view_id')
    			,	mapContainer = jQuery('#umsMapDetailsContainer_' + viewId)
    			,	mapContainerOffset = mapContainer.length ? mapContainer.offset() : false
    			,	windowHeight = jQuery(window).height();
    
    			if(mapContainerOffset) {
    				jQuery('#umsMapDetailsContainer_' + viewId + ', #' + self.getParam('view_html_id')).each(function () {
    					var height = mapContainerOffset.top < windowHeight ? windowHeight - mapContainerOffset.top : windowHeight;
    					jQuery(this).height(height);
    				});
    				self.refresh();
    			}
    		}
    		resizeHeight();
    		jQuery(window).bind('resize', resizeHeight);
    		jQuery(window).bind('orientationchange', resizeHeight);
    	}
    };

    And I modified the umsBaseMap.prototype._afterInit function.

    umsBaseMap.prototype._afterInit = function() {
    	if(typeof(this._mapParams.marker_clasterer) !== 'undefined' && this._mapParams.marker_clasterer) {
    		this.enableClasterization(this._mapParams.marker_clasterer);
    	}
    	this.resizeMapByHeight(); /* ← ← ← ← ← ADDED HERE */
    	jQuery(document).trigger('umsAfterMapInit', this);
    };

    Regards.

    Plugin Author supsystic

    (@supsysticcom)

    Hello.
    Thank you for your feedback.
    We will definitely check this problem and release the fix.
    In the next version it will be fixed.

    Thread Starter matthieulllrc

    (@matthieulllrc)

    Hello,

    Thank you very much.

    Concerning the temporary solution I shared, I discovered that it does not work correctly because self.refresh(), i.e. umsBaseMap.prototype.refresh() does not exist.

    And the gmap version cannot be used as is because it depends on google.maps.event.trigger(this.getRawMapInstance(), 'resize') which of course would not work in Ultimate Maps.

    Could you suggest an equivalent?

    Regards.

    Plugin Author supsystic

    (@supsysticcom)

    Please wait for fix from us.

    Thread Starter matthieulllrc

    (@matthieulllrc)

    I will!

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adapt map to screen height does not work’ is closed to new replies.