Skip to content

Commit

Permalink
Version 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
psthmn committed Jul 23, 2015
2 parents 8b991bd + 7405675 commit 839f43e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 43 deletions.
61 changes: 37 additions & 24 deletions jquery.ddYMap.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
/**
* jQuery ddYMap Plugin
* @version 1.3.1 (2014-07-24)
* @version 1.4 (2015-07-23)
*
* @desc A jQuery library that allows Yandex.Maps to be rendered on a page in a simple way.
*
* @uses jQuery 1.10.2.
* @uses Yandex.Maps 2.1.
* @requires jQuery 1.10.2.
* @requires Yandex.Maps 2.1.
*
* Parameters of the “$.fn.ddYMap” method (transferred as plain object).
* @param placemarks {array} - Array of placemarks to be put on the map. If there is more than one placemark, the map will be scaled to make all the placemarks visible. Also, a pair of coordinates still can be passed (like it was in 1.2 and earlier). @required
* @param placemarks[i] {plain object} - Placemark data. @required
* @param placemarks[i].latLng {array} - Placemark coordinates (latitude and longitude). @required
* @param placemarks[i].content {string: html} - Balloon content. Default: ''.
* @param defaultZoom {integer} - Default map zoom. Default: 15.
* @param defaultType {'map'; 'satellite'; 'hybrid'; 'publicMap'; 'publicMapHybrid'} - Default map type: 'map' — schematic map, 'satellite' — satellite map, 'hybrid' — hybrid map, 'publicMap' — public map, 'publicMapHybrid' - hybrid public map. Default: 'map';
* @param scrollZoom {boolean} - Allow zoom while scrolling. Default: false.
* @param mapCenterOffset {array} - Center offset of the map with respect to the center of the map container in pixels. Default: [0, 0].
* @param placemarkOptions {plain object} - Placemark options. Default: {}.
* @param placemarks {Array} - Array of placemarks to be put on the map. If there is more than one placemark, the map will be scaled to make all the placemarks visible. Also, a pair of coordinates still can be passed (like it was in 1.2 and earlier). @required
* @param placemarks[i] {Object} - Placemark data. @required
* @param placemarks[i].latLng {Array} - Placemark coordinates (latitude and longitude). @required
* @param [placemarks[i].content=''] {string} - Balloon content.
* @param [defaultZoom=15] {number} - Default map zoom.
* @param [defaultType='map'] {'map'|'satellite'|'hybrid'|'publicMap'|'publicMapHybrid'} - Default map type: 'map' — schematic map, 'satellite' — satellite map, 'hybrid' — hybrid map, 'publicMap' — public map, 'publicMapHybrid' - hybrid public map.
* @param [scrollZoom=false] {boolean} - Allow zoom while scrolling.
* @param [mapCenterOffset=[0, 0]] {Array} - Center offset of the map with respect to the center of the map container in pixels.
* @param [placemarkOptions={}] {Object} - Placemark options.
* @param [controls=[{name: 'zoomControl'},{name: 'typeSelector'},{name: 'fullscreenControl'},{name: 'geolocationControl'},{name: 'rulerControl'}]] {Object} - An array of controls to be added onto the map.
* @param [mapOptions={suppressMapOpenBlock: true}] {Object} - Represents yandex map options to be passed to the constructor.
*
* @link http://code.divandesign.biz/jquery/ddymap/1.3.1
* @link http://code.divandesign.biz/jquery/ddymap/1.4
*
* @copyright 2014, DivanDesign
* @copyright 2015, DivanDesign
* http://www.DivanDesign.biz
*/

Expand All @@ -33,7 +35,17 @@ $.extend(true, {ddYMap: {
defaultType: 'map',
scrollZoom: false,
mapCenterOffset: false,
placemarkOptions: {}
placemarkOptions: {},
controls: [
{name: 'zoomControl'},
{name: 'typeSelector'},
{name: 'fullscreenControl'},
{name: 'geolocationControl'},
{name: 'rulerControl'}
],
mapOptions: {
suppressMapOpenBlock: true
}
},
//TODO: перенести метод в $.ddTools
verifyRenamedParams: function(params, compliance){
Expand Down Expand Up @@ -122,16 +134,17 @@ $.extend(true, {ddYMap: {
zoom: params.defaultZoom,
type: 'yandex#' + params.defaultType,
controls: []
});
}, params.mapOptions);

//Добавляем контролы
map.controls
.add('zoomControl')
.add('typeSelector')
.add('fullscreenControl')
.add('geolocationControl')
//Почему-то именно с этим контролом float: left не работает, может это временно.
.add('rulerControl', {float: 'left'});
//Если заданы котролы
if($.isArray(params.controls)){
$.each(params.controls, function(index, control){
if(control.name){
//Добавляем их
map.controls.add(control.name, control.options);
}
});
}

//Если зум не нужен
if (!params.scrollZoom){
Expand Down
40 changes: 21 additions & 19 deletions jquery.ddYMap.min.js

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

0 comments on commit 839f43e

Please sign in to comment.