Skip to content

Commit

Permalink
Initialize map controls correctly from PilsenAppRelease
Browse files Browse the repository at this point in the history
  • Loading branch information
raitisbe committed Sep 12, 2019
1 parent 2501631 commit bde1fd3
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions components/map/map.service.js
Expand Up @@ -3,7 +3,7 @@ import { DoubleClickZoom, KeyboardPan, KeyboardZoom, MouseWheelZoom, PinchRotate
import Kinetic from 'ol/Kinetic';
import Map from 'ol/Map';
import View from 'ol/View';
import { MousePosition, defaults as controlDefaults } from 'ol/control';
import { MousePosition, ScaleLine, defaults as controlDefaults } from 'ol/control';
import { createStringXY } from 'ol/coordinate';
import { TileWMS, WMTS } from 'ol/source';
import { ImageWMS, ImageArcGISRest } from 'ol/source';
Expand Down Expand Up @@ -68,9 +68,7 @@ export default ['config', '$rootScope', 'hs.utils.service', '$timeout', function
me.map.getLayers().clear();
}
me.map = new Map({
controls: controlDefaults({
zoom: false
}),
controls: me.controls,
target: 'map',
interactions: [],
view: cloneView(config.default_view || createPlaceholderView())
Expand Down Expand Up @@ -150,6 +148,21 @@ export default ['config', '$rootScope', 'hs.utils.service', '$timeout', function
*/
this.duration = 400;

/**
* @ngdoc property
* @name hs.map.service#controls
* @public
* @type {Object}
* @description Set of default map controls used in HSLayers, may be loaded from config file
*/
var defaultDesktopControls = controlDefaults();
defaultDesktopControls.push(new ScaleLine());
var defaultMobileControls = controlDefaults({
zoom: false
});
this.controls = angular.isDefined(config.mapControls) ? config.mapControls :
!!window.cordova ? defaultMobileControls : defaultDesktopControls;

/**
* @ngdoc property
* @name hs.map.service#interactions
Expand Down

0 comments on commit bde1fd3

Please sign in to comment.