Skip to content

Commit

Permalink
Merge pull request shramov#16 from Koc/minior-changes
Browse files Browse the repository at this point in the history
Disable all behaviors for Yandex. Some cosmetic changes for Google and Y...
  • Loading branch information
shramov committed Jun 1, 2012
2 parents 29e850c + 92fc9fd commit 2ae017d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
28 changes: 15 additions & 13 deletions layer/tile/Google.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Google layer using Google Maps API
*/
(function (google, L) {

L.Google = L.Class.extend({
includes: L.Mixin.Events,
Expand All @@ -14,14 +15,14 @@ L.Google = L.Class.extend({
attribution: '',
opacity: 1,
continuousWorld: false,
noWrap: false,
noWrap: false
},

// Possible types: SATELLITE, ROADMAP, HYBRID
// Possible types: SATELLITE, ROADMAP, HYBRID, TERRAIN
initialize: function(type, options) {
L.Util.setOptions(this, options);

this._ready = window.google.maps.Map != undefined;
this._ready = google.maps.Map != undefined;
if (!this._ready) L.Google.asyncWait.push(this);

this._type = type || 'SATELLITE';
Expand Down Expand Up @@ -94,11 +95,11 @@ L.Google = L.Class.extend({

_initMapObject: function() {
if (!this._ready) return;
this._google_center = new window.google.maps.LatLng(0, 0);
var map = new window.google.maps.Map(this._container, {
this._google_center = new google.maps.LatLng(0, 0);
var map = new google.maps.Map(this._container, {
center: this._google_center,
zoom: 0,
mapTypeId: window.google.maps.MapTypeId[this._type],
mapTypeId: google.maps.MapTypeId[this._type],
disableDefaultUI: true,
keyboardShortcuts: false,
draggable: false,
Expand All @@ -108,9 +109,9 @@ L.Google = L.Class.extend({
});

var _this = this;
this._reposition = window.google.maps.event.addListenerOnce(map, "center_changed",
this._reposition = google.maps.event.addListenerOnce(map, "center_changed",
function() { _this.onReposition(); });

map.backgroundColor = '#ff0000';
this._google = map;
},
Expand All @@ -130,12 +131,12 @@ L.Google = L.Class.extend({
var bounds = this._map.getBounds();
var ne = bounds.getNorthEast();
var sw = bounds.getSouthWest();
var google_bounds = new window.google.maps.LatLngBounds(
new window.google.maps.LatLng(sw.lat, sw.lng),
new window.google.maps.LatLng(ne.lat, ne.lng)
var google_bounds = new google.maps.LatLngBounds(
new google.maps.LatLng(sw.lat, sw.lng),
new google.maps.LatLng(ne.lat, ne.lng)
);
var center = this._map.getCenter();
var _center = new window.google.maps.LatLng(center.lat, center.lng);
var _center = new google.maps.LatLng(center.lat, center.lng);

this._google.setCenter(_center);
this._google.setZoom(this._map.getZoom());
Expand All @@ -153,7 +154,7 @@ L.Google = L.Class.extend({

onReposition: function() {
if (!this._google) return;
window.google.maps.event.trigger(this._google, "resize");
google.maps.event.trigger(this._google, "resize");
}
});

Expand All @@ -170,3 +171,4 @@ L.Google.asyncInitialize = function() {
}
L.Google.asyncWait = [];
}
})(window.google, L)
10 changes: 6 additions & 4 deletions layer/tile/Yandex.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* L.TileLayer is used for standard xyz-numbered tile layers.
*/
(function (ymaps, L) {

L.Yandex = L.Class.extend({
includes: L.Mixin.Events,
Expand All @@ -10,10 +11,10 @@ L.Yandex = L.Class.extend({
maxZoom: 18,
attribution: '',
opacity: 1,
traffic: false,
traffic: false
},

// Possible types: SATELLITE, ROADMAP, HYBRID
// Possible types: map, satellite, hybrid, publicMap, publicMapHybrid
initialize: function(type, options) {
L.Util.setOptions(this, options);

Expand Down Expand Up @@ -67,7 +68,7 @@ L.Yandex = L.Class.extend({
},

_initContainer: function() {
var tilePane = this._map._container
var tilePane = this._map._container,
first = tilePane.firstChild;

if (!this._container) {
Expand Down Expand Up @@ -106,7 +107,7 @@ L.Yandex = L.Class.extend({
this._initMapObject, this);
}

var map = new ymaps.Map(this._container, {center: [0,0], zoom: 0});
var map = new ymaps.Map(this._container, {center: [0,0], zoom: 0, behaviors: []});

if (this.options.traffic)
map.controls.add(new ymaps.control.TrafficControl({shown: true}));
Expand Down Expand Up @@ -152,3 +153,4 @@ L.Yandex = L.Class.extend({
this._yandex.container.fitToViewport();
}
});
})(ymaps, L)

0 comments on commit 2ae017d

Please sign in to comment.