(window.webpackJsonp=window.webpackJsonp||[]).push([[41],{199:function(t,e,n){"use strict";var r=n(49),o=n(16),i=n(7),a=n(40),l=n(25),u=n(61),p=n(19),s=n(10),c=n(35),h=n(1),d=n(31),x=n(11),_=n(32),v=n(4),y="extentchanged",f=function(t){function e(e){t.call(this,y),this.extent=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(r.a),O=function(t){function e(e){var n,r=e||{};t.call(this,r),this.condition_=r.condition?r.condition:c.d,this.extent_=null,this.pointerHandler_=null,this.pixelTolerance_=void 0!==r.pixelTolerance?r.pixelTolerance:10,this.snappedToVertex_=!1,this.extentFeature_=null,this.vertexFeature_=null,e||(e={}),this.extentOverlay_=new p.a({source:new s.a({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.boxStyle?e.boxStyle:(n=Object(x.b)(),function(t,e){return n[i.a.POLYGON]}),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.vertexOverlay_=new p.a({source:new s.a({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.pointerStyle?e.pointerStyle:w(),updateWhileAnimating:!0,updateWhileInteracting:!0}),e.extent&&this.setExtent(e.extent)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapToVertex_=function(t,e){var n=e.getCoordinateFromPixelInternal(t),r=this.getExtentInternal();if(r){var o=function(t){return[[[t[0],t[1]],[t[0],t[3]]],[[t[0],t[3]],[t[2],t[3]]],[[t[2],t[3]],[t[2],t[1]]],[[t[2],t[1]],[t[0],t[1]]]]}(r);o.sort((function(t,e){return Object(d.l)(n,t)-Object(d.l)(n,e)}));var i=o[0],a=Object(d.c)(n,i),l=e.getPixelFromCoordinateInternal(a);if(Object(d.f)(t,l)<=this.pixelTolerance_){var u=e.getPixelFromCoordinateInternal(i[0]),p=e.getPixelFromCoordinateInternal(i[1]),s=Object(d.k)(l,u),c=Object(d.k)(l,p),h=Math.sqrt(Math.min(s,c));return this.snappedToVertex_=h<=this.pixelTolerance_,this.snappedToVertex_&&(a=s>c?i[1]:i[0]),a}}return null},e.prototype.handlePointerMove_=function(t){var e=t.pixel,n=t.map,r=this.snapToVertex_(e,n);r||(r=n.getCoordinateFromPixelInternal(e)),this.createOrUpdatePointerFeature_(r)},e.prototype.createOrUpdateExtentFeature_=function(t){var e=this.extentFeature_;return e?t?e.setGeometry(Object(_.d)(t)):e.setGeometry(void 0):(e=t?new o.a(Object(_.d)(t)):new o.a({}),this.extentFeature_=e,this.extentOverlay_.getSource().addFeature(e)),e},e.prototype.createOrUpdatePointerFeature_=function(t){var e=this.vertexFeature_;e?e.getGeometry().setCoordinates(t):(e=new o.a(new l.a(t)),this.vertexFeature_=e,this.vertexOverlay_.getSource().addFeature(e));return e},e.prototype.handleEvent=function(e){return!e.originalEvent||!this.condition_(e)||(e.type!=a.a.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(e),t.prototype.handleEvent.call(this,e),!1)},e.prototype.handleDownEvent=function(t){var e=t.pixel,n=t.map,r=this.getExtentInternal(),o=this.snapToVertex_(e,n),i=function(t){var e=null,n=null;return t[0]==r[0]?e=r[2]:t[0]==r[2]&&(e=r[0]),t[1]==r[1]?n=r[3]:t[1]==r[3]&&(n=r[1]),null!==e&&null!==n?[e,n]:null};if(o&&r){var a=o[0]==r[0]||o[0]==r[2]?o[0]:null,l=o[1]==r[1]||o[1]==r[3]?o[1]:null;null!==a&&null!==l?this.pointerHandler_=g(i(o)):null!==a?this.pointerHandler_=b(i([a,r[1]]),i([a,r[3]])):null!==l&&(this.pointerHandler_=b(i([r[0],l]),i([r[2],l])))}else o=n.getCoordinateFromPixelInternal(e),this.setExtent([o[0],o[1],o[0],o[1]]),this.pointerHandler_=g(o);return!0},e.prototype.handleDragEvent=function(t){if(this.pointerHandler_){var e=t.coordinate;this.setExtent(this.pointerHandler_(e)),this.createOrUpdatePointerFeature_(e)}},e.prototype.handleUpEvent=function(t){this.pointerHandler_=null;var e=this.getExtentInternal();return e&&0!==Object(h.v)(e)||this.setExtent(null),!1},e.prototype.setMap=function(e){this.extentOverlay_.setMap(e),this.vertexOverlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getExtent=function(){return Object(v.r)(this.getExtentInternal(),this.getMap().getView().getProjection())},e.prototype.getExtentInternal=function(){return this.extent_},e.prototype.setExtent=function(t){this.extent_=t||null,this.createOrUpdateExtentFeature_(t),this.dispatchEvent(new f(this.extent_))},e}(u.b);function w(){var t=Object(x.b)();return function(e,n){return t[i.a.POINT]}}function g(t){return function(e){return Object(h.c)([t,e])}}function b(t,e){return t[0]==e[0]?function(n){return Object(h.c)([t,[n[0],e[1]]])}:t[1]==e[1]?function(n){return Object(h.c)([t,[e[0],n[1]]])}:null}e.a=O},274:function(t,e,n){"use strict";n.r(e);var r=n(199),o=n(30),i=n(3),a=n(2),l=n(10),u=n(9),p=n(5),s=n(19),c=n(35),h=new l.a({url:"data/geojson/countries.geojson",format:new o.a}),d=new i.a({layers:[new p.a({source:new u.b}),new s.a({source:h})],target:"map",view:new a.a({center:[0,0],zoom:2})}),x=new r.a({condition:c.n});d.addInteraction(x)}},[[274,0]]]); //# sourceMappingURL=extent-interaction.js.map