From a4ce11f1812683209858bb8efb7821534dc47f74 Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Sat, 18 Jul 2015 19:54:02 +0200 Subject: [PATCH] inverse attributes (a default of true cannot be set to false in html) --- CHANGES.md | 4 +- demo.html | 7 +-- leaflet-control.html | 10 ++-- leaflet-core.html | 130 +++++++++++++++++++++---------------------- leaflet-draw.html | 12 ++-- leaflet-marker.html | 73 ++++++++++++------------ 6 files changed, 118 insertions(+), 118 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 7851573..988d6ee 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,8 @@ v1.1.0 ====== -* add support for styling GeoJson (thanks to Ryan Cooper) +* added support for styling GeoJson layers (thanks to Ryan Cooper) +* renamed attributes on leaflet-map: no-dragging, no-touch-zoom, no-scroll-wheel-zoom, no-double-click-zoom, no-box-zoom, no-tap, no-track-resize, no-close-popup-on-click, no-bounce-at-zoom-limits, no-keyboard, no-inertia, no-zoom-control, no-attribution-control +* renamed attributes on leaflet-marker: no-clickable, no-keyboard v1.0.2 ====== diff --git a/demo.html b/demo.html index 71502e3..e76dfdb 100644 --- a/demo.html +++ b/demo.html @@ -438,18 +438,17 @@

Events

Scale control

-

A scale control can be added and configured using <leaflet-scale-control> By default it displays both -metric and imperial units.

+

A scale control can be added and configured using <leaflet-scale-control>. By default it displays both metric and imperial units.

- +

 <leaflet-map latitude="51.505" longitude="-0.09" zoom="13">
 
-    <leaflet-scale-control position="topright" metric="true">
+    <leaflet-scale-control position="topright" metric imperial>
     </leaflet-scale-control>
 
 </leaflet-map>
diff --git a/leaflet-control.html b/leaflet-control.html
index 6e4e431..6f0f39b 100644
--- a/leaflet-control.html
+++ b/leaflet-control.html
@@ -62,18 +62,18 @@
 			 */
 			metric: {
 				type: Boolean,
-				value: true
+				value: false
 			},
 	
 			/**
-			 * The `imperial` attribute sets whether show the imperial scale line (mi/ft).
+			 * The `imperial` attribute sets whether to show the imperial scale line (mi/ft).
 			 * 
 			 * @attribute imperial 
 			 * @type boolean
 			 */
 			imperial: {
 				type: Boolean,
-				value: true
+				value: false
 			},
 	
 			/**
@@ -98,8 +98,8 @@
 				var control = L.control.scale({
 					 position: this.position,
 					 maxWidth: this.maxWidth,
-					 metric: this.metric,
-					 imperial: this.imperial,
+					 metric: this.metric || !this.imperial,
+					 imperial: this.imperial || !this.metric,
 					 updateWhenIdle: this.updateWhenIdle,
 				});
 				this.control = control;
diff --git a/leaflet-core.html b/leaflet-core.html
index 54555aa..a2fa79f 100644
--- a/leaflet-core.html
+++ b/leaflet-core.html
@@ -386,69 +386,69 @@
 			},
 
 			/**
-			 * The `dragging` attribute sets whether  when he tries to pan outside the view.
+			 * The `no-dragging` attribute disables whether the map is draggable with mouse/touch or not.
 			 *
-			 * @attribute dragging
+			 * @attribute no-dragging
 			 * @type bool
 			 */
-			dragging: {
+			noDragging: {
 		    	 type: Boolean,
-		    	 value: true
+		    	 value: false
 			},
 
 			/**
-			 * The `touch-zoom` attribute sets whether the map can be zoomed by touch-dragging with two fingers.
+			 * The `no-touch-zoom` attribute disables whether the map can be zoomed by touch-dragging with two fingers.
 			 *
-			 * @attribute touch-zoom
+			 * @attribute no-touch-zoom
 			 * @type bool
 			 */
-			touchZoom: {
+			noTouchZoom: {
 		    	 type: Boolean,
-		    	 value: true
+		    	 value: false
 			},
 
 			/**
-			 * The `scrollWheelZoom` attribute sets the whether the map can be zoomed by using the mouse wheel. If passed 'center', it will zoom to the center of the view regardless of where the mouse was.
+			 * The `no-scroll-wheel-zoom` attribute disables whether the map can be zoomed by using the mouse wheel. If passed 'center', it will zoom to the center of the view regardless of where the mouse was.
 			 *
-			 * @attribute scroll-wheel-zoom
+			 * @attribute no-scroll-wheel-zoom
 			 * @type bool
 			 */
-			scrollWheelZoom: {
+			noScrollWheelZoom: {
 		    	 type: Boolean,
-		    	 value: true
+		    	 value: false
 			},
 
 			/**
-			 * The `double-click-zoom` attribute sets the whether the map can be zoomed in by double clicking on it and zoomed out by double clicking while holding shift. If passed 'center', double-click zoom will zoom to the center of the view regardless of where the mouse was.
+			 * The `no-double-click-zoom` attribute disables the whether the map can be zoomed in by double clicking on it and zoomed out by double clicking while holding shift. If passed 'center', double-click zoom will zoom to the center of the view regardless of where the mouse was.
 			 *
-			 * @attribute double-click-zoom
+			 * @attribute no-double-click-zoom
 			 * @type bool
 			 */
-			doubleClickZoom: {
+			noDoubleClickZoom: {
 		    	 type: Boolean,
-		    	 value: true
+		    	 value: false
 			},
 
 			/**
-			 * The `box-zoom` attribute sets the whether the map can be zoomed to a rectangular area specified by dragging the mouse while pressing shift.
+			 * The `no-box-zoom` attribute disable the whether the map can be zoomed to a rectangular area specified by dragging the mouse while pressing shift.
 			 *
-			 * @attribute box-zoom
+			 * @attribute no-box-zoom
 			 * @type bool
 			 */
-			boxZoom: {
+			noBoxZoom: {
 		    	 type: Boolean,
-		    	 value: true
+		    	 value: false
 			},
 
 			/**
-			 * The `tap` attribute enables mobile hacks for supporting instant taps (fixing 200ms click delay on iOS/Android) and touch holds (fired as contextmenu events).
+			 * The `no-tap` attribute disables mobile hacks for supporting instant taps (fixing 200ms click delay on iOS/Android) and touch holds (fired as contextmenu events).
 			 *
-			 * @attribute tap
+			 * @attribute no-tap
 			 * @type bool
 			 */
-			tap: {
+			noTap: {
 		    	 type: Boolean,
-		    	 value: true
+		    	 value: false
 			},
 
 			/**
@@ -463,14 +463,14 @@
 			},
 
 			/**
-			 * The `track-resize` attribute sets whether the map automatically handles browser window resize to update itself.
+			 * The `no-track-resize` attribute disables whether the map automatically handles browser window resize to update itself.
 			 *
-			 * @attribute track-resize
+			 * @attribute no-track-resize
 			 * @type bool
 			 */
-			trackResize: {
+			noTrackResize: {
 		    	 type: Boolean,
-		    	 value: true
+		    	 value: false
 			},
 
 			/**
@@ -485,36 +485,36 @@
 			},
 
 			/**
-			 * The `close-popup-on-click` attribute sets whether popups are closed when user clicks the map.
+			 * The `no-close-popup-on-click` attribute disables whether popups are closed when user clicks the map.
 			 *
-			 * @attribute close-popup-on-click
+			 * @attribute no-close-popup-on-click
 			 * @type bool
 			 */
-			closePopupOnClick: {
+			noClosePopupOnClick: {
 		    	 type: Boolean,
-		    	 value: true
+		    	 value: false
 			},
 
 			/**
-			 * The `bounce-at-zoom-limits` attribute sets whether the map to zoom beyond min/max zoom and then bounce back when pinch-zooming.
+			 * The `no-bounce-at-zoom-limits` attribute disables whether the map to zoom beyond min/max zoom and then bounce back when pinch-zooming.
 			 *
-			 * @attribute bounce-at-zoom-limits
+			 * @attribute no-bounce-at-zoom-limits
 			 * @type bool
 			 */
-			bounceAtZoomLimits: {
+			noBounceAtZoomLimits: {
 		    	 type: Boolean,
-		    	 value: true
+		    	 value: false
 			},
 
 			/**
-			 * The `keyboard` attribute sets whether the map is focusable and allows users to navigate the map with keyboard arrows and +/- keys.
+			 * The `no-keyboard` attribute disables whether the map is focusable and allows users to navigate the map with keyboard arrows and +/- keys.
 			 *
-			 * @attribute keyboard
+			 * @attribute no-keyboard
 			 * @type bool
 			 */
-			keyboard: {
+			noKeyboard: {
 		    	 type: Boolean,
-		    	 value: true
+		    	 value: false
 			},
 
 			/**
@@ -540,14 +540,14 @@
 			},
 
 			/**
-			 * The `inertia` attribute sets whether panning of the map will have an inertia effect where the map builds momentum while dragging and continues moving in the same direction for some time. Feels especially nice on touch devices.
+			 * The `no-inertia` attribute disables panning of the map will have an inertia effect where the map builds momentum while dragging and continues moving in the same direction for some time. Feels especially nice on touch devices.
 			 *
-			 * @attribute inertia
+			 * @attribute no-inertia
 			 * @type
 			 */
-			inertia: {
+			noInertia: {
 		    	 type: Boolean,
-		    	 value: true
+		    	 value: false
 			},
 
 			/**
@@ -570,25 +570,25 @@
 			},
 
 			/**
-			 * The `zoom-control` attribute sets whether the zoom control is added to the map by default.
+			 * The `no-zoom-control` attribute disables the zoom control is added to the map by default.
 			 *
-			 * @attribute zoom-control
+			 * @attribute no-zoom-control
 			 * @type bool
 			 */
-			zoomControl: {
+			noZoomControl: {
 		    	 type: Boolean,
-		    	 value: true
+		    	 value: false
 			},
 
 			/**
-			 * The `attribution-control` attribute sets whether the attribution control is added to the map by default.
+			 * The `no-attribution-control` attribute disable the attribution control is added to the map by default.
 			 *
-			 * @attribute attribution-control
+			 * @attribute no-attribution-control
 			 * @type bool
 			 */
-			attributionControl: {
+			noAttributionControl: {
 		    	 type: Boolean,
-		    	 value: true
+		    	 value: false
 			},
 
 			/**
@@ -659,25 +659,25 @@
 				zoom: this.zoom,
 				minZoom: this.minZoom,
 				maxZoom: this.maxZoom,
-				dragging: this.dragging,
-				touchZoom: this.touchZoom,
-				scrollWheelZoom: this.scrollWheelZoom,
-				doubleClickZoom: this.doubleClickZoom,
-				boxZoom: this.boxZoom,
-				tap: this.tap,
+				dragging: !this.noDragging,
+				touchZoom: !this.noTouchZoom,
+				scrollWheelZoom: !this.noScrollWheelZoom,
+				doubleClickZoom: !this.noDoubleClickZoom,
+				boxZoom: !this.noBoxZoom,
+				tap: !this.noTap,
 				tapTolerance: this.tapTolerance,
-				trackResize: this.trackResize,
+				trackResize: !this.noTrackResize,
 				worldCopyJump: this.worldCopyJump,
-				closePopupOnClick: this.closePopupOnClick,
-				bounceAtZoomLimits: this.bounceAtZoomLimits,
-				keyboard: this.keyboard,
+				closePopupOnClick: !this.noClosePopupOnClick,
+				bounceAtZoomLimits: !this.noBounceAtZoomLimits,
+				keyboard: !this.noKeyboard,
 				keyboardPanOffset: this.keyboardPanOffset,
 				keyboardZoomOffset: this.keyboardZoomOffset,
-				inertia: this.inertia,
+				inertia: !this.noInertia,
 				inertiaDeceleration: this.inertiaDeceleration,
 				inertiaMaxSpeed: this.inertiaMaxSpeed,
-				zoomControl: this.zoomControl,
-				attributionControl: this.attributionControl,
+				zoomControl: !this.noZoomControl,
+				attributionControl: !this.noAttributionControl,
 				zoomAnimationThreshold: this.zoomAnimationThreshold
 			});
 			this.map = map;
diff --git a/leaflet-draw.html b/leaflet-draw.html
index da906de..e25f513 100644
--- a/leaflet-draw.html
+++ b/leaflet-draw.html
@@ -115,9 +115,9 @@
 			 * @attribute stroke
 			 * @type boolean
 			 */
-			stroke: {
+			noStroke: {
 				type: Boolean,
-				value: true
+				value: false
 			},
 
 			/**
@@ -225,9 +225,9 @@
 			 * @attribute clickable
 			 * @type boolean
 			 */
-			clickable: {
+			noClickable: {
 				type: Boolean,
-				value: true
+				value: false
 			},
 
 			/**
@@ -255,7 +255,7 @@
 
 		getPathOptions: function() {
 			return {
-				stroke: this.stroke,
+				stroke: !this.noStroke,
 				color: this.color,
 				weight: this.weight,
 				opacity: this.opacity,
@@ -265,7 +265,7 @@
 				dashArray: this.dashArray,
 				lineCap: this.lineCap,
 				lineJoin: this.lineJoin,
-				clickable: this.clickable,
+				clickable: !this.noClickable,
 				pointerEvents: this.pointerEvents,
 				className: this.className,
 			};
diff --git a/leaflet-marker.html b/leaflet-marker.html
index 144cff7..ffb5fd4 100644
--- a/leaflet-marker.html
+++ b/leaflet-marker.html
@@ -26,9 +26,9 @@
 
 	Polymer({
 		is: 'leaflet-icon',
-		
+
 		properties: {
-	
+
 			/**
 			 * The `icon-url` attribute sets the URL to the icon image (absolute or relative to your script path).
 			 * 
@@ -50,7 +50,7 @@
 				type: String,
 				observer: '_attributeChanged'
 			},
-	
+
 			/**
 			 * The `icon-width` attribute sets the size of the icon image in pixels. 
 			 * 
@@ -61,7 +61,7 @@
 				type: Number,
 				observer: '_attributeChanged'
 			},
-	
+
 			/**
 			 * The `icon-height` attribute sets the size of the icon image in pixels.
 			 * 
@@ -72,7 +72,7 @@
 				type: Number,
 				observer: '_attributeChanged'
 			},
-	
+
 			/**
 			 * The `icon-anchor-x` attribute sets the coordinates of the "tip" of the icon (relative to its top left corner). The icon will be aligned so that this point is at the marker's geographical location. Centered by default if size is specified, also can be set in CSS with negative margins.
 			 * 
@@ -83,7 +83,7 @@
 				type: Number,
 				observer: '_attributeChanged'
 			},
-	
+
 			/**
 			 * The `icon-anchor-y` attribute sets the coordinates of the "tip" of the icon (relative to its top left corner). The icon will be aligned so that this point is at the marker's geographical location. Centered by default if size is specified, also can be set in CSS with negative margins.
 			 * 
@@ -94,7 +94,7 @@
 				type: Number,
 				observer: '_attributeChanged'
 			},
-	
+
 			/**
 			 * The `shadow-url` attribute sets the URL to the icon shadow image. If not specified, no shadow image will be created.
 			 * 
@@ -105,7 +105,7 @@
 				type: String,
 				observer: '_attributeChanged'
 			},
-	
+
 			/**
 			 * The `shadow-retina-url` attribute sets the URL to the retina sized version of the icon shadow image. If not specified, no shadow image will be created. Used for Retina screen devices.
 			 * 
@@ -116,7 +116,7 @@
 				type: String,
 				observer: '_attributeChanged'
 			},
-	
+
 			/**
 			 * The `shadow-width` attribute sets the size of the shadow image in pixels.
 			 * 
@@ -127,7 +127,7 @@
 				type: Number,
 				observer: '_attributeChanged'
 			},
-	
+
 			/**
 			 * The `shadow-height` attribute sets the size of the shadow image in pixels.
 			 * 
@@ -138,7 +138,7 @@
 				type: Number,
 				observer: '_attributeChanged'
 			},
-	
+
 			/**
 			 * The `shadow-anchor-x` attribute sets the coordinates of the "tip" of the shadow (relative to its top left corner) (the same as iconAnchor if not specified).
 			 * 
@@ -149,7 +149,7 @@
 				type: Number,
 				observer: '_attributeChanged'
 			},
-	
+
 			/**
 			 * The `shadow-anchor-y` attribute sets the coordinates of the "tip" of the shadow (relative to its top left corner) (the same as iconAnchor if not specified).
 			 * 
@@ -160,7 +160,7 @@
 				type: Number,
 				observer: '_attributeChanged'
 			},
-	
+
 			/**
 			 * The `popup-anchor-x` attribute sets the coordinates of the point from which popups will "open", relative to the icon anchor.
 			 * 
@@ -171,7 +171,7 @@
 				type: Number,
 				observer: '_attributeChanged'
 			},
-	
+
 			/**
 			 * The `popupanchory` attribute sets the coordinates of the point from which popups will "open", relative to the icon anchor.
 			 * 
@@ -183,7 +183,7 @@
 				observer: '_attributeChanged'
 			},
 
-	
+
 			/**
 			 * The `class-name` attribute sets a custom class name to assign to both icon and shadow images. Empty by default.
 			 * 
@@ -557,16 +557,16 @@
 			},
 
 			/**
-			 * If `clickable` attribute is set to false, the marker will not emit mouse events and will act as a part of the underlying map.
+			 * The `no-clickable` disables emitting mouse events and will act as a part of the underlying map.
 			 * 
-			 * @attribute clickable
+			 * @attribute no-clickable
 			 * @type bool
 			 */
-			clickable: {
+			noClickable: {
 				type: Boolean,
-				value: true
+				value: false
 			},
-	
+
 			/**
 			 * The `draggable` attribute sets the whether the marker is draggable with mouse/touch or not.
 			 * 
@@ -577,18 +577,18 @@
 				type: Boolean,
 				value: false
 			},
-	
+
 			/**
-			 * The `keyboard` attribute sets the whether the marker is draggable with mouse/touch or not.
+			 * The `no-keyboard` attribute disables whether the marker can be tabbed to with a keyboard and clicked by pressing enter.
 			 * 
-			 * @attribute draggable
+			 * @attribute no-keyboard
 			 * @type bool
 			 */
-			keyboard: {
+			noKeyboard: {
 				type: Boolean,
-				value: true
+				value: false
 			},
-	
+
 			/**
 			 * The `title` attribute sets the text for the browser tooltip that appear on marker hover (no tooltip by default).
 			 * 
@@ -599,7 +599,7 @@
 				type: String,
 				value: ''
 			},
-	
+
 			/**
 			 * The `alt` attribute sets the text for the alt attribute of the icon image (useful for accessibility).
 			 * 
@@ -610,7 +610,7 @@
 				type: String,
 				value: ''
 			},
-	
+
 			/**
 			 * The `z-index-offset` attribute sets the zIndexOffset. By default, marker images zIndex is set automatically based on its latitude
 			 * 
@@ -622,7 +622,7 @@
 				value: 0,
 				observer: '_zIndexOffsetChanged'
 			},
-	
+
 			/**
 			 * The `opacity` attribute sets the opacity of the marker.
 			 * 
@@ -634,7 +634,7 @@
 				value: 1.0,
 				observer: '_opacityChanged'
 			},
-	
+
 			/**
 			 * The `rise-on-hover` attribute sets the whether the marker will get on top of others when you hover the mouse over it. 
 			 * 
@@ -645,7 +645,7 @@
 				type: Boolean,
 				value: false
 			},
-	
+
 			/**
 			 * The `rise-offset` attribute sets the z-index offset used for the riseOnHover feature.
 			 * 
@@ -656,7 +656,7 @@
 				type: Number,
 				value: 250
 			},
-			
+
 			container: {
 				type: Object,
 				observer: '_containerChanged'
@@ -664,16 +664,16 @@
 		},
 
 		feature: undefined,
-		
+
 		observer_: undefined,
 
 		_containerChanged: function() {
 			if (this.container) {
 
 				var feature = L.marker([this.latitude, this.longitude], {
-					clickable: this.clickable,
+					clickable: !this.noClickable,
 					draggable: this.draggable,
-					keyboard: this.keyboard,
+					keyboard: !this.noKeyboard,
 					title: this.title,
 					alt: this.alt,
 					zIndexOffset: this.zIndexOffset,
@@ -745,7 +745,7 @@
 				this.feature.setOpacity(this.opacity);
 			}
 		},
-		
+
 		detached: function() {
 			if (this.container && this.feature) {
 				this.container.removeLayer(this.feature);
@@ -755,4 +755,3 @@
 	});
 	
 
-