acdr-ui/dist/build/mp-weixin/uni_modules/lime-painter/components/l-painter/painter.js

2 lines
58 KiB
JavaScript
Raw Normal View History

2024-09-19 07:20:14 +08:00
"use strict";const t=require("../../../../common/vendor.js");var e=function(){return e=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},e.apply(this,arguments)};function i(t,e,i,n){return new(i||(i=Promise))((function(e,r){function o(t){try{a(n.next(t))}catch(e){r(e)}}function s(t){try{a(n.throw(t))}catch(e){r(e)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(t){t(n)}))).then(o,s)}a((n=n.apply(t,[])).next())}))}function n(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((r=(r=s.trys).length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(a){o=[6,a],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var r={MP_WEIXIN:"mp-weixin",MP_QQ:"mp-qq",MP_ALIPAY:"mp-alipay",MP_BAIDU:"mp-baidu",MP_TOUTIAO:"mp-toutiao",MP_DINGDING:"mp-dingding",H5:"h5",WEB:"web",PLUS:"plus"},o=["Top","Right","Bottom","Left"],s="right",a="bottom",h=["contentSize","clientSize","borderSize","offsetSize"],c={TOP:"top",MIDDLE:"middle",BOTTOM:a},d={LEFT:"left",CENTER:"center",RIGHT:s},l="view",f="text",u="image",p="qrcode",g="block",v="inline-block",y="absolute",x="fixed",b={display:g,color:"#000000",lineHeight:"1.4em",fontSize:14,fontWeight:400,fontFamily:"sans-serif",lineCap:"butt",flexDirection:"row",flexWrap:"nowrap",textAlign:"left",alignItems:"flex-start",justifyContent:"flex-start",position:"static",transformOrigin:"".concat("center"," ").concat("center")},w={upx2px:function(t){return window.innerWidth/750*t},getSystemInfoSync:function(){return{screenWidth:window.innerWidth,screenHeight:window.innerHeight}},getImageInfo:function(t){var e=t.src,i=t.success,n=t.fail,r=new Image;r.onload=function(){i({width:r.naturalWidth,height:r.naturalHeight,path:r.src,src:e})},r.onerror=n,r.src=e}},m="object"==typeof window?void 0===t.index||void 0!==t.index&&!t.index.addInterceptor?r.WEB:r.H5:"object"==typeof swan?r.MP_BAIDU:"object"==typeof tt?r.MP_TOUTIAO:"object"==typeof plus?r.PLUS:"object"==typeof t.wx$1?r.MP_WEIXIN:void 0,S=m==r.MP_WEIXIN?t.wx$1:void 0!==t.index?t.index.getImageInfo?{upx2px:function(e){return t.index.upx2px(e)},getSystemInfoSync:function(){return t.index.getSystemInfoSync()},getImageInfo:function(e){return t.index.getImageInfo(e)},downloadFile:function(e){return t.index.downloadFile(e)}}:Object.assign(t.index,w):"undefined"!=typeof window?w:t.index;if(!S.upx2px){var z=((S.getSystemInfoSync&&S.getSystemInfoSync()).screenWidth||375)/750;S.upx2px=function(t){return z*t}}function I(t){return/^-?\d+(\.\d+)?$/.test(t)}function M(t,e,i){if(I(t))return 1*t;if("string"==typeof t){var n=/^-?([0-9]+)?([.]{1}[0-9]+){0,1}(em|rpx|vw|vh|px|%)$/g.exec(t);if(!t||!n)return 0;var r=n[3];t=parseFloat(t);var o=0;if("rpx"===r)o=S.upx2px(t);else if("px"===r)o=1*t;else if("%"===r&&e)o=t*M(e)/100;else if("em"===r&&e)o=t*M(e||14);else if(["vw","vh"].includes(r)){var s=S.getSystemInfoSync(),a=s.screenWidth,h=s.screenHeight;o=t*("vw"==r?a:h)/100}return 1*o.toFixed(2)}return 0}function k(t){return/%$/.test(t)}function B(t){for(var e=[],i=[],n=0,r=t.substring(0,t.length-1).split("%,");n<r.length;n++){var o=r[n];e.push(o.substring(0,o.lastIndexOf(" ")).trim()),i.push(o.sub