Skip to content

Commit

Permalink
Adds behavior support.
Browse files Browse the repository at this point in the history
As in older versions of jhere, it is now possible
to switch on and off the map behavior (zoom and drag).
  • Loading branch information
mmarcon committed Nov 22, 2015
1 parent 337a34b commit 4fecf30
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 12 deletions.
10 changes: 9 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,15 @@ module.exports = function(grunt) {
},
{
from: '../dist/jhere.js',
to: 'https://cdn.rawgit.com/mmarcon/jhere/jsla3/dist/jhere.js'
to: 'https://cdn.rawgit.com/mmarcon/jhere/jsla3/dist/jhere.min.js'
},
{
from: '../out/jhere.min.js',
to: 'https://cdn.rawgit.com/mmarcon/jhere/jsla3/dist/jhere.min.js'
},
{
from: '../out/jhere.js',
to: 'https://cdn.rawgit.com/mmarcon/jhere/jsla3/dist/jhere.min.js'
}]
}
}
Expand Down
11 changes: 7 additions & 4 deletions dist/jhere.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
* app_code: 'your_app_code'
* zoom: 14,
* center: {lat: 52.5, lng: 13.3,
* enable: ['zoombar', 'scalebar', 'settings']
* enable: ['zoombar', 'scalebar', 'settings', 'behavior']
* }});
*
* @link https://developer.here.com/myapps
Expand Down Expand Up @@ -270,9 +270,12 @@
if (! ~enabled.indexOf('settings')) {
self.ui.getControl('mapsettings').setVisibility(false);
}
if (~enabled.indexOf('behavior')) {
//TODO: consider more granulr control over behavior
//{enabled: Behavior.DRAGGING | Behavior.WHEELZOOM | Behavior.DBLTAPZOOM}
new Behavior(new H.mapevents.MapEvents(self.map));
}

//TODO: look at the options {enabled: Behavior.DRAGGING, Behavior.WHEELZOOM, Behavior.DBLTAPZOOM}
new Behavior(new H.mapevents.MapEvents(self.map));
self.mc = new H.map.Group();
self.map.addObject(self.mc);
};
Expand Down Expand Up @@ -676,7 +679,7 @@
zoom: 12,
center: { lat: 52.49, lng: 13.37 },
type: 'map',
enable: ['zoombar', 'scalebar', 'settings']
enable: ['zoombar', 'scalebar', 'settings', 'behavior']
};

exports.defaults = defaults;
Expand Down
2 changes: 1 addition & 1 deletion dist/jhere.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified dist/jhere.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div id="map" class="map"></div>
<div id="other_map" class="map"></div>

<script src="../dist/jhere.min.js"></script>
<script src="../out/jhere.js"></script>
<script>
/* globals jHERE: true */
var map = jHERE(document.querySelector('#map'), {zoom: 14, center: {lat: 52.5, lng: 18.3}})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jHERE",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"description": "Maps made easy.",
"main": "index.js",
"directories": {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const defaults = {
zoom: 12,
center: {lat: 52.49, lng: 13.37},
type: 'map',
enable: ['zoombar', 'scalebar', 'settings']
enable: ['zoombar', 'scalebar', 'settings', 'behavior']
};

const pointer = 'pointer';
Expand Down
9 changes: 6 additions & 3 deletions src/modules/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const d = document;
* app_code: 'your_app_code'
* zoom: 14,
* center: {lat: 52.5, lng: 13.3,
* enable: ['zoombar', 'scalebar', 'settings']
* enable: ['zoombar', 'scalebar', 'settings', 'behavior']
* }});
*
* @link https://developer.here.com/myapps
Expand Down Expand Up @@ -102,9 +102,12 @@ JH._makemap = function(){
if(!~enabled.indexOf('settings')) {
self.ui.getControl('mapsettings').setVisibility(false);
}
if(~enabled.indexOf('behavior')) {
//TODO: consider more granulr control over behavior
//{enabled: Behavior.DRAGGING | Behavior.WHEELZOOM | Behavior.DBLTAPZOOM}
new Behavior(new H.mapevents.MapEvents(self.map));
}

//TODO: look at the options {enabled: Behavior.DRAGGING, Behavior.WHEELZOOM, Behavior.DBLTAPZOOM}
new Behavior(new H.mapevents.MapEvents(self.map));
self.mc = new H.map.Group();
self.map.addObject(self.mc);
};
Expand Down

0 comments on commit 4fecf30

Please sign in to comment.