2021-01-03 21:59:00 +00:00
|
|
|
var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(t){var e={exports:{}};return t(e,e.exports),e.exports}var check=function(t){return t&&t.Math==Math&&t},e=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof t&&t)||function(){return this}()||Function("return this")(),fails=function(t){try{return!!t()}catch(t){return!0}},r=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),n={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i={f:o&&!n.call({1:2},1)?function propertyIsEnumerable(t){var e=o(this,t);return!!e&&e.enumerable}:n},createPropertyDescriptor=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},a={}.toString,classofRaw=function(t){return a.call(t).slice(8,-1)},c="".split,u=fails((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==classofRaw(t)?c.call(t,""):Object(t)}:Object,requireObjectCoercible=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},toIndexedObject=function(t){return u(requireObjectCoercible(t))},isObject=function(t){return"object"==typeof t?null!==t:"function"==typeof t},toPrimitive=function(t,e){if(!isObject(t))return t;var r,n;if(e&&"function"==typeof(r=t.toString)&&!isObject(n=r.call(t)))return n;if("function"==typeof(r=t.valueOf)&&!isObject(n=r.call(t)))return n;if(!e&&"function"==typeof(r=t.toString)&&!isObject(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")},l={}.hasOwnProperty,has=function(t,e){return l.call(t,e)},s=e.document,f=isObject(s)&&isObject(s.createElement),documentCreateElement=function(t){return f?s.createElement(t):{}},p=!r&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),h=Object.getOwnPropertyDescriptor,d={f:r?h:function getOwnPropertyDescriptor(t,e){if(t=toIndexedObject(t),e=toPrimitive(e,!0),p)try{return h(t,e)}catch(t){}if(has(t,e))return createPropertyDescriptor(!i.f.call(t,e),t[e])}},anObject=function(t){if(!isObject(t))throw TypeError(String(t)+" is not an object");return t},v=Object.defineProperty,y={f:r?v:function defineProperty(t,e,r){if(anObject(t),e=toPrimitive(e,!0),anObject(r),p)try{return v(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},g=r?function(t,e,r){return y.f(t,e,createPropertyDescriptor(1,r))}:function(t,e,r){return t[e]=r,t},setGlobal=function(t,r){try{g(e,t,r)}catch(n){e[t]=r}return r},m=e["__core-js_shared__"]||setGlobal("__core-js_shared__",{}),b=Function.toString;"function"!=typeof m.inspectSource&&(m.inspectSource=function(t){return b.call(t)});var w,x,S,_=m.inspectSource,E=e.WeakMap,k="function"==typeof E&&/native code/.test(_(E)),O=createCommonjsModule((function(t){(t.exports=function(t,e){return m[t]||(m[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.8.2",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),A=0,j=Math.random(),uid=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++A+j).toString(36)},I=O("keys"),sharedKey=function(t){return I[t]||(I[t]=uid(t))},P={},L=e.WeakMap;if(k){var T=m.state||(m.state=new L),R=T.get,C=T.has,N=T.set;w=function(t,e){return e.facade=t,N.call(T,t,e),e},x=function(t){return R.call(T,t)||{}},S=function(t){return C.call(T,t)}}else{var M=sharedKey("state");P[M]=!0,w=function(t,e){return e.facade=t,g(t,M,e),e},x=function(t){return has(t,M)?t[M]:{}},S=function(t){return has(t,M)}}var G,D={set:w,get:x,has:S,enforce:function(t){return S(t)?x(t):w(t,{})},getterFor:function(t){return function(e){var r;if(!isObject(e)||(r=x(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}},U=createCommonjsModule((function(t){var r=D.get,n=D.enforce,o=String(String).split("String");(t.exports=function(t,r,i,a){var c,u=!!a&&!!a.unsafe,l=!!a&&!!a.enumer
|
2020-09-06 06:32:10 +00:00
|
|
|
/**
|
2020-09-11 23:27:47 +00:00
|
|
|
* @file ext-markers.js
|
2020-09-06 06:32:10 +00:00
|
|
|
*
|
2020-09-11 23:27:47 +00:00
|
|
|
* @license Apache-2.0
|
2020-09-06 06:32:10 +00:00
|
|
|
*
|
2020-09-11 23:27:47 +00:00
|
|
|
* @copyright 2010 Will Schleter based on ext-arrows.js by Copyright(c) 2010 Alexis Deveria
|
|
|
|
*
|
|
|
|
* This extension provides for the addition of markers to the either end
|
|
|
|
* or the middle of a line, polyline, path, polygon.
|
|
|
|
*
|
|
|
|
* Markers may be either a graphic or arbitary text
|
|
|
|
*
|
|
|
|
* to simplify the coding and make the implementation as robust as possible,
|
|
|
|
* markers are not shared - every object has its own set of markers.
|
|
|
|
* this relationship is maintained by a naming convention between the
|
|
|
|
* ids of the markers and the ids of the object
|
|
|
|
*
|
|
|
|
* The following restrictions exist for simplicty of use and programming
|
|
|
|
* objects and their markers to have the same color
|
|
|
|
* marker size is fixed
|
|
|
|
* text marker font, size, and attributes are fixed
|
|
|
|
* an application specific attribute - se_type - is added to each marker element
|
|
|
|
* to store the type of marker
|
|
|
|
*
|
|
|
|
* @todo
|
|
|
|
* remove some of the restrictions above
|
|
|
|
* add option for keeping text aligned to horizontal
|
|
|
|
* add support for dimension extension lines
|
|
|
|
*
|
2021-01-03 21:59:00 +00:00
|
|
|
*/var Go=function(){var t=_asyncToGenerator(regeneratorRuntime.mark((function _callee(t){var e;return regeneratorRuntime.wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,__variableDynamicImportRuntime0__("./locale/".concat(encodeURIComponent(t),".js"));case 3:e=r.sent,r.next=12;break;case 6:return r.prev=6,r.t0=r.catch(0),console.error("Missing translation (".concat(t,") - using 'en'")),r.next=11,Promise.resolve().then((function(){return Uo}));case 11:e=r.sent;case 12:return r.abrupt("return",e.default);case 13:case"end":return r.stop()}}),_callee,null,[[0,6]])})));return function loadExtensionTranslation(e){return t.apply(this,arguments)}}(),Do={name:"markers",init:function init(t){var e=this;return _asyncToGenerator(regeneratorRuntime.mark((function _callee3(){var r,n,o,i,a,c,u,l,s,f,p,h,d,v,y,g,m,b,w,x,S,_,E,k,O;return regeneratorRuntime.wrap((function _callee3$(A){for(;;)switch(A.prev=A.next){case 0:return k=function _buildButtonList(){var t=[];return o.each(c,(function(e,r){var n=r+"_marker_list",o=!0;Object.keys(s).forEach((function(e){var i=E(String(e));t.push({id:l+r+"_"+e,svgicon:e,icon:"markers-"+e+".png",title:i,type:"context",events:{click:S},panel:"marker_panel",list:n,isDefault:o}),o=!1}))})),t},E=function _getTitle(t){var e=n.langList.find((function(e){return e.id===t}));return e?e.title:t},_=function _setArrowFromButton3(){return(_=_asyncToGenerator(regeneratorRuntime.mark((function _callee2(t){var e,r,n;return regeneratorRuntime.wrap((function _callee2$(t){for(;;)switch(t.prev=t.next){case 0:if(e=this.id.split("_"),r=e[1],n=e[2],e[3]&&(n+="_"+e[3]),"textmarker"===n){t.next=8;break}w(r,"\\"+n),t.next=10;break;case 8:return t.next=10,x(r);case 10:case"end":return t.stop()}}),_callee2,this)})))).apply(this,arguments)},S=function _setArrowFromButton2(t){return _.apply(this,arguments)},x=function _showTextPrompt(t){var e=o("#"+t+"_marker").val();"\\"===e.substr(0,1)&&(e="");var r=prompt("Enter text for "+t+" marker",e);r&&w(t,r)},w=function _triggerTextEntry(t,e){o("#"+t+"_marker").val(e),o("#"+t+"_marker").change()},b=function _updateReferences(t){o.each(c,(function(e,r){var n=u+r+"_"+t.id,a="marker-"+r,c=f(t,a);if(c&&c.attributes.se_type){var l=t.getAttribute(a);if(l){var s=t.id.length,p=l.substr(-s-1,s);if(t.id!==p){var d=o("#"+r+"_marker").attr("value");v(n,d),i.changeSelectedAttribute(a,"url(#"+n+")"),"line"===t.tagName&&"mid"===r&&(t=y(t)),i.call("changed",h)}}}}))},m=function _colorChanged(t){var e=t.getAttribute("stroke");o.each(c,(function(r,n){var o=f(t,"marker-"+n);if(o&&o.attributes.se_type){var i=o.lastElementChild;if(i){var a=i.getAttribute("fill"),c=i.getAttribute("stroke");a&&"none"!==a&&i.setAttribute("fill",e),c&&"none"!==c&&i.setAttribute("stroke",e)}}}))},g=function _setMarker(){var t={start_marker:"start",mid_marker:"mid",end_marker:"end"}[this.id],e="marker-"+t,r=h[0],n=f(r,e);n&&o(n).remove(),r.removeAttribute(e);var a=this.value;if(""===a&&(a="\\nomarker"),"\\nomarker"===a)return p(t,a),void i.call("changed",h);var c=u+t+"_"+r.id;v(c,a),i.changeSelectedAttribute(e,"url(#"+c+")"),"line"===r.tagName&&"mid"===t&&y(r),i.call("changed",h),p(t,a)},y=function _convertline(e){if("line"!==e.tagName)return e;var r=Number(e.getAttribute("x1")),n=Number(e.getAttribute("x2")),u=Number(e.getAttribute("y1")),l=Number(e.getAttribute("y2")),s=e.id,f=a({element:"polyline",attr:{points:r+","+u+(" "+(r+n)/2+","+(u+l)/2+" ")+n+","+l,stroke:e.getAttribute("stroke"),"stroke-width":e.getAttribute("stroke-width"),fill:"none",opacity:e.getAttribute("opacity")||1}});o.each(c,(function(t,r){var n="marker-"+r;e.getAttribute(n)&&f.setAttribute(n,e.getAttribute(n))}));var p=new t.BatchCommand;return p.addSubCommand(new t.RemoveElementCommand(e,e.parentNode)),p.addSubCommand(new t.InsertElementCommand(f)),o(e).after(f).remove(),i.clearSelection(),f.id=s,i.addToSelection([f]),t.addCommandToHistory(p),f},v=function _addMarker(t,e){var r=i.getElem(t);if(!r&&""!==e&&"\\nomarker"!==e){var n=h[0].getAttribute("stroke"),o=50,c=50,u="0 0 100 100",l=5,f=5,p="\\"===e.substr(0,1)?e.substr
|
2020-09-06 06:32:10 +00:00
|
|
|
//# sourceMappingURL=ext-markers.js.map
|