aboutsummaryrefslogtreecommitdiffstats
path: root/view/theme/diabook/js/jquery.mapquery.mqZoomSlider.js
diff options
context:
space:
mode:
authorMichael Vogel <icarus@dabo.de>2012-05-09 14:56:48 +0200
committerMichael Vogel <icarus@dabo.de>2012-05-09 14:56:48 +0200
commitf2e648d62fe7cafb9a55c7505687ea4d1c294778 (patch)
tree07a1b31339ccd871bb4fbfe73e3f0d4911689795 /view/theme/diabook/js/jquery.mapquery.mqZoomSlider.js
parenta3f08c44be78d4517e9f1619811def09b2ec7e7a (diff)
parent53157bb954acb7597347c6b4a87e64e7a2f6cc79 (diff)
downloadvolse-hubzilla-f2e648d62fe7cafb9a55c7505687ea4d1c294778.tar.gz
volse-hubzilla-f2e648d62fe7cafb9a55c7505687ea4d1c294778.tar.bz2
volse-hubzilla-f2e648d62fe7cafb9a55c7505687ea4d1c294778.zip
Merge remote branch 'upstream/master'
Diffstat (limited to 'view/theme/diabook/js/jquery.mapquery.mqZoomSlider.js')
-rw-r--r--view/theme/diabook/js/jquery.mapquery.mqZoomSlider.js85
1 files changed, 85 insertions, 0 deletions
diff --git a/view/theme/diabook/js/jquery.mapquery.mqZoomSlider.js b/view/theme/diabook/js/jquery.mapquery.mqZoomSlider.js
new file mode 100644
index 000000000..ebdce3bf3
--- /dev/null
+++ b/view/theme/diabook/js/jquery.mapquery.mqZoomSlider.js
@@ -0,0 +1,85 @@
+/* Copyright (c) 2011 by MapQuery Contributors (see AUTHORS for
+ * full list of contributors). Published under the MIT license.
+ * See https://github.com/mapquery/mapquery/blob/master/LICENSE for the
+ * full text of the license. */
+
+
+/**
+#jquery.mapquery.mqZoomSlider.js
+The file containing the mqZoomSlider Widget
+
+### *$('selector')*.`mqZoomSlider([options])`
+_version added 0.1_
+####**Description**: create a widget to show a zoom slider
+
+ + **options**:
+ - **map**: the mapquery instance
+
+>Returns: widget
+
+
+The mqZoomSlider widget allows us to display a vertical zoom slider.
+
+
+ $('#zoomslider').mqZoomSlider({
+ map: '#map'
+ });
+
+ */
+(function($) {
+$.template('mqZoomSlider',
+ '<div class="mq-zoomslider ui-widget ui-helper-clearfix ">'+
+ '<div class="mq-zoomslider-slider"></div>'+
+ '</div>');
+
+$.widget("mapQuery.mqZoomSlider", {
+ options: {
+ // The MapQuery instance
+ map: undefined
+
+ },
+ _create: function() {
+ var map;
+ var zoom;
+ var numzoomlevels;
+ var self = this;
+ var element = this.element;
+
+ //get the mapquery object
+ map = $(this.options.map).data('mapQuery');
+
+ $.tmpl('mqZoomSlider').appendTo(element);
+
+ numzoomlevels = map.options.numZoomLevels;
+ $(".mq-zoomslider-slider", element).slider({
+ max: numzoomlevels,
+ min:2,
+ orientation: 'vertical',
+ step: 1,
+ value: numzoomlevels - map.center().zoom,
+ slide: function(event, ui) {
+ map.center({zoom:numzoomlevels-ui.value});
+ },
+ change: function(event, ui) {
+ map.center({zoom:numzoomlevels-ui.value});
+ }
+ });
+ map.bind("zoomend",
+ {widget:self,map:map,control:element},
+ self._onZoomEnd);
+
+ },
+ _destroy: function() {
+ this.element.removeClass(' ui-widget ui-helper-clearfix ' +
+ 'ui-corner-all')
+ .empty();
+ },
+ _zoomEnd: function (element,map) {
+ var slider = element.find('.mq-zoomslider-slider');
+ slider.slider('value',map.options.numZoomLevels-map.center().zoom);
+ },
+ _onZoomEnd: function(evt) {
+ evt.data.widget._zoomEnd(evt.data.control,evt.data.map);
+ }
+});
+})(jQuery); \ No newline at end of file