Sha256: d40c588f04015cd8092c14e5ed890b13c437a282a3bb94c3286bfc3351710967

Contents?: true

Size: 1.33 KB

Versions: 42

Compression:

Stored size: 1.33 KB

Contents

GMaps.prototype.createPanorama = function(streetview_options) {
  if (!streetview_options.hasOwnProperty('lat') || !streetview_options.hasOwnProperty('lng')) {
    streetview_options.lat = this.getCenter().lat();
    streetview_options.lng = this.getCenter().lng();
  }

  this.panorama = GMaps.createPanorama(streetview_options);

  this.map.setStreetView(this.panorama);

  return this.panorama;
};

GMaps.createPanorama = function(options) {
  var el = getElementById(options.el, options.context);

  options.position = new google.maps.LatLng(options.lat, options.lng);

  delete options.el;
  delete options.context;
  delete options.lat;
  delete options.lng;

  var streetview_events = ['closeclick', 'links_changed', 'pano_changed', 'position_changed', 'pov_changed', 'resize', 'visible_changed'],
      streetview_options = extend_object({visible : true}, options);

  for (var i = 0; i < streetview_events.length; i++) {
    delete streetview_options[streetview_events[i]];
  }

  var panorama = new google.maps.StreetViewPanorama(el, streetview_options);

  for (var i = 0; i < streetview_events.length; i++) {
    (function(object, name) {
      if (options[name]) {
        google.maps.event.addListener(object, name, function(){
          options[name].apply(this);
        });
      }
    })(panorama, streetview_events[i]);
  }

  return panorama;
};

Version data entries

42 entries across 42 versions & 2 rubygems

Version Path
wbase-0.3.20 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.19 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.18 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.17 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.16 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.15 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.14 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.13 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.12 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.11 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.10 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.9 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.8 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.7 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.6 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.5 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.4 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.3 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.2 lib/vendor/admin/gmaps/lib/gmaps.streetview.js
wbase-0.3.1 lib/vendor/admin/gmaps/lib/gmaps.streetview.js