Jonas Kress (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/276509
Change subject: Add box zoom plugin ...................................................................... Add box zoom plugin Change-Id: I875d62dd7b5550ffa6cfa82ee56ba89bbec3652f --- M index.html A vendor/leaflet/addon/boxzoom/L.Control.ZoomBox.css A vendor/leaflet/addon/boxzoom/L.Control.ZoomBox.min.js M wikibase/queryService/ui/resultBrowser/CoordinateResultBrowser.js 4 files changed, 15 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui refs/changes/09/276509/1 diff --git a/index.html b/index.html index db4195e..0940a9f 100644 --- a/index.html +++ b/index.html @@ -15,6 +15,7 @@ <link rel="stylesheet" href="vendor/lightbox/ekko-lightbox.min.css"> <link rel="stylesheet" href="vendor/leaflet/leaflet.css"> <link rel="stylesheet" href="vendor/leaflet/addon/fullscreen/leaflet.fullscreen.css"> + <link rel="stylesheet" href="vendor/leaflet/addon/boxzoom/L.Control.ZoomBox.css"> <link rel="stylesheet" href="style.css"> <link rel="shortcut icon" href="//www.wikidata.org/static/favicon/testwikidata.ico"> @@ -193,6 +194,7 @@ <script src="vendor/lightbox/ekko-lightbox.min.js"></script> <script src="vendor/leaflet/leaflet.js"></script> <script src="vendor/leaflet/addon/fullscreen/Leaflet.fullscreen.min.js"></script> + <script src="vendor/leaflet/addon/boxzoom/L.Control.ZoomBox.min.js"></script> <script src="wikibase/codemirror/addon/tooltip/WikibaseRDFTooltip.js"></script> diff --git a/vendor/leaflet/addon/boxzoom/L.Control.ZoomBox.css b/vendor/leaflet/addon/boxzoom/L.Control.ZoomBox.css new file mode 100644 index 0000000..5867923 --- /dev/null +++ b/vendor/leaflet/addon/boxzoom/L.Control.ZoomBox.css @@ -0,0 +1,10 @@ +.leaflet-zoom-box-control { + font-size: 18px; + } +.leaflet-zoom-box-control.active a { + color: #FFF; + background: #666; +} +.leaflet-zoom-box-crosshair { + cursor: crosshair !important; +} \ No newline at end of file diff --git a/vendor/leaflet/addon/boxzoom/L.Control.ZoomBox.min.js b/vendor/leaflet/addon/boxzoom/L.Control.ZoomBox.min.js new file mode 100644 index 0000000..feb14e4 --- /dev/null +++ b/vendor/leaflet/addon/boxzoom/L.Control.ZoomBox.min.js @@ -0,0 +1 @@ +L.Control.ZoomBox=L.Control.extend({_active:false,_map:null,includes:L.Mixin.Events,options:{position:"topleft",className:"fa fa-crop",modal:false},onAdd:function(map){this._map=map;this._container=L.DomUtil.create("div","leaflet-zoom-box-control leaflet-bar");this._container.title="Zoom to specific area";var link=L.DomUtil.create("a",this.options.className,this._container);link.href="#";var _origMouseDown=map.boxZoom._onMouseDown;map.boxZoom._onMouseDown=function(e){_origMouseDown.call(map.boxZoom,{clientX:e.clientX,clientY:e.clientY,which:1,shiftKey:true})};map.on("zoomend",function(){if(map.getZoom()==map.getMaxZoom()){L.DomUtil.addClass(link,"leaflet-disabled")}else{L.DomUtil.removeClass(link,"leaflet-disabled")}},this);if(!this.options.modal){map.on("boxzoomend",this.deactivate,this)}L.DomEvent.on(this._container,"dblclick",L.DomEvent.stop).on(this._container,"click",L.DomEvent.stop).on(this._container,"click",function(){this._active=!this._active;if(this._active&&map.getZoom()!=map.getMaxZoom()){this.activate()}else{this.deactivate()}},this);return this._container},activate:function(){L.DomUtil.addClass(this._container,"active");this._map.dragging.disable();this._map.boxZoom.addHooks();L.DomUtil.addClass(this._map.getContainer(),"leaflet-zoom-box-crosshair")},deactivate:function(){L.DomUtil.removeClass(this._container,"active");this._map.dragging.enable();this._map.boxZoom.removeHooks();L.DomUtil.removeClass(this._map.getContainer(),"leaflet-zoom-box-crosshair");this._active=false;this._map.boxZoom._moved=false}});L.control.zoomBox=function(options){return new L.Control.ZoomBox(options)}; \ No newline at end of file diff --git a/wikibase/queryService/ui/resultBrowser/CoordinateResultBrowser.js b/wikibase/queryService/ui/resultBrowser/CoordinateResultBrowser.js index ef8b231..8e3dcc8 100644 --- a/wikibase/queryService/ui/resultBrowser/CoordinateResultBrowser.js +++ b/wikibase/queryService/ui/resultBrowser/CoordinateResultBrowser.js @@ -56,6 +56,8 @@ this._setTileLayer( map ); + + map.addControl( L.control.zoomBox( { modal: false, className: "glyphicon glyphicon-zoom-in" } ) ); map.addControl( new ScrollToTopButton() ); markerGroup.addTo( map ); -- To view, visit https://gerrit.wikimedia.org/r/276509 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I875d62dd7b5550ffa6cfa82ee56ba89bbec3652f Gerrit-PatchSet: 1 Gerrit-Project: wikidata/query/gui Gerrit-Branch: master Gerrit-Owner: Jonas Kress (WMDE) <jonas.kr...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits