2 lines
48 KiB
JavaScript
2 lines
48 KiB
JavaScript
|
/* 2020-9-22 15:23:18 | 版权所有 军懋国兴 */
|
||
|
function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,t){"object"==("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.dat={})}(this,function(e){"use strict";function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}function n(e,t,n){Object.defineProperty(e,t,{get:function(){return"RGB"===this.__state.space||H.recalculateRGB(this,t,n),this.__state[t]},set:function(e){"RGB"!==this.__state.space&&(H.recalculateRGB(this,t,n),this.__state.space="RGB"),this.__state[t]=e}})}function o(e,t){Object.defineProperty(e,t,{get:function(){return"HSV"===this.__state.space||H.recalculateHSV(this),this.__state[t]},set:function(e){"HSV"!==this.__state.space&&(H.recalculateHSV(this),this.__state.space="HSV"),this.__state[t]=e}})}function i(e){if("0"===e||C.isUndefined(e))return 0;var t=e.match(z);return C.isNull(t)?0:parseFloat(t[1])}function r(e){var t=e.toString();return-1<t.indexOf(".")?t.length-t.indexOf(".")-1:0}function u(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}function p(t,n,o,i){t.style.background="",C.each(q,function(e){t.style.cssText+="background: "+e+"linear-gradient("+n+", "+o+" 0%, "+i+" 100%); "})}function f(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function s(e){M.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&M.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function m(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function b(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r,s=n.load.remembered,a=void 0;if(s[e.preset])a=s[e.preset];else{if(!s[ue])return;a=s[ue]}a[o]&&void 0!==a[o][t.property]&&(r=a[o][t.property],t.initialValue=r,t.setValue(r))}}}function g(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i,r=void 0;r=o.color?new Q(t,n):(i=[t,n].concat(o.factoryArgs),$.apply(e,i)),o.before instanceof j&&(o.before=o.before.__li),b(e,r),M.addClass(r.domElement,"c");var s=document.createElement("span");M.addClass(s,"property-name"),s.innerHTML=r.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(r.domElement);var l,d,c,u,_,h=f(e,a,o.before);return M.addClass(h,ge.CLASS_CONTROLLER_ROW),r instanceof Q?M.addClass(h,"color"):M.addClass(h,L(r.getValue())),l=e,d=h,(c=r).__li=d,c.__gui=l,C.extend(c,{options:function(e){if(1<arguments.length){var t=c.__li.nextElementSibling;return c.remove(),g(l,c.object,c.property,{before:t,factoryArgs:[C.toArray(arguments)]})}if(C.isArray(e)||C.isObject(e)){var n=c.__li.nextElementSibling;return c.remove(),g(l,c.object,c.property,{before:n,factoryArgs:[e]})}},name:function(e){return c.__li.firstElementChild.firstElementChild.innerHTML=e,c},listen:function(){return c.__gui.listen(c),c},remove:function(){return c.__gui.remove(c),c}}),c instanceof J?(u=new Y(c.object,c.property,{min:c.__min,max:c.__max,step:c.__step}),C.each(["updateDisplay","onChange","on
|