From 8f5907efc71445ae6cae12ed5fcda44277ff4c29 Mon Sep 17 00:00:00 2001 From: Xiaoji Chen Date: Fri, 20 Oct 2017 12:57:24 -0700 Subject: [PATCH] update docs --- bundle.js | 2 +- docs/advanced/custom-map-controls.md | 55 ++++++++++++++++++++++------ docs/whats-new.md | 14 ++++++- 3 files changed, 57 insertions(+), 14 deletions(-) diff --git a/bundle.js b/bundle.js index 8d10a274..28051359 100644 --- a/bundle.js +++ b/bundle.js @@ -23,7 +23,7 @@ function r(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n * @internal * @license Modernizr 3.0.0pre (Custom Build) | MIT */ -function r(e,t){if(!o.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var a=document.createElement("div");a.setAttribute(n,"return;"),r="function"==typeof a[n]}return!r&&i&&"wheel"===e&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var i,o=n(10);o.canUseDOM&&(i=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("","")),e.exports=r},function(e,t,n){"use strict";function r(e,t){var n=null===e||!1===e,r=null===t||!1===t;if(n||r)return n===r;var i=typeof e,o=typeof t;return"string"===i||"number"===i?"string"===o||"number"===o:"object"===o&&e.type===t.type&&e.key===t.key}e.exports=r},function(e,t,n){"use strict";var r=(n(4),n(12)),i=(n(2),r);e.exports=i},function(e,t,n){"use strict";function r(e,t,n){function r(){if(a=!0,s)return void(c=[].concat(Array.prototype.slice.call(arguments)));n.apply(this,arguments)}function i(){if(!a&&(l=!0,!s)){for(s=!0;!a&&o=e&&l&&(a=!0,n())}}var o=0,a=!1,s=!1,l=!1,c=void 0;i()}function i(e,t,n){function r(e,t,r){a||(t?(a=!0,n(t)):(o[e]=r,(a=++s===i)&&n(null,o)))}var i=e.length,o=[];if(0===i)return n(null,o);var a=!1,s=0;e.forEach(function(e,n){t(e,n,function(e,t){r(n,e,t)})})}t.__esModule=!0,t.loopAsync=r,t.mapAsync=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.router=t.routes=t.route=t.components=t.component=t.location=t.history=t.falsy=t.locationShape=t.routerShape=void 0;var i=n(0),o=n(95),a=(r(o),n(39)),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(a),l=n(8),c=(r(l),i.PropTypes.func),u=i.PropTypes.object,p=i.PropTypes.shape,d=i.PropTypes.string,f=t.routerShape=p({push:c.isRequired,replace:c.isRequired,go:c.isRequired,goBack:c.isRequired,goForward:c.isRequired,setRouteLeaveHook:c.isRequired,isActive:c.isRequired}),m=t.locationShape=p({pathname:d.isRequired,search:d.isRequired,state:u,action:d.isRequired,key:d}),h=t.falsy=s.falsy,g=t.history=s.history,v=t.location=m,_=t.component=s.component,y=t.components=s.components,b=t.route=s.route,x=(t.routes=s.routes,t.router=f),w={falsy:h,history:g,location:v,component:_,components:y,route:b,router:x};t.default=w},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function o(e,t){function n(t){var n=!(arguments.length<=1||void 0===arguments[1])&&arguments[1],r=arguments.length<=2||void 0===arguments[2]?null:arguments[2],i=void 0;return n&&!0!==n||null!==r?(t={pathname:t,query:n},i=r||!1):(t=e.createLocation(t),i=n),(0,d.default)(t,i,y.location,y.routes,y.params)}function r(e,n){b&&b.location===e?o(b,n):(0,g.default)(t,e,function(t,r){t?n(t):r?o(a({},r,{location:e}),n):n()})}function o(e,t){function n(n,i){if(n||i)return r(n,i);(0,m.default)(e,function(n,r){n?t(n):t(null,null,y=a({},e,{components:r}))})}function r(e,n){e?t(e):t(null,n)}var i=(0,c.default)(y,e),o=i.leaveRoutes,s=i.changeRoutes,l=i.enterRoutes;(0,u.runLeaveHooks)(o,y),o.filter(function(e){return-1===l.indexOf(e)}).forEach(h),(0,u.runChangeHooks)(s,y,e,function(t,i){if(t||i)return r(t,i);(0,u.runEnterHooks)(l,e,n)})}function s(e){var t=arguments.length<=1||void 0===arguments[1]||arguments[1];return e.__id__||t&&(e.__id__=x++)}function l(e){return e.reduce(function(e,t){return e.push.apply(e,w[s(t)]),e},[])}function p(e,n){(0,g.default)(t,e,function(t,r){if(null==r)return void n();b=a({},r,{location:e});for(var i=l((0,c.default)(y,b).leaveRoutes),o=void 0,s=0,u=i.length;null==o&&s0&&void 0!==arguments[0]?arguments[0]:{};a.forEach(function(t){if(e.hasOwnProperty(t.old)){var n=r(t.old);t.new&&(n=n+" "+i(t.new)),console.warn(n)}})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var a=[{old:"onChangeViewport",new:"onViewportChange"},{old:"perspectiveEnabled",new:"dragRotate"},{old:"onHoverFeatures",new:"onHover"},{old:"onClickFeatures",new:"onClick"}]},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=function(){function e(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},n=this.mapState.getViewportProps(),r=e.getViewportProps();this.onViewportChange&&Object.keys(r).some(function(e){return n[e]!==r[e]})&&this.onViewportChange(r),this.setState(Object.assign({},e.getInteractiveState(),t))}},{key:"getMapState",value:function(e){return new s.default(Object.assign({},this.mapStateProps,this._state,e))}},{key:"setOptions",value:function(e){var t=e.onChangeViewport,n=e.onViewportChange,r=e.onStateChange,i=void 0===r?this.onStateChange:r,o=e.eventManager,a=void 0===o?this.eventManager:o,s=e.scrollZoom,c=void 0===s||s,u=e.dragPan,p=void 0===u||u,d=e.dragRotate,f=void 0===d||d,m=e.doubleClickZoom,h=void 0===m||m,g=e.touchZoomRotate,v=void 0===g||g,_=e.keyboard,y=void 0===_||_;this.onViewportChange=n||t,this.onStateChange=i,this.mapStateProps=e,this.eventManager!==a&&(this.eventManager=a,this._events={});var b=Boolean(this.onViewportChange);this.toggleEvents(l.WHEEL,b&&c),this.toggleEvents(l.PAN,b&&(p||f)),this.toggleEvents(l.PINCH,b&&v),this.toggleEvents(l.DOUBLE_TAP,b&&h),this.toggleEvents(l.KEYBOARD,b&&y),this.scrollZoom=c,this.dragPan=p,this.dragRotate=f,this.doubleClickZoom=h,this.touchZoomRotate=v,this.keyboard=y}},{key:"toggleEvents",value:function(e,t){var n=this;this.eventManager&&e.forEach(function(e){n._events[e]!==t&&(n._events[e]=t,t?n.eventManager.on(e,n.handleEvent):n.eventManager.off(e,n.handleEvent))})}},{key:"_onPanStart",value:function(e){var t=this.getCenter(e),n=this.mapState.panStart({pos:t}).rotateStart({pos:t});return this.updateViewport(n,{isDragging:!0})}},{key:"_onPan",value:function(e){return this.isFunctionKeyPressed(e)||e.rightButton?this._onPanRotate(e):this._onPanMove(e)}},{key:"_onPanEnd",value:function(e){var t=this.mapState.panEnd().rotateEnd();return this.updateViewport(t,{isDragging:!1})}},{key:"_onPanMove",value:function(e){if(!this.dragPan)return!1;var t=this.getCenter(e),n=this.mapState.pan({pos:t});return this.updateViewport(n)}},{key:"_onPanRotate",value:function(e){if(!this.dragRotate)return!1;var t=e.deltaX,n=e.deltaY,r=this.getCenter(e),o=i(r,2),a=o[1],s=a-n,l=this.mapState.getViewportProps(),c=l.width,u=l.height,p=t/c,d=0;n>0?Math.abs(u-s)>5&&(d=n/(s-u)*1.2):n<0&&s>5&&(d=1-a/s),d=Math.min(1,Math.max(-1,d));var f=this.mapState.rotate({deltaScaleX:p,deltaScaleY:d});return this.updateViewport(f)}},{key:"_onWheel",value:function(e){if(!this.scrollZoom)return!1;var t=this.getCenter(e),n=e.delta,r=2/(1+Math.exp(-Math.abs(.01*n)));n<0&&0!==r&&(r=1/r);var i=this.mapState.zoom({pos:t,scale:r});return this.updateViewport(i)}},{key:"_onPinchStart",value:function(e){var t=this.getCenter(e),n=this.mapState.zoomStart({pos:t});return this.updateViewport(n,{isDragging:!0})}},{key:"_onPinch",value:function(e){if(!this.touchZoomRotate)return!1;var t=this.getCenter(e),n=e.scale,r=this.mapState.zoom({pos:t,scale:n});return this.updateViewport(r)}},{key:"_onPinchEnd",value:function(e){var t=this.mapState.zoomEnd();return this.updateViewport(t,{isDragging:!1})}},{key:"_onDoubleTap",value:function(e){if(!this.doubleClickZoom)return!1;var t=this.getCenter(e),n=this.isFunctionKeyPressed(e),r=this.mapState.zoom({pos:t,scale:n?.5:2});return this.updateViewport(r)}},{key:"_onKeyDown",value:function(e){if(!this.keyboard)return!1;var t=this.isFunctionKeyPressed(e),n=this.mapStateProps,r=void 0;switch(e.srcEvent.keyCode){case 189:r=t?this.getMapState({zoom:n.zoom-2}):this.getMapState({zoom:n.zoom-1});break;case 187:r=t?this.getMapState({zoom:n.zoom+2}):this.getMapState({zoom:n.zoom+1});break;case 37:r=t?this.getMapState({bearing:n.bearing-15}):this.mapState.pan({pos:[100,0],startPos:[0,0]});break;case 39:r=t?this.getMapState({bearing:n.bearing+15}):this.mapState.pan({pos:[-100,0],startPos:[0,0]});break;case 38:r=t?this.getMapState({pitch:n.pitch+10}):this.mapState.pan({pos:[0,100],startPos:[0,0]});break;case 40:r=t?this.getMapState({pitch:n.pitch-10}):this.mapState.pan({pos:[0,-100],startPos:[0,0]});break;default:return!1}return this.updateViewport(r)}}]),e}();t.default=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return{contents:e.contents}}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:"";return Array.isArray(e)&&e.forEach(function(e){return o(e,t)}),e.name&&(e.path=e.name.match(/(GeoJSON|3D|API|([A-Z]|^)[a-z'0-9]+|\d+)/g).join("-").toLowerCase().replace(/[^\w-]/g,"")),e.children&&o(e.children,t+"/"+e.path),"string"==typeof e.content&&(p[e.content]=t+"/"+e.path),e}Object.defineProperty(t,"__esModule",{value:!0}),t.Pages=t.markdownFiles=void 0;var a=n(320),s=n(343),l=r(s),c=n(162),u=r(c),p=t.markdownFiles={},d={title:"Examples",pageComponent:l.default,paths:o(a.standaloneExamples)},f={title:"Documentation",pageComponent:u.default,paths:o([{name:"Introduction",children:[{name:"Introduction",content:i("README.md")},{name:"What's New",content:i("whats-new.md")},{name:"Upgrade Guide",content:i("upgrade-guide.md")}]},{name:"Getting Started",children:[{name:"Get Started",content:i("get-started/README.md")},{name:"About Mapbox Tokens",content:i("get-started/mapbox-tokens.md")},{name:"Using with Redux",content:i("get-started/using-with-redux.md")}]},{name:"API Reference",children:[{name:"CanvasOverlay",content:i("overlays/canvas-overlay.md")},{name:"HTMLOverlay",content:i("overlays/html-overlay.md")},{name:"Interactive Map",content:i("components/interactive-map.md")},{name:"Marker",content:i("components/marker.md")},{name:"Navigation Control",content:i("components/navigation-control.md")},{name:"Popup",content:i("components/popup.md")},{name:"Static Map",content:i("components/static-map.md")},{name:"SVGOverlay",content:i("overlays/svg-overlay.md")}]},{name:"Advanced",children:[{name:"Custom Map Controls",content:i("advanced/custom-map-controls.md")}]}])};t.Pages=[d,f]},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(80),i=n(19).document,o=r(i)&&r(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},function(e,t,n){e.exports=!n(29)&&!n(42)(function(){return 7!=Object.defineProperty(n(166)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(165);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){"use strict";var r=n(102),i=n(41),o=n(173),a=n(43),s=n(30),l=n(101),c=n(376),u=n(104),p=n(384),d=n(45)("iterator"),f=!([].keys&&"next"in[].keys()),m=function(){return this};e.exports=function(e,t,n,h,g,v,_){c(n,t,h);var y,b,x,w=function(e){if(!f&&e in S)return S[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},E=t+" Iterator",M="values"==g,A=!1,S=e.prototype,C=S[d]||S["@@iterator"]||g&&S[g],T=C||w(g),N=g?M?w("entries"):T:void 0,O="Array"==t?S.entries||C:C;if(O&&(x=p(O.call(new e)))!==Object.prototype&&(u(x,E,!0),r||s(x,d)||a(x,d,m)),M&&C&&"values"!==C.name&&(A=!0,T=function(){return C.call(this)}),r&&!_||!f&&!A&&S[d]||a(S,d,T),l[t]=T,l[E]=m,g)if(y={values:M?T:w("values"),keys:v?T:w("keys"),entries:N},_)for(b in y)b in S||o(S,b,y[b]);else i(i.P+i.F*(f||A),t,y);return y}},function(e,t,n){var r=n(79),i=n(381),o=n(100),a=n(105)("IE_PROTO"),s=function(){},l=function(){var e,t=n(166)("iframe"),r=o.length;for(t.style.display="none",n(374).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("