4294967295)throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var h=new l(p+1);n=new Array(p);for(var d=0;d1)throw new Error("Probability must be between 0 and 1, inclusive")}else{if(!o(g))throw new TypeError("Unexpected type of argument in function quantileSeq");if(s=new g.constructor(1),g.isNegative()||g.gt(s))throw new Error("Probability must be between 0 and 1, inclusive")}n[y]=u(i,g,r)}return n}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}})),Gu=Xe("std",["typed","sqrt","variance"],(function(e){var t=e.typed,r=e.sqrt,n=e.variance;return t("std",{"Array | Matrix":i,"Array | Matrix, string":i,"Array | Matrix, number | BigNumber":i,"Array | Matrix, number | BigNumber, string":i,"...":function(e){return i(e)}});function i(e,t){if(0===e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{return r(n.apply(null,arguments))}catch(e){throw e instanceof TypeError&&-1!==e.message.indexOf(" variance")?new TypeError(e.message.replace(" variance"," std")):e}}}));function Vu(e,t){if(t>1;return Vu(e,r)*Vu(r+1,t)}function Zu(e,t){if(!V(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!V(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(t>e)throw new TypeError("k must be less than or equal to n");var r=e-t;return t171?1/0:Vu(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Qu(1-e));if(e>=171.35)return 1/0;if(e>85){var r=e*e,n=r*e,i=n*e,a=i*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*r)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*e))}--e,t=ec[0];for(var o=1;o2;)u+=o-=2,s=s.times(u);return new a(s.toPrecision(a.precision))}(e.minus(1));if(!e.isFinite())return new a(e.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")},"Array | Matrix":function(e){return Nt(e,this)}})})),rc=Xe("factorial",["typed","gamma"],(function(e){var t=e.typed,r=e.gamma;return t("factorial",{number:function(e){if(e<0)throw new Error("Value must be non-negative");return r(e+1)},BigNumber:function(e){if(e.isNegative())throw new Error("Value must be non-negative");return r(e.plus(1))},"Array | Matrix":function(e){return Nt(e,this)}})})),nc=Xe("kldivergence",["typed","matrix","divide","sum","multiply","dotDivide","log","isNumeric"],(function(e){var t=e.typed,r=e.matrix,n=e.divide,i=e.sum,a=e.multiply,o=e.dotDivide,s=e.log,u=e.isNumeric;return t("kldivergence",{"Array, Array":function(e,t){return c(r(e),r(t))},"Matrix, Array":function(e,t){return c(e,r(t))},"Array, Matrix":function(e,t){return c(r(e),t)},"Matrix, Matrix":function(e,t){return c(e,t)}});function c(e,t){var r=t.size().length,c=e.size().length;if(r>1)throw new Error("first object must be one dimensional");if(c>1)throw new Error("second object must be one dimensional");if(r!==c)throw new Error("Length of two vectors must be equal");if(0===i(e))throw new Error("Sum of elements in first object must be non zero");if(0===i(t))throw new Error("Sum of elements in second object must be non zero");var f=n(e,i(e)),l=n(t,i(t)),p=i(a(f,s(o(f,l))));return u(p)?p:Number.NaN}})),ic=Xe("multinomial",["typed","add","divide","multiply","factorial","isInteger","isPositive"],(function(e){var t=e.typed,r=e.add,n=e.divide,i=e.multiply,a=e.factorial,o=e.isInteger,s=e.isPositive;return t("multinomial",{"Array | Matrix":function(e){var t=0,u=1;return wt(e,(function(e){if(!o(e)||!s(e))throw new TypeError("Positive integer value expected in function multinomial");t=r(t,e),u=i(u,a(e))})),n(a(t),u)}})})),ac=Xe("permutations",["typed","factorial"],(function(e){return(0,e.typed)("permutations",{"number | BigNumber":e.factorial,"number, number":function(e,t){if(!V(e)||e<0)throw new TypeError("Positive integer value expected in function permutations");if(!V(t)||t<0)throw new TypeError("Positive integer value expected in function permutations");if(t>e)throw new TypeError("second argument k must be less than or equal to first argument n");return Vu(e-t+1,e)},"BigNumber, BigNumber":function(e,t){var r,n;if(!oc(e)||!oc(t))throw new TypeError("Positive integer value expected in function permutations");if(t.gt(e))throw new TypeError("second argument k must be less than or equal to first argument n");for(r=e.mul(0).add(1),n=e.minus(t).plus(1);n.lte(e);n=n.plus(1))r=r.times(n);return r}})}));function oc(e){return e.isInteger()&&e.gte(0)}var sc=r(9),uc=r.n(sc),cc=uc()(Date.now());function fc(e){var t,r;return t=null===(r=e)?cc:uc()(String(r)),function(){return t()}}var lc=Xe("pickRandom",["typed","config","?on"],(function(e){var t=e.typed,r=e.config,n=e.on,i=fc(r.randomSeed);return n&&n("config",(function(e,t){e.randomSeed!==t.randomSeed&&(i=fc(e.randomSeed))})),t({"Array | Matrix":function(e){return o(e,{})},"Array | Matrix, Object":function(e,t){return o(e,t)},"Array | Matrix, number":function(e,t){return o(e,{number:t})},"Array | Matrix, Array | Matrix":function(e,t){return o(e,{weights:t})},"Array | Matrix, Array | Matrix, number":function(e,t,r){return o(e,{number:r,weights:t})},"Array | Matrix, number, Array | Matrix":function(e,t,r){return o(e,{number:t,weights:r})}});function o(e,t){var r=t.number,n=t.weights,o=t.elementWise,s=void 0===o||o,u=void 0===r;u&&(r=1);var c=p(e)?e.create:p(n)?n.create:null;e=e.valueOf(),n&&(n=n.valueOf()),!0===s&&(e=ze(e),n=ze(n));var f=0;if(void 0!==n){if(n.length!==e.length)throw new Error("Weights must have the same length as possibles");for(var l=0,m=n.length;l1)for(var n=0,i=e.shift();n2&&o(t)){for(var a=t.args.pop();t.args.length>0;)a=r([t.args.pop(),a]);t.args=a.args}}},unflattenl:function e(t){if(t.args&&0!==t.args.length){for(var r=u(t),n=t.args.length,i=0;i2&&o(t)){for(var a=t.args.shift();t.args.length>0;)a=r([a,t.args.shift()]);t.args=a.args}}}}})),bc=Xe("simplifyCore",["equal","isZero","add","subtract","multiply","divide","pow","ConstantNode","OperatorNode","FunctionNode","ParenthesisNode"],(function(e){var t=e.equal,r=e.isZero,n=e.add,i=e.subtract,a=e.multiply,o=e.divide,s=e.pow,u=e.ConstantNode,c=e.OperatorNode,f=e.FunctionNode,l=e.ParenthesisNode,p=new u(0),m=new u(1);return function e(h){if(j(h)&&h.isUnary()){var d=e(h.args[0]);if("+"===h.op)return d;if("-"===h.op){if(j(d)){if(d.isUnary()&&"-"===d.op)return d.args[0];if(d.isBinary()&&"subtract"===d.fn)return new c("-","subtract",[d.args[1],d.args[0]])}return new c(h.op,h.fn,[d])}}else if(j(h)&&h.isBinary()){var y=e(h.args[0]),g=e(h.args[1]);if("+"===h.op){if(z(y)){if(r(y.value))return g;if(z(g))return new u(n(y.value,g.value))}return z(g)&&r(g.value)?y:j(g)&&g.isUnary()&&"-"===g.op?new c("-","subtract",[y,g.args[0]]):new c(h.op,h.fn,g?[y,g]:[y])}if("-"===h.op){if(z(y)&&g){if(z(g))return new u(i(y.value,g.value));if(r(y.value))return new c("-","unaryMinus",[g])}if("subtract"===h.fn)return z(g)&&r(g.value)?y:j(g)&&g.isUnary()&&"-"===g.op?e(new c("+","add",[y,g.args[0]])):new c(h.op,h.fn,[y,g])}else{if("*"===h.op){if(z(y)){if(r(y.value))return p;if(t(y.value,1))return g;if(z(g))return new u(a(y.value,g.value))}if(z(g)){if(r(g.value))return p;if(t(g.value,1))return y;if(j(y)&&y.isBinary()&&y.op===h.op){var v=y.args[0];if(z(v)){var x=new u(a(v.value,g.value));return new c(h.op,h.fn,[x,y.args[1]],h.implicit)}}return new c(h.op,h.fn,[g,y],h.implicit)}return new c(h.op,h.fn,[y,g],h.implicit)}if("/"===h.op){if(z(y)){if(r(y.value))return p;if(z(g)&&(t(g.value,1)||t(g.value,2)||t(g.value,4)))return new u(o(y.value,g.value))}return new c(h.op,h.fn,[y,g])}if("^"===h.op){if(z(g)){if(r(g.value))return m;if(t(g.value,1))return y;if(z(y))return new u(s(y.value,g.value));if(j(y)&&y.isBinary()&&"^"===y.op){var b=y.args[1];if(z(b))return new c(h.op,h.fn,[y.args[0],new u(a(b.value,g.value))])}}return new c(h.op,h.fn,[y,g])}}}else{if(P(h)){var w=e(h.content);return P(w)||F(w)||z(w)?w:new l(w)}if(B(h)){var N=h.args.map(e).map((function(e){return P(e)?e.content:e}));return new f(e(h.fn),N)}}return h}})),wc=Xe("simplifyConstant",["typed","config","mathWithTransform","?fraction","?bignumber","ConstantNode","OperatorNode","FunctionNode","SymbolNode"],(function(e){var t=e.typed,r=e.config,n=e.mathWithTransform,i=e.fraction,a=e.bignumber,o=e.ConstantNode,s=e.OperatorNode,c=e.FunctionNode,f=e.SymbolNode,l=xc({FunctionNode:c,OperatorNode:s,SymbolNode:f}),p=l.isCommutative,m=l.isAssociative,h=l.allChildren,d=l.createMakeNodeFunction;function y(e,t,r){try{return x(n[e].apply(null,t),r)}catch(i){return t=t.map((function(e){return u(e)?e.valueOf():e})),x(n[e].apply(null,t),r)}}var g=t({Fraction:function(e){var t,r=e.s*e.n;t=r<0?new s("-","unaryMinus",[new o(-r)]):new o(r);if(1===e.d)return t;return new s("/","divide",[t,new o(e.d)])},number:function(e){return e<0?b(new o(-e)):new o(e)},BigNumber:function(e){return e<0?b(new o(-e)):new o(e)},Complex:function(e){throw new Error("Cannot convert Complex number to Node")}});function v(e,t){if(t&&!1!==t.exactFractions&&isFinite(e)&&i){var r=i(e),n=t&&"number"==typeof t.fractionsLimit?t.fractionsLimit:1/0;if(r.valueOf()===e&&r.n1?(o=w(s,f,u,r),l.unshift(o),o=w(s,l,u,r)):o=w(s,a,u,r)}else o=w(s,a,u,r);else a=t.args.map((function(t){return e(t,r)})),o=w(s,a,u,r);return o;case"ParenthesisNode":return e(t.content,r);case"AccessorNode":case"ArrayNode":case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"IndexNode":case"ObjectNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(t.type))}}(e,t);return D(r)?r:g(r)}})),Nc=Xe("resolve",["parse","FunctionNode","OperatorNode","ParenthesisNode"],(function(e){var t=e.parse,r=e.FunctionNode,n=e.OperatorNode,i=e.ParenthesisNode;return function e(a,o){if(!o)return a;if(F(a)){var s=o[a.name];if(D(s))return e(s,o);if("number"==typeof s)return t(String(s))}else{if(j(a)){var u=a.args.map((function(t){return e(t,o)}));return new n(a.op,a.fn,u,a.implicit)}if(P(a))return new i(e(a.content,o));if(B(a)){var c=a.args.map((function(t){return e(t,o)}));return new r(a.name,c)}}return a}}));function Mc(e){return(Mc="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)}var Sc=Xe("simplify",["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","?fraction","?bignumber","mathWithTransform","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],(function(e){var t=e.config,r=e.typed,n=e.parse,i=e.add,a=e.subtract,o=e.multiply,s=e.divide,u=e.pow,c=e.isZero,f=e.equal,l=e.fraction,p=e.bignumber,m=e.mathWithTransform,h=e.ConstantNode,d=e.FunctionNode,y=e.OperatorNode,g=e.ParenthesisNode,v=e.SymbolNode,x=wc({typed:r,config:t,mathWithTransform:m,fraction:l,bignumber:p,ConstantNode:h,OperatorNode:y,FunctionNode:d,SymbolNode:v}),b=bc({equal:f,isZero:c,add:i,subtract:a,multiply:o,divide:s,pow:u,ConstantNode:h,OperatorNode:y,FunctionNode:d,ParenthesisNode:g}),w=Nc({parse:n,FunctionNode:d,OperatorNode:y,ParenthesisNode:g}),N=xc({FunctionNode:d,OperatorNode:y,SymbolNode:v}),M=N.isCommutative,S=N.isAssociative,E=N.flatten,A=N.unflattenr,O=N.unflattenl,C=N.createMakeNodeFunction,_=r("simplify",{string:function(e){return this(n(e),this.rules,{},{})},"string, Object":function(e,t){return this(n(e),this.rules,t,{})},"string, Object, Object":function(e,t,r){return this(n(e),this.rules,t,r)},"string, Array":function(e,t){return this(n(e),t,{},{})},"string, Array, Object":function(e,t,r){return this(n(e),t,r,{})},"string, Array, Object, Object":function(e,t,r,i){return this(n(e),t,r,i)},"Node, Object":function(e,t){return this(e,this.rules,t,{})},"Node, Object, Object":function(e,t,r){return this(e,this.rules,t,r)},Node:function(e){return this(e,this.rules,{},{})},"Node, Array":function(e,t){return this(e,t,{},{})},"Node, Array, Object":function(e,t,r){return this(e,t,r,{})},"Node, Array, Object, Object":function(e,t,r,i){t=function(e){for(var t=[],r=0;r");if(2!==s.length)throw SyntaxError("Could not parse rule: "+i);i={l:s[0],r:s[1]};case"object":if(a={l:T(n(i.l)),r:T(n(i.r))},i.context&&(a.evaluate=i.context),i.evaluate&&(a.evaluate=n(i.evaluate)),S(a.l)){var u=C(a.l),c=new v("_p"+I++);a.expanded={},a.expanded.l=u([a.l.clone(),c]),E(a.expanded.l),A(a.expanded.l),a.expanded.r=u([a.r,c])}break;case"function":a=i;break;default:throw TypeError("Unsupported type of rule: "+o)}t.push(a)}return t}(t);for(var a=w(e,r),o={},s=(a=T(a)).toString({parenthesis:"all"});!o[s];){o[s]=!0,I=0;for(var u=0;u=2&&2===e.args.length){for(var i=function(e,t){var r,n,i=[],a=C(e);if(M(e,t))for(var o=0;o2)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}for(var u=[],c=0;c0){for(var n=d(e,t.args[0],r),i=1;i0){var n=e.args.filter((function(e){return void 0===t[e]})),i=1===n.length?n[0]:new f("*","multiply",n),s=r.concat(y(i,t));return new f("*","multiply",s)}return new f("+","add",e.args.map((function(r){return new f("*","multiply",e.args.map((function(e){return e===r?y(e,t):e.clone()})))})))}if("/"===e.op&&e.isBinary()){var u=e.args[0],l=e.args[1];return void 0!==t[l]?new f("/","divide",[y(u,t),l]):void 0!==t[u]?new f("*","multiply",[new f("-","unaryMinus",[u]),new f("/","divide",[y(l,t),new f("^","pow",[l.clone(),g(2)])])]):new f("/","divide",[new f("-","subtract",[new f("*","multiply",[y(u,t),l.clone()]),new f("*","multiply",[u.clone(),y(l,t)])]),new f("^","pow",[l.clone(),g(2)])])}if("^"===e.op&&e.isBinary()){var p=e.args[0],m=e.args[1];if(void 0!==t[p])return z(p)&&(o(p.value)||a(p.value,1))?g(0):new f("*","multiply",[e,new f("*","multiply",[new c("log",[p.clone()]),y(m.clone(),t)])]);if(void 0!==t[m]){if(z(m)){if(o(m.value))return g(0);if(a(m.value,1))return y(p,t)}var h=new f("^","pow",[p.clone(),new f("-","subtract",[m,g(1)])]);return new f("*","multiply",[m.clone(),new f("*","multiply",[y(p,t),h])])}return new f("*","multiply",[new f("^","pow",[p.clone(),m.clone()]),new f("+","add",[new f("*","multiply",[y(p,t),new f("/","divide",[m.clone(),p.clone()])]),new f("*","multiply",[y(m,t),new c("log",[p.clone()])])])])}throw new Error('Operator "'+e.op+'" is not supported by derivative, or a wrong number of arguments is passed')}});function g(e,t){return new u(s(e,t||r.number))}return m})),Ac=Xe("rationalize",["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplify","?bignumber","?fraction","mathWithTransform","ConstantNode","OperatorNode","FunctionNode","SymbolNode","ParenthesisNode"],(function(e){var t=e.config,r=e.typed,n=e.equal,i=e.isZero,a=e.add,o=e.subtract,s=e.multiply,u=e.divide,c=e.pow,f=e.parse,l=e.simplify,p=e.fraction,m=e.bignumber,h=e.mathWithTransform,d=e.ConstantNode,y=e.OperatorNode,g=e.FunctionNode,v=e.SymbolNode,x=e.ParenthesisNode,b=wc({typed:r,config:t,mathWithTransform:h,fraction:p,bignumber:m,ConstantNode:d,OperatorNode:y,FunctionNode:g,SymbolNode:v}),w=bc({equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:u,pow:c,ConstantNode:d,OperatorNode:y,FunctionNode:g,ParenthesisNode:x});return r("rationalize",{string:function(e){return this(f(e),{},!1)},"string, boolean":function(e,t){return this(f(e),{},t)},"string, Object":function(e,t){return this(f(e),t,!1)},"string, Object, boolean":function(e,t,r){return this(f(e),t,r)},Node:function(e){return this(e,{},!1)},"Node, boolean":function(e,t){return this(e,{},t)},"Node, Object":function(e,t){return this(e,t,!1)},"Node, Object, boolean":function(e,t,r){var n=function(){var e=[w,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},b,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}],t=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],r=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],n={};return n.firstRules=e.concat(t,r),n.distrDivRules=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],n.sucDivRules=r,n.firstRulesAgain=e.concat(t),n.finalRules=[w,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},b,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],n}(),i=function(e,t,r,n){var i=[],a=l(e,n,t,{exactFractions:!1}),o="+-*"+((r=!!r)?"/":"");!function e(t){var r=t.type;if("FunctionNode"===r)throw new Error("There is an unsolved function call");if("OperatorNode"===r)if("^"===t.op){if("ConstantNode"!==t.args[1].type||!V(parseFloat(t.args[1].value)))throw new Error("There is a non-integer exponent");e(t.args[0])}else{if(-1===o.indexOf(t.op))throw new Error("Operator "+t.op+" invalid in polynomial expression");for(var n=0;n=1){var o,s;e=function e(t,r,n){var i=t.type,a=arguments.length>1;if("OperatorNode"===i&&t.isBinary()){var o,s=!1;if("^"===t.op&&("ParenthesisNode"!==t.args[0].type&&"OperatorNode"!==t.args[0].type||"ConstantNode"!==t.args[1].type||(o=parseFloat(t.args[1].value),s=o>=2&&V(o))),s){if(o>2){var u=t.args[0],c=new y("^","pow",[t.args[0].cloneDeep(),new d(o-1)]);t=new y("*","multiply",[u,c])}else t=new y("*","multiply",[t.args[0],t.args[0].cloneDeep()]);a&&("content"===n?r.content=t:r.args[n]=t)}}if("ParenthesisNode"===i)e(t.content,t,"content");else if("ConstantNode"!==i&&"SymbolNode"!==i)for(var f=0;fn&&(t[c]=0),t[c]+=o.cte*("+"===o.oper?1:-1),void(n=Math.max(c,n))}o.cte=c,""===o.fire&&(t[0]+=o.cte*("+"===o.oper?1:-1))}}(e,null,r);for(var a,o=!0,s=n=t.length-1;s>=0;s--)if(0!==t[s]){var u=new d(o?t[s]:Math.abs(t[s])),c=t[s]<0?"-":"+";if(s>0){var f=new v(i);if(s>1){var l=new d(s);f=new y("^","pow",[f,l])}u=-1===t[s]&&o?new y("-","unaryMinus",[f]):1===Math.abs(t[s])?f:new y("*","multiply",[u,f])}a=o?u:"+"===c?new y("+","add",[a,u]):new y("-","subtract",[a,u]),o=!1}return o?new d(0):a}})),Oc=Xe("reviver",["classes"],(function(e){var t=e.classes;return function(e,r){var n=t[r&&r.mathjs];return n&&"function"==typeof n.fromJSON?n.fromJSON(r):r}})),Cc=Xe("replacer",[],(function(){return function(e,t){return"number"!=typeof t||isFinite(t)&&!isNaN(t)?t:{mathjs:"number",value:String(t)}}})),_c=Math.PI,Tc=2*Math.PI,qc=Math.E,zc=Xe("true",[],(function(){return!0})),Ic=Xe("false",[],(function(){return!1})),Bc=Xe("null",[],(function(){return null})),kc=Xc("Infinity",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(1/0):1/0})),Dc=Xc("NaN",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(NaN):NaN})),Rc=Xc("pi",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?Ya(r):_c})),jc=Xc("tau",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?Xa(r):Tc})),Pc=Xc("e",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?Wa(r):qc})),Uc=Xc("phi",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?Ja(r):1.618033988749895})),Fc=Xc("LN2",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(2).ln():Math.LN2})),Lc=Xc("LN10",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(10).ln():Math.LN10})),Hc=Xc("LOG2E",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(1).div(new r(2).ln()):Math.LOG2E})),$c=Xc("LOG10E",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(1).div(new r(10).ln()):Math.LOG10E})),Gc=Xc("SQRT1_2",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r("0.5").sqrt():Math.SQRT1_2})),Vc=Xc("SQRT2",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(2).sqrt():Math.SQRT2})),Zc=Xc("i",["Complex"],(function(e){return e.Complex.I})),Wc=Xe("PI",["pi"],(function(e){return e.pi})),Jc=Xe("E",["e"],(function(e){return e.e})),Yc=Xe("version",[],(function(){return"9.0.0"}));function Xc(e,t,r){return Xe(e,t,r,{recreateOnConfigChange:!0})}var Qc=Jf("speedOfLight","299792458","m s^-1"),Kc=Jf("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),ef=Jf("planckConstant","6.62607015e-34","J s"),tf=Jf("reducedPlanckConstant","1.0545718176461565e-34","J s"),rf=Jf("magneticConstant","1.25663706212e-6","N A^-2"),nf=Jf("electricConstant","8.8541878128e-12","F m^-1"),af=Jf("vacuumImpedance","376.730313667","ohm"),of=Jf("coulomb","8.987551792261171e9","N m^2 C^-2"),sf=Jf("elementaryCharge","1.602176634e-19","C"),uf=Jf("bohrMagneton","9.2740100783e-24","J T^-1"),cf=Jf("conductanceQuantum","7.748091729863649e-5","S"),ff=Jf("inverseConductanceQuantum","12906.403729652257","ohm"),lf=Jf("magneticFluxQuantum","2.0678338484619295e-15","Wb"),pf=Jf("nuclearMagneton","5.0507837461e-27","J T^-1"),mf=Jf("klitzing","25812.807459304513","ohm"),hf=Jf("bohrRadius","5.29177210903e-11","m"),df=Jf("classicalElectronRadius","2.8179403262e-15","m"),yf=Jf("electronMass","9.1093837015e-31","kg"),gf=Jf("fermiCoupling","1.1663787e-5","GeV^-2"),vf=Yf("fineStructure",.0072973525693),xf=Jf("hartreeEnergy","4.3597447222071e-18","J"),bf=Jf("protonMass","1.67262192369e-27","kg"),wf=Jf("deuteronMass","3.3435830926e-27","kg"),Nf=Jf("neutronMass","1.6749271613e-27","kg"),Mf=Jf("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),Sf=Jf("rydberg","10973731.568160","m^-1"),Ef=Jf("thomsonCrossSection","6.6524587321e-29","m^2"),Af=Yf("weakMixingAngle",.2229),Of=Yf("efimovFactor",22.7),Cf=Jf("atomicMass","1.66053906660e-27","kg"),_f=Jf("avogadro","6.02214076e23","mol^-1"),Tf=Jf("boltzmann","1.380649e-23","J K^-1"),qf=Jf("faraday","96485.33212331001","C mol^-1"),zf=Jf("firstRadiation","3.7417718521927573e-16","W m^2"),If=Jf("loschmidt","2.686780111798444e25","m^-3"),Bf=Jf("gasConstant","8.31446261815324","J K^-1 mol^-1"),kf=Jf("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),Df=Jf("molarVolume","0.022413969545014137","m^3 mol^-1"),Rf=Yf("sackurTetrode",-1.16487052358),jf=Jf("secondRadiation","0.014387768775039337","m K"),Pf=Jf("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),Uf=Jf("wienDisplacement","2.897771955e-3","m K"),Ff=Jf("molarMass","0.99999999965e-3","kg mol^-1"),Lf=Jf("molarMassC12","11.9999999958e-3","kg mol^-1"),Hf=Jf("gravity","9.80665","m s^-2"),$f=Jf("planckLength","1.616255e-35","m"),Gf=Jf("planckMass","2.176435e-8","kg"),Vf=Jf("planckTime","5.391245e-44","s"),Zf=Jf("planckCharge","1.87554603778e-18","C"),Wf=Jf("planckTemperature","1.416785e+32","K");function Jf(e,t,r){return Xe(e,["config","Unit","BigNumber"],(function(e){var n=e.config,i=e.Unit,a=e.BigNumber,o=new i("BigNumber"===n.number?new a(t):parseFloat(t),r);return o.fixPrefix=!0,o}))}function Yf(e,t){return Xe(e,["config","BigNumber"],(function(e){var r=e.config,n=e.BigNumber;return"BigNumber"===r.number?new n(t):t}))}var Xf=Xe("apply",["typed","isInteger"],(function(e){var t=e.typed,r=e.isInteger,n=wr({typed:t,isInteger:r});return t("apply",{"...any":function(e){var t=e[1];a(t)?e[1]=t-1:o(t)&&(e[1]=t.minus(1));try{return n.apply(null,e)}catch(e){throw ds(e)}}})}),{isTransformFunction:!0}),Qf=Xe("column",["typed","Index","matrix","range"],(function(e){var t=e.typed,r=e.Index,n=e.matrix,i=e.range,o=Hn({typed:t,Index:r,matrix:n,range:i});return t("column",{"...any":function(e){var t=e.length-1,r=e[t];a(r)&&(e[t]=r-1);try{return o.apply(null,e)}catch(e){throw ds(e)}}})}),{isTransformFunction:!0});function Kf(e,t,r){var n=e.filter((function(e){return F(e)&&!(e.name in t)&&!(e.name in r)}))[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var i=n.name,a=Object.create(r),o=e.compile();return function(e){return a[i]=e,o.evaluate(a)}}var el=Xe("filter",["typed"],(function(e){var t=e.typed;function r(e,t,r){var i,a;return e[0]&&(i=e[0].compile().evaluate(r)),e[1]&&(a=F(e[1])||I(e[1])?e[1].compile().evaluate(r):Kf(e[1],t,r)),n(i,a)}r.rawArgs=!0;var n=t("filter",{"Array, function":tl,"Matrix, function":function(e,t){return e.create(tl(e.toArray(),t))},"Array, RegExp":De,"Matrix, RegExp":function(e,t){return e.create(De(e.toArray(),t))}});return r}),{isTransformFunction:!0});function tl(e,t){var r=Jn(t);return ke(e,(function(e,n,i){return 1===r?t(e):2===r?t(e,[n+1]):t(e,[n+1],i)}))}var rl=Xe("forEach",["typed"],(function(e){var t=e.typed;function r(e,t,r){var i,a;return e[0]&&(i=e[0].compile().evaluate(r)),e[1]&&(a=F(e[1])||I(e[1])?e[1].compile().evaluate(r):Kf(e[1],t,r)),n(i,a)}r.rawArgs=!0;var n=t("forEach",{"Array | Matrix, function":function(e,t){var r=Jn(t);!function n(i,a){Array.isArray(i)?Be(i,(function(e,t){n(e,a.concat(t+1))})):1===r?t(i):2===r?t(i,a):t(i,a,e)}(e.valueOf(),[])}});return r}),{isTransformFunction:!0}),nl=Xe("index",["Index"],(function(e){var t=e.Index;return function(){for(var e=[],r=0,n=arguments.length;r0?0:2;else if(i&&!0===i.isSet)i=i.map((function(e){return e-1}));else if(l(i)||p(i))i=i.map((function(e){return e-1}));else if(a(i))i--;else if(o(i))i=i.toNumber()-1;else if("string"!=typeof i)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");e[r]=i}var s=new t;return t.apply(s,e),s}}),{isTransformFunction:!0}),il=Xe("map",["typed"],(function(e){var t=e.typed;function r(e,t,r){var i,a;return e[0]&&(i=e[0].compile().evaluate(r)),e[1]&&(a=F(e[1])||I(e[1])?e[1].compile().evaluate(r):Kf(e[1],t,r)),n(i,a)}r.rawArgs=!0;var n=t("map",{"Array, function":function(e,t){return al(e,t,e)},"Matrix, function":function(e,t){return e.create(al(e.valueOf(),t,e))}});return r}),{isTransformFunction:!0});function al(e,t,r){var n=Jn(t);return function e(i,a){return Array.isArray(i)?Ie(i,(function(t,r){return e(t,a.concat(r+1))})):1===n?t(i):2===n?t(i,a):t(i,a,r)}(e,[])}var ol=Xe("max",["typed","config","numeric","larger"],(function(e){var t=e.typed,r=e.config,n=e.numeric,i=e.larger,s=La({typed:t,config:r,numeric:n,larger:i});return t("max",{"...any":function(e){if(2===e.length&&m(e[0])){var t=e[1];a(t)?e[1]=t-1:o(t)&&(e[1]=t.minus(1))}try{return s.apply(null,e)}catch(e){throw ds(e)}}})}),{isTransformFunction:!0}),sl=Xe("mean",["typed","add","divide"],(function(e){var t=e.typed,r=e.add,n=e.divide,i=Uu({typed:t,add:r,divide:n});return t("mean",{"...any":function(e){if(2===e.length&&m(e[0])){var t=e[1];a(t)?e[1]=t-1:o(t)&&(e[1]=t.minus(1))}try{return i.apply(null,e)}catch(e){throw ds(e)}}})}),{isTransformFunction:!0}),ul=Xe("min",["typed","config","numeric","smaller"],(function(e){var t=e.typed,r=e.config,n=e.numeric,i=e.smaller,s=Ha({typed:t,config:r,numeric:n,smaller:i});return t("min",{"...any":function(e){if(2===e.length&&m(e[0])){var t=e[1];a(t)?e[1]=t-1:o(t)&&(e[1]=t.minus(1))}try{return s.apply(null,e)}catch(e){throw ds(e)}}})}),{isTransformFunction:!0}),cl=Xe("range",["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq"],(function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.bignumber,a=e.smaller,o=e.smallerEq,s=e.larger,u=e.largerEq,c=li({typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:u});return t("range",{"...any":function(e){return"boolean"!=typeof e[e.length-1]&&e.push(!0),c.apply(null,e)}})}),{isTransformFunction:!0}),fl=Xe("row",["typed","Index","matrix","range"],(function(e){var t=e.typed,r=e.Index,n=e.matrix,i=e.range,o=gi({typed:t,Index:r,matrix:n,range:i});return t("row",{"...any":function(e){var t=e.length-1,r=e[t];a(r)&&(e[t]=r-1);try{return o.apply(null,e)}catch(e){throw ds(e)}}})}),{isTransformFunction:!0}),ll=Xe("subset",["typed","matrix"],(function(e){var t=e.typed,r=e.matrix,n=Ci({typed:t,matrix:r});return t("subset",{"...any":function(e){try{return n.apply(null,e)}catch(e){throw ds(e)}}})}),{isTransformFunction:!0}),pl=Xe("concat",["typed","matrix","isInteger"],(function(e){var t=e.typed,r=e.matrix,n=e.isInteger,i=Fn({typed:t,matrix:r,isInteger:n});return t("concat",{"...any":function(e){var t=e.length-1,r=e[t];a(r)?e[t]=r-1:o(r)&&(e[t]=r.minus(1));try{return i.apply(null,e)}catch(e){throw ds(e)}}})}),{isTransformFunction:!0}),ml=Xe("diff",["typed","matrix","subtract","number","bignumber"],(function(e){var t=e.typed,r=e.matrix,n=e.subtract,i=e.number,s=e.bignumber,u=oi({typed:t,matrix:r,subtract:n,number:i,bignumber:s});return t("diff",{"...any":function(e){if(2===e.length&&m(e[0])){var t=e[1];a(t)?e[1]=t-1:o(t)&&(e[1]=t.minus(1))}try{return u.apply(null,e)}catch(e){throw ds(e)}}})}),{isTransformFunction:!0}),hl=Xe("std",["typed","sqrt","variance"],(function(e){var t=e.typed,r=e.sqrt,n=e.variance,i=Gu({typed:t,sqrt:r,variance:n});return t("std",{"...any":function(e){if(e.length>=2&&m(e[0])){var t=e[1];a(t)?e[1]=t-1:o(t)&&(e[1]=t.minus(1))}try{return i.apply(null,e)}catch(e){throw ds(e)}}})}),{isTransformFunction:!0}),dl=Xe("sum",["typed","config","add","numeric"],(function(e){var t=e.typed,r=e.config,n=e.add,i=e.numeric,s=Pu({typed:t,config:r,add:n,numeric:i});return t("sum",{"...any":function(e){if(2===e.length&&m(e[0])){var t=e[1];a(t)?e[1]=t-1:o(t)&&(e[1]=t.minus(1))}try{return s.apply(null,e)}catch(e){throw ds(e)}}})}),{isTransformFunction:!0}),yl=Xe("variance",["typed","add","subtract","multiply","divide","apply","isNaN"],(function(e){var t=e.typed,r=e.add,n=e.subtract,i=e.multiply,s=e.divide,u=e.apply,c=e.isNaN,f=Hu({typed:t,add:r,subtract:n,multiply:i,divide:s,apply:u,isNaN:c});return t("variance",{"...any":function(e){if(e.length>=2&&m(e[0])){var t=e[1];a(t)?e[1]=t-1:o(t)&&(e[1]=t.minus(1))}try{return f.apply(null,e)}catch(e){throw ds(e)}}})}),{isTransformFunction:!0}),gl=r(10),vl=r.n(gl);function xl(e){return(xl="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 bl(e,t,r,n){function i(t,i,o){var s;if(o.wrap&&"function"==typeof i&&(i=function(e){var t=function(){for(var t=[],n=0,i=arguments.length;n2&&void 0!==arguments[2]?arguments[2]:t.fn;if(Fe(a,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(a));var o=g(t)?r.expression.transform:r,s=a in r.expression.transform,u=Je(o,a)?o[a]:void 0,c=function(){var n={};t.dependencies.map(Ke).forEach((function(e){if(Fe(e,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?n.math=r:"mathWithTransform"===e?n.mathWithTransform=r.expression.mathWithTransform:"classes"===e?n.classes=r:n[e]=r[e]}));var o=t(n);if(o&&"function"==typeof o.transform)throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(void 0===u||i.override)return o;if(h(u)&&h(o))return e(u,o);if(i.silent)return u;throw new Error('Cannot import "'+a+'": already exists')};t.meta&&!1===t.meta.lazy?(o[a]=c(),u&&s?f(a):(g(t)||y(t))&&We(r.expression.mathWithTransform,a,(function(){return o[a]}))):(We(o,a,c),u&&s?f(a):(g(t)||y(t))&&We(r.expression.mathWithTransform,a,(function(){return o[a]}))),n[a]=t,r.emit("import",a,c)}function m(e){return"function"==typeof e||"number"==typeof e||"string"==typeof e||"boolean"==typeof e||null===e||c(e)||s(e)||o(e)||u(e)||p(e)||Array.isArray(e)}function h(e){return"function"==typeof e&&"object"===xl(e.signatures)}function d(e){return!Je(v,e)}function y(e){return!(-1!==e.fn.indexOf(".")||Je(v,e.fn)||e.meta&&e.meta.isClass)}function g(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction||!1}var v={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(e,t){var r=arguments.length;if(1!==r&&2!==r)throw new mi("import",r,1,2);function n(e,r,i){if(Array.isArray(r))r.forEach((function(t){return n(e,t)}));else if("object"===xl(r))for(var a in r)Je(r,a)&&n(e,r[a],a);else if(Qe(r)||void 0!==i){var o=Qe(r)?g(r)?r.fn+".transform":r.fn:i;if(Je(e,o)&&e[o]!==r&&!t.silent)throw new Error('Cannot import "'+o+'" twice');e[o]=r}else if(!t.silent)throw new TypeError("Factory, Object, or Array expected")}t||(t={});var a={};for(var o in n(a,e),a)if(Je(a,o)){var s=a[o];if(Qe(s))l(s,t);else if(m(s))i(o,s,t);else if(!t.silent)throw new TypeError("Factory, Object, or Array expected")}}}var wl={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},Nl=["Matrix","Array"],Ml=["number","BigNumber","Fraction"];function Sl(e,t){function r(r){if(r){var n=$e(e,He);El(r,"matrix",Nl),El(r,"number",Ml),function e(t,r){if(Array.isArray(r))throw new TypeError("Arrays are not supported by deepExtend");for(var n in r)if(Je(r,n)&&!(n in Object.prototype)&&!(n in Function.prototype))if(r[n]&&r[n].constructor===Object)void 0===t[n]&&(t[n]={}),t[n]&&t[n].constructor===Object?e(t[n],r[n]):t[n]=r[n];else{if(Array.isArray(r[n]))throw new TypeError("Arrays are not supported by deepExtend");t[n]=r[n]}return t}(e,r);var i=$e(e,He),a=$e(r,He);return t("config",i,n,a),i}return $e(e,He)}return r.MATRIX_OPTIONS=Nl,r.NUMBER_OPTIONS=Ml,Object.keys(wl).forEach((function(t){Object.defineProperty(r,t,{get:function(){return e[t]},enumerable:!0,configurable:!0})})),r}function El(e,t,r){var n,i;void 0!==e[t]&&(n=r,i=e[t],-1===n.indexOf(i))&&console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+r.map((function(e){return JSON.stringify(e)})).join(", ")+".")}function Al(){return(Al=Object.assign||function(e){for(var t=1;t{ return 1900; };
- this.maxYearCallback = ()=>{ return new Date().getFullYear() + this.maxYearOffset; }
- this.twoDigitYearCapOffset = 10;
-});
-mexui.util.extend(mexui.Control.Date, mexui.Control.TextInput);
-
-// static
-mexui.Control.Date.units = ['day', 'month', 'year'];
-
-// default styles
-mexui.util.linkBaseControlStyles('Date', {
- arrow:
- {
- backgroundColour: toColour(90, 90, 80, 230),
- textColour: toColour(0, 0, 0, 255)
- }
-});
-
-// input
-mexui.Control.Date.prototype.onMouseDown = function(e)
-{
- if(this.inputShown)
- {
- var arrowIndex = this.getArrowIndexByCursor();
- if(arrowIndex !== false)
- {
- var propIndex = (Math.ceil((arrowIndex + 1) / 2)) - 1;
- var propName = mexui.Control.Date.units[propIndex];
- var isIncrease = (arrowIndex % 2) == 1;
-
- if(isIncrease)
- this[propName]++;
- else
- this[propName]--;
-
- if(this.day == 0)
- this.day = 31;
- else if(this.day == 32)
- this.day = 1;
-
- if(this.month == 0)
- this.month = 12;
- else if(this.month == 13)
- this.month = 1;
-
- var minYear = this.minYearCallback();
- var maxYear = this.maxYearCallback();
- if(this.year < minYear)
- this.year = minYear;
- else if(this.year > maxYear)
- this.year = maxYear;
-
- this.generateText();
-
- return;
- }
- }
-
- if(this.isCursorOverControl())
- {
- this.inputShown = !this.inputShown;
- e.used = true;
- return;
- }
-
- if(this.inputShown)
- {
- this.inputShown = false;
- e.used = true;
- return;
- }
-};
-
-// render
-mexui.Control.Date.prototype.renderAfter = function()
-{
- if(!this.inputShown)
- return;
-
- var screenPos = this.getScreenPosition();
-
- var pos = new Vec2(screenPos.x, screenPos.y);
- for(var i=0; i<3; i++)
- {
- mexui.native.drawRectangle(pos, this.valueBoxSize, this.getStyles('main'));
- mexui.native.drawText(pos, this.valueBoxSize, this[mexui.Control.Date.units[i]], this.getStyles('main'));
-
- pos.x += this.valueBoxSize.x;
- }
-
- pos = new Vec2(screenPos.x, screenPos.y);
- pos.y += this.valueBoxSize.y;
- for(var i=0; i<3; i++)
- {
- for(var i2=0; i2<2; i2++)
- {
- var text = (i2 % 2) == 0 ? '<' : '>';
-
- mexui.native.drawRectangle(pos, this.arrowBoxSize, this.getStyles('main'));
- mexui.native.drawText(pos, this.arrowBoxSize, text, this.getStyles('main'));
-
- pos.x += this.arrowBoxSize.x;
- }
- }
-};
-
-// model
-mexui.Control.Date.prototype.generateText = function()
-{
- this.setText((this.day < 10 ? '0'+this.day : this.day)
- +'/'+(this.month < 10 ? '0'+this.month : this.month)
- +'/'+(this.year < 10 ? '0'+this.year : this.year));
-};
-
-mexui.Control.Date.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isPositiveIntChar(character) || mexui.util.isLetter(character) || character == '/';
-};
-
-mexui.Control.Date.prototype.validateValueCallback = function(e)
-{
- var parts = this.getText().split('/');
-
- if(parts.length != 3)
- return false;
-
- for(var i in parts)
- {
- var partAsStr = parts[i];
- if(partAsStr === '')
- return false;
-
- if(i == 0)
- {
- if(!mexui.util.isDayIdWithOptionalSuffix(partAsStr))
- return false;
- }
- else if(i == 1)
- {
- if(!mexui.util.isMonthIdOrName(partAsStr))
- return false;
- }
- else if(i == 2)
- {
- if(!mexui.util.isYear(partAsStr, this.minYearCallback(), this.maxYearCallback(), this.twoDigitYearCapOffset))
- return false;
- }
- }
-
- return true;
-};
-
-mexui.Control.Date.prototype.getArrowIndexByCursor = function()
-{
- var cursorPos = gui.cursorPosition;
-
- var screenPos = this.getScreenPosition();
- var firstArrowStartPos = new Vec2(screenPos.x, screenPos.y + this.valueBoxSize.y);
- var lastArrowEndPos = new Vec2(screenPos.x + (this.arrowBoxSize.x * 6), screenPos.y + this.valueBoxSize.y + this.arrowBoxSize.y);
-
- if(cursorPos.x >= firstArrowStartPos.x && cursorPos.y >= firstArrowStartPos.y && cursorPos.x <= lastArrowEndPos.x && cursorPos.y <= lastArrowEndPos.y)
- {
- return Math.floor((cursorPos.x - firstArrowStartPos.x) / this.arrowBoxSize.x);
- }
- else
- {
- return false;
- }
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Day.js b/third-party/mexui/Core/Control/Day.js
deleted file mode 100644
index 6fd76806..00000000
--- a/third-party/mexui/Core/Control/Day.js
+++ /dev/null
@@ -1,16 +0,0 @@
-mexui.util.createControlConstructor('Day', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('Day', styles), callback, false, false);
-});
-mexui.util.extend(mexui.Control.Day, mexui.Control.TextInput);
-
-// model
-mexui.Control.Day.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isPositiveIntChar(character) || mexui.util.isLetter(character);
-};
-
-mexui.Control.Day.prototype.validateValueCallback = function(e)
-{
- return mexui.util.isDayIdWithOptionalSuffix(this.getText());
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Digit.js b/third-party/mexui/Core/Control/Digit.js
deleted file mode 100644
index f4d655cd..00000000
--- a/third-party/mexui/Core/Control/Digit.js
+++ /dev/null
@@ -1,11 +0,0 @@
-mexui.util.createControlConstructor('Digit', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('Digit', styles), callback, true, false);
-});
-mexui.util.extend(mexui.Control.Digit, mexui.Control.TextInput);
-
-// model
-mexui.Control.Digit.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isDigit(character);
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Digits.js b/third-party/mexui/Core/Control/Digits.js
deleted file mode 100644
index 61b9c63b..00000000
--- a/third-party/mexui/Core/Control/Digits.js
+++ /dev/null
@@ -1,11 +0,0 @@
-mexui.util.createControlConstructor('Digits', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('Digits', styles), callback, false, true);
-});
-mexui.util.extend(mexui.Control.Digits, mexui.Control.TextInput);
-
-// model
-mexui.Control.Digits.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isDigit(character);
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/DropDown.js b/third-party/mexui/Core/Control/DropDown.js
deleted file mode 100644
index ac394e3e..00000000
--- a/third-party/mexui/Core/Control/DropDown.js
+++ /dev/null
@@ -1,160 +0,0 @@
-mexui.util.createControlConstructor('DropDown', true, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('DropDown', styles), callback);
- mexui.Entity.ControlWithEntries.call(this, true, true, new Vec2(0, h), new Vec2(w + 120, 25));
-
- this.axis.y.entriesShown = false;
-
- this.text = text;
-
- this.arrowShown = true;
- this.selectedEntryIndex = -1;
- this.hoveredEntryIndex = -1;
-});
-
-// default styles
-mexui.util.linkBaseControlStyles('DropDown', {
- item:
- {
- backgroundColour: toColour(255, 255, 255, 255),
- textColour: toColour(0, 0, 0, 255),
-
- hover:
- {
- backgroundColour: toColour(80, 80, 80, 255),
- textColour: toColour(0, 0, 0, 255)
- }
- }
-});
-
-// input
-mexui.Control.DropDown.prototype.onMouseDown = function(e)
-{
- if(e.button == 0)
- {
- if(this.axis.y.entries.length == 0)
- return;
-
- var hitButton = this.isCursorOverControl();
- if(hitButton)
- {
- e.used = true;
- this.setListShown(!this.axis.y.entriesShown);
- }
- else if(this.isListShown())
- {
- var selectedEntryIndex = this.axis.y.getEntryIndexByCursor();
- if(selectedEntryIndex != null)
- {
- this.selectEntryByIndex(selectedEntryIndex);
- e.used = true;
- }
- }
- }
-
- if(!e.used)
- mexui.Entity.ControlWithEntries.prototype.onMouseDown.call(this, e);
-};
-
-mexui.Control.DropDown.prototype.onKeyDown = function(e, key, mods)
-{
- if(this.isFocused())
- {
- if(key == SDLK_RETURN || key == SDLK_RETURN2 || key == SDLK_KP_ENTER || key == SDLK_SPACE)
- {
- var selectedEntryIndex = this.axis.y.getEntryIndexByCursor();
- if(selectedEntryIndex == null)
- {
- this.setListShown(!this.isListShown());
- e.used = true;
- }
- else
- {
- this.selectEntryByIndex(selectedEntryIndex);
- e.used = true;
- }
- }
- }
-};
-
-// render
-mexui.Control.DropDown.prototype.render = function()
-{
- var pos = this.getScreenPosition();
-
- mexui.native.drawRectangle(pos, this.size, this.getStyles('main'));
-
- var text = this.selectedEntryIndex == -1 ? this.text : this.axis.y.entries[this.selectedEntryIndex].text;
- mexui.native.drawText(pos, this.size, text, this.getStyles('main'));
-
- if(this.arrowShown)
- {
- var pos2 = new Vec2(pos.x + this.size.x - (25 + 3), pos.y + 0);
- mexui.native.drawImage(pos2, new Vec2(25, 25), mexui.images.downArrow, this.getStyles('main'));
- }
-
- mexui.Entity.ControlWithEntries.prototype.render.call(this);
-
- if(this.isFocused())
- mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
-};
-
-mexui.Control.DropDown.prototype.renderAfter = function()
-{
- if(this.axis.y.entriesShown)
- {
- var pos = this.getScreenPosition();
- var pos2 = new Vec2(pos.x, pos.y);
-
- pos.x += this.entriesPositionOffset.x;
- pos.y += this.entriesPositionOffset.y;
-
- pos2.x += this.entriesPositionOffset.x;
- pos2.y += this.entriesPositionOffset.y;
-
- for(var i=this.axis.y.getEntryStartIndex(),j=this.axis.y.getEntryEndIndex(); i maxColumnHeight)
- {
- maxColumnHeight = column.height;
- }
- }
-
- var startY = pos.y + maxColumnHeight;
- mexui.native.drawAALine(new Vec2(pos.x, startY), new Vec2(pos.x + this.size.x, startY), this.getStyles('row'));
-
- for(var i=this.axis.y.getEntryStartIndex(),j=this.axis.y.getEntryEndIndex(); i 23)
- return false;
-
- return true;
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Image.js b/third-party/mexui/Core/Control/Image.js
deleted file mode 100644
index 1231ab5f..00000000
--- a/third-party/mexui/Core/Control/Image.js
+++ /dev/null
@@ -1,20 +0,0 @@
-mexui.util.createControlConstructor('Image', false, function(window, x, y, w, h, filePath, styles)
-{
- mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('Image', styles));
-
- this.image = mexui.native.loadImage(filePath);
-});
-
-// default styles
-mexui.util.linkBaseControlStyles('Image', {});
-
-// render
-mexui.Control.Image.prototype.render = function()
-{
- var pos = this.getScreenPosition();
-
- mexui.native.drawImage(pos, this.size, this.image, this.getStyles('main'));
-
- if(this.isFocused())
- mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Integer.js b/third-party/mexui/Core/Control/Integer.js
deleted file mode 100644
index ec00e46c..00000000
--- a/third-party/mexui/Core/Control/Integer.js
+++ /dev/null
@@ -1,16 +0,0 @@
-mexui.util.createControlConstructor('Integer', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('Integer', styles), callback, false, false);
-});
-mexui.util.extend(mexui.Control.Integer, mexui.Control.TextInput);
-
-// model
-mexui.Control.Integer.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isIntChar(character);
-};
-
-mexui.Control.Integer.prototype.validateValueCallback = function(e)
-{
- return mexui.util.isInt(this.getText());
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Letter.js b/third-party/mexui/Core/Control/Letter.js
deleted file mode 100644
index e64ad846..00000000
--- a/third-party/mexui/Core/Control/Letter.js
+++ /dev/null
@@ -1,11 +0,0 @@
-mexui.util.createControlConstructor('Letter', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('Letter', styles), callback, true, false);
-});
-mexui.util.extend(mexui.Control.Letter, mexui.Control.TextInput);
-
-// model
-mexui.Control.Letter.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isLetter(character);
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/LetterDigit.js b/third-party/mexui/Core/Control/LetterDigit.js
deleted file mode 100644
index a8ddd067..00000000
--- a/third-party/mexui/Core/Control/LetterDigit.js
+++ /dev/null
@@ -1,11 +0,0 @@
-mexui.util.createControlConstructor('LetterDigit', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('LetterDigit', styles), callback, true, false);
-});
-mexui.util.extend(mexui.Control.LetterDigit, mexui.Control.TextInput);
-
-// model
-mexui.Control.LetterDigit.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isLetterOrDigit(character);
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Letters.js b/third-party/mexui/Core/Control/Letters.js
deleted file mode 100644
index c812f859..00000000
--- a/third-party/mexui/Core/Control/Letters.js
+++ /dev/null
@@ -1,11 +0,0 @@
-mexui.util.createControlConstructor('Letters', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('Letters', styles), callback, false, true);
-});
-mexui.util.extend(mexui.Control.Letters, mexui.Control.TextInput);
-
-// model
-mexui.Control.Letters.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isLetter(character);
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/LettersDigits.js b/third-party/mexui/Core/Control/LettersDigits.js
deleted file mode 100644
index c5584abe..00000000
--- a/third-party/mexui/Core/Control/LettersDigits.js
+++ /dev/null
@@ -1,11 +0,0 @@
-mexui.util.createControlConstructor('LettersDigits', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('LettersDigits', styles), callback, false, true);
-});
-mexui.util.extend(mexui.Control.LettersDigits, mexui.Control.TextInput);
-
-// model
-mexui.Control.LettersDigits.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isLetterOrDigit(character);
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Line.js b/third-party/mexui/Core/Control/Line.js
deleted file mode 100644
index bc66f26d..00000000
--- a/third-party/mexui/Core/Control/Line.js
+++ /dev/null
@@ -1,23 +0,0 @@
-mexui.util.createControlConstructor('Line', false, function(window, x, y, w, h, styles, callback)
-{
- mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('Line', styles), callback);
-});
-
-// default styles
-mexui.util.linkBaseControlStyles('Line', {});
-
-// input
-mexui.Control.Line.prototype.onMouseDown = function(e)
-{
- if(this.isCursorOverControl())
- {
- this.checkToCallCallback();
- }
-};
-
-// render
-mexui.Control.Line.prototype.render = function()
-{
- var pos = this.getScreenPosition();
- mexui.native.drawAALine(pos, this.size, this.getStyles('main'));
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/List.js b/third-party/mexui/Core/Control/List.js
deleted file mode 100644
index 4c6b82a6..00000000
--- a/third-party/mexui/Core/Control/List.js
+++ /dev/null
@@ -1,62 +0,0 @@
-mexui.util.createControlConstructor('List', true, function(window, x, y, w, h, styles, callback)
-{
- mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('List', styles), callback);
- mexui.Entity.ControlWithEntries.call(this, false, false);
-
- this.activeRow = null;
- this.rowHeight = 25;
-});
-
-// default styles
-mexui.util.linkBaseControlStyles('List', {
- row:
- {
- backgroundColour: toColour(255, 255, 255, 255),
- textColour: toColour(0, 0, 0, 255)
- },
- rowLine:
- {
- lineColour: toColour(0, 0, 0, 150)
- }
-});
-
-// input
-mexui.Control.List.prototype.onMouseDown = function(e)
-{
- if(e.button == 0 && this.isCursorOverControl())
- {
- this.activeRow = this.axis.y.getEntryByCursor();
- this.checkToCallCallback();
- }
-};
-
-// render
-mexui.Control.List.prototype.render = function()
-{
- var pos = this.getScreenPosition();
- var pos2 = new Vec2(pos.x, pos.y);
-
- for(var i in this.axis.y.entries)
- {
- var row = this.axis.y.entries[i];
- var rowText = row.text;
-
- mexui.native.drawRectangle(pos, new Vec2(this.size.x, this.rowHeight), this.getStyles('row'));
- mexui.native.drawText(pos, new Vec2(this.size.x, this.rowHeight), rowText, this.getStyles('row'));
-
- pos.y += this.rowHeight;
- mexui.native.drawAALine(pos, new Vec2(pos.x + this.size.x, pos.y), this.getStyles('rowLine'));
- }
-
- if(this.isFocused())
- mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos2,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
-};
-
-// model
-mexui.Control.List.prototype.row = function(text)
-{
- var entry = new mexui.Entry.ListRow(this, text);
- this.axis.y.addEntry(entry);
- return entry;
-};
-
diff --git a/third-party/mexui/Core/Control/Minute.js b/third-party/mexui/Core/Control/Minute.js
deleted file mode 100644
index 432f5227..00000000
--- a/third-party/mexui/Core/Control/Minute.js
+++ /dev/null
@@ -1,21 +0,0 @@
-mexui.util.createControlConstructor('Minute', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('Minute', styles), callback, false, false);
-});
-mexui.util.extend(mexui.Control.Minute, mexui.Control.TextInput);
-
-// model
-mexui.Control.Minute.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isPositiveIntChar(character);
-};
-
-mexui.Control.Minute.prototype.validateValueCallback = function(e)
-{
- var _int = parseInt(this.getText());
-
- if(_int < 1 || _int > 59)
- return false;
-
- return true;
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Month.js b/third-party/mexui/Core/Control/Month.js
deleted file mode 100644
index c23a1da4..00000000
--- a/third-party/mexui/Core/Control/Month.js
+++ /dev/null
@@ -1,16 +0,0 @@
-mexui.util.createControlConstructor('Month', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('Month', styles), callback, false, false);
-});
-mexui.util.extend(mexui.Control.Month, mexui.Control.TextInput);
-
-// model
-mexui.Control.Month.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isPositiveIntChar(character) || mexui.util.isLetter(character);
-};
-
-mexui.Control.Month.prototype.validateValueCallback = function(e)
-{
- return mexui.util.isMonthIdOrName(this.getText());
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Number.js b/third-party/mexui/Core/Control/Number.js
deleted file mode 100644
index f7e4ed28..00000000
--- a/third-party/mexui/Core/Control/Number.js
+++ /dev/null
@@ -1,16 +0,0 @@
-mexui.util.createControlConstructor('Number', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('Number', styles), callback, false, false);
-});
-mexui.util.extend(mexui.Control.Number, mexui.Control.TextInput);
-
-// model
-mexui.Control.Number.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isFloatChar(character);
-};
-
-mexui.Control.Number.prototype.validateValueCallback = function(e)
-{
- return mexui.util.isFloat(this.getText());
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Password.js b/third-party/mexui/Core/Control/Password.js
deleted file mode 100644
index 0aaa3019..00000000
--- a/third-party/mexui/Core/Control/Password.js
+++ /dev/null
@@ -1,7 +0,0 @@
-mexui.util.createControlConstructor('Password', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('Password', styles), callback, false, true);
-
- this.masked = true;
-});
-mexui.util.extend(mexui.Control.Password, mexui.Control.TextInput);
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/PositiveInteger.js b/third-party/mexui/Core/Control/PositiveInteger.js
deleted file mode 100644
index 6cb46e86..00000000
--- a/third-party/mexui/Core/Control/PositiveInteger.js
+++ /dev/null
@@ -1,16 +0,0 @@
-mexui.util.createControlConstructor('PositiveInteger', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('PositiveInteger', styles), callback, false, false);
-});
-mexui.util.extend(mexui.Control.PositiveInteger, mexui.Control.TextInput);
-
-// model
-mexui.Control.PositiveInteger.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isPositiveIntChar(character);
-};
-
-mexui.Control.PositiveInteger.prototype.validateValueCallback = function(e)
-{
- return mexui.util.isPositiveInt(this.getText());
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/PositiveNumber.js b/third-party/mexui/Core/Control/PositiveNumber.js
deleted file mode 100644
index 626d25ad..00000000
--- a/third-party/mexui/Core/Control/PositiveNumber.js
+++ /dev/null
@@ -1,16 +0,0 @@
-mexui.util.createControlConstructor('PositiveNumber', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('PositiveNumber', styles), callback, false, false);
-});
-mexui.util.extend(mexui.Control.PositiveNumber, mexui.Control.TextInput);
-
-// model
-mexui.Control.PositiveNumber.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isPositiveFloatChar(character);
-};
-
-mexui.Control.PositiveNumber.prototype.validateValueCallback = function(e)
-{
- return mexui.util.isPositiveFloat(this.getText());
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/ProgressBar.js b/third-party/mexui/Core/Control/ProgressBar.js
deleted file mode 100644
index a0321d5e..00000000
--- a/third-party/mexui/Core/Control/ProgressBar.js
+++ /dev/null
@@ -1,35 +0,0 @@
-mexui.util.createControlConstructor('ProgressBar', false, function(window, x, y, w, h, text, styles)
-{
- mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('ProgressBar', styles));
-
- this.text = text;
-
- this.progress = 0.0;
-});
-
-// default styles
-mexui.util.linkBaseControlStyles('ProgressBar', {
- innerBar:
- {
- backgroundColour: toColour(0, 255, 0, 255),
-
- hover:
- {
- backgroundColour: toColour(80, 255, 0, 255)
- }
- }
-});
-
-// render
-mexui.Control.ProgressBar.prototype.render = function()
-{
- var pos = this.getScreenPosition();
-
- mexui.native.drawRectangle(pos, this.size, this.getStyles('main'));
-
- var innerBarSize = new Vec2(this.size.x * this.progress, this.size.y);
- mexui.native.drawRectangle(pos, innerBarSize, this.getStyles('innerBar'));
-
- if(this.text != '')
- mexui.native.drawText(pos, this.size, this.text, this.getStyles('main'));
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/RadioButton.js b/third-party/mexui/Core/Control/RadioButton.js
deleted file mode 100644
index 87d686c8..00000000
--- a/third-party/mexui/Core/Control/RadioButton.js
+++ /dev/null
@@ -1,109 +0,0 @@
-mexui.util.createControlConstructor('RadioButton', false, function(window, x, y, w, h, groupId, text, styles, callback)
-{
- mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('RadioButton', styles), callback);
-
- this.groupId = groupId;
- this.text = text;
-
- this.checked = this.isFirstRadioInGroup();
- this.textMarginLeft = 5;
-});
-
-// default styles
-mexui.util.linkBaseControlStyles('RadioButton', {
- innerBox:
- {
- backgroundColour: toColour(0, 255, 0, 255)
- }
-});
-
-// input
-mexui.Control.RadioButton.prototype.onMouseDown = function(e)
-{
- if(e.button == 0 && this.isCursorOverControl())
- {
- this.setChecked();
- }
-};
-
-mexui.Control.RadioButton.prototype.onKeyDown = function(e, key, mods)
-{
- if(this.isFocused())
- {
- if(key == SDLK_RETURN || key == SDLK_RETURN2 || key == SDLK_KP_ENTER || key == SDLK_SPACE)
- {
- e.used = true;
- this.setChecked();
- }
- }
-};
-
-// render
-mexui.Control.RadioButton.prototype.render = function()
-{
- var pos = this.getScreenPosition();
-
- mexui.native.drawRectangle(pos, this.size, this.getStyles('main'));
-
- if(this.checked)
- mexui.native.drawRectangle(mexui.util.addVec2(pos, new Vec2(2, 2)), new Vec2(this.size.x - 4, this.size.y - 4), this.getStyles('innerBox'));
-
- mexui.native.drawText(mexui.util.addVec2(pos, new Vec2(this.size.x + this.textMarginLeft, 2)), this.size, this.text, this.getStyles('main'));
-
- if(this.isFocused())
- mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
-};
-
-// model
-mexui.Control.RadioButton.prototype.getSizeForInput = function()
-{
- var textWidth = mexui.native.getTextWidth(this.text, this.getStyles('main'));
- return new Vec2(this.size.x + this.textMarginLeft + textWidth, this.size.y);
-};
-
-mexui.Control.RadioButton.prototype.getGroupRadios = function()
-{
- var radios = [];
- var windows = mexui.windows;
- for(var i in windows)
- {
- var window = mexui.windows[i];
-
- for(var i2 in window.controls)
- {
- var control = window.controls[i2];
-
- if((control instanceof mexui.Control.RadioButton) && this.groupId == control.groupId)
- {
- radios.push(control);
- }
- }
- }
- return radios;
-};
-
-mexui.Control.RadioButton.prototype.getCheckedRadio = function()
-{
- var radios = this.getGroupRadios();
- for(var i in radios)
- {
- if(radios[i].checked)
- return radios[i];
- }
- return null;
-};
-
-mexui.Control.RadioButton.prototype.isFirstRadioInGroup = function()
-{
- return this.getGroupRadios().length == 0;
-};
-
-mexui.Control.RadioButton.prototype.setChecked = function()
-{
- var checkedRadio = this.getCheckedRadio();
- if(checkedRadio != this.checked)
- checkedRadio.checked = false;
-
- this.checked = !this.checked;
- this.checkToCallCallback();
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/RangedInteger.js b/third-party/mexui/Core/Control/RangedInteger.js
deleted file mode 100644
index dafa0946..00000000
--- a/third-party/mexui/Core/Control/RangedInteger.js
+++ /dev/null
@@ -1,24 +0,0 @@
-mexui.util.createControlConstructor('RangedInteger', false, function(window, x, y, w, h, min, max, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('RangedInteger', styles), callback, false, false);
-
- this.min = min === undefined ? 0 : min;
- this.max = max === undefined ? 100 : max;
-});
-mexui.util.extend(mexui.Control.RangedInteger, mexui.Control.TextInput);
-
-// model
-mexui.Control.RangedInteger.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isIntChar(character);
-};
-
-mexui.Control.RangedInteger.prototype.validateValueCallback = function(e)
-{
- var text = this.getText();
- if(!mexui.util.isInt(text))
- return false;
-
- var _int = parseInt(text);
- return _int >= this.min && _int <= this.max;
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/RangedNumber.js b/third-party/mexui/Core/Control/RangedNumber.js
deleted file mode 100644
index 45e16b05..00000000
--- a/third-party/mexui/Core/Control/RangedNumber.js
+++ /dev/null
@@ -1,24 +0,0 @@
-mexui.util.createControlConstructor('RangedNumber', false, function(window, x, y, w, h, min, max, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('RangedNumber', styles), callback, false, false);
-
- this.min = min === undefined ? 0.0 : min;
- this.max = max === undefined ? 100.0 : max;
-});
-mexui.util.extend(mexui.Control.RangedNumber, mexui.Control.TextInput);
-
-// model
-mexui.Control.RangedNumber.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isFloatChar(character);
-};
-
-mexui.Control.RangedNumber.prototype.validateValueCallback = function(e)
-{
- var text = this.getText();
- if(!mexui.util.isFloat(text))
- return false;
-
- var number = parseFloat(text);
- return number >= this.min && number <= this.max;
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Rectangle.js b/third-party/mexui/Core/Control/Rectangle.js
deleted file mode 100644
index 618a4da2..00000000
--- a/third-party/mexui/Core/Control/Rectangle.js
+++ /dev/null
@@ -1,23 +0,0 @@
-mexui.util.createControlConstructor('Rectangle', false, function(window, x, y, w, h, styles, callback)
-{
- mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('Rectangle', styles), callback);
-});
-
-// default styles
-mexui.util.linkBaseControlStyles('Rectangle', {});
-
-// input
-mexui.Control.Rectangle.prototype.onMouseDown = function(e)
-{
- if(this.isCursorOverControl())
- {
- this.checkToCallCallback();
- }
-};
-
-// render
-mexui.Control.Rectangle.prototype.render = function()
-{
- var pos = this.getScreenPosition();
- mexui.native.drawRectangle(pos, this.size, this.getStyles('main'));
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/ScrollBar.js b/third-party/mexui/Core/Control/ScrollBar.js
deleted file mode 100644
index 579fb037..00000000
--- a/third-party/mexui/Core/Control/ScrollBar.js
+++ /dev/null
@@ -1,123 +0,0 @@
-mexui.util.createControlConstructor('ScrollBar', false, function(window, x, y, w, h, isVertical, styles, callback)
-{
- mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('ScrollBar', styles), callback);
-
- this.isVertical = isVertical;
- this.axisIndex = isVertical ? 1 : 0;
- this.otherAxisIndex = isVertical ? 0 : 1;
-
- this.barHigherLength = 50;
- this.scrolledRatio = 0.0;
- this.isScrolling = false;
-});
-
-// default styles
-mexui.util.linkBaseControlStyles('ScrollBar', {
- main:
- {
- backgroundColour: toColour(0, 0, 0, 190),
-
- hover:
- {
- backgroundColour: toColour(0, 0, 0, 150)
- }
- },
- innerBar:
- {
- backgroundColour: toColour(79, 161, 246, 190),
-
- hover:
- {
- backgroundColour: toColour(79, 161, 246, 150)
- }
- }
-});
-
-// input
-mexui.Control.ScrollBar.prototype.onMouseDown = function(e)
-{
- if(e.button == 0)
- {
- if(mexui.util.isCursorInRectangle(this.getInnerBarPosition(), this.getInnerBarSize()))
- {
- e.used = true;
- this.isScrolling = true;
- }
- else if(this.isCursorOverControl())
- {
- e.used = true;
- this.scrolledRatio += this.getScrolledRatioOuterBarClickIncrease();
- this.clampScrolledRatio();
- }
- }
-};
-
-mexui.Control.ScrollBar.prototype.onMouseUp = function(e)
-{
- if(e.button == 0 && this.isScrolling)
- {
- this.isScrolling = false;
- e.used = true;
- }
-};
-
-mexui.Control.ScrollBar.prototype.onMouseMove = function(e, offset)
-{
- if(this.isScrolling)
- {
- this.scrolledRatio += offset.y * 0.002;
- this.clampScrolledRatio();
- e.used = true;
- }
-
- if(!e.used)
- mexui.Component.Control.prototype.onMouseMove.call(this, e, offset);
-};
-
-mexui.Control.ScrollBar.prototype.onMouseWheel = function(e, offset)
-{
- this.scrolledRatio -= offset.y * 0.12;
- this.clampScrolledRatio();
-};
-
-// render
-mexui.Control.ScrollBar.prototype.renderAfter = function()
-{
- mexui.native.drawRectangle(this.getScreenPosition(), this.size, this.getStyles('main'));
- mexui.native.drawRectangle(this.getInnerBarPosition(), this.getInnerBarSize(), this.getStyles('innerBar'));
-};
-
-// model
-mexui.Control.ScrollBar.prototype.clampScrolledRatio = function()
-{
- if(this.scrolledRatio < 0.0)
- this.scrolledRatio = 0.0;
- else if(this.scrolledRatio > 1.0)
- this.scrolledRatio = 1.0;
-};
-
-mexui.Control.ScrollBar.prototype.getInnerBarPosition = function()
-{
- var screenPos = this.getScreenPosition();
- var pos = new Vec2(screenPos.x, screenPos.y);
-
- var minPos = pos[this.axisIndex] + 1;
- var maxPos = pos[this.axisIndex] + this.size[this.axisIndex] - 2;
- pos[this.axisIndex] = minPos + (this.scrolledRatio * (maxPos - minPos - this.barHigherLength));
- pos[this.otherAxisIndex] += 1;
- return pos;
-};
-
-mexui.Control.ScrollBar.prototype.getInnerBarSize = function()
-{
- var size = new Vec2(this.size.x, this.size.y);
- size[this.axisIndex] = this.barHigherLength;
- size[this.otherAxisIndex] -= 2;
- return size;
-};
-
-mexui.Control.ScrollBar.prototype.getScrolledRatioOuterBarClickIncrease = function()
-{
- var direction = gui.cursorPosition.y < this.getInnerBarPosition().y ? -1.0 : 1.0;
- return direction * 0.05;
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Second.js b/third-party/mexui/Core/Control/Second.js
deleted file mode 100644
index 650e8125..00000000
--- a/third-party/mexui/Core/Control/Second.js
+++ /dev/null
@@ -1,21 +0,0 @@
-mexui.util.createControlConstructor('Second', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('Second', styles), callback, false, false);
-});
-mexui.util.extend(mexui.Control.Second, mexui.Control.TextInput);
-
-// model
-mexui.Control.Second.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isPositiveIntChar(character);
-};
-
-mexui.Control.Second.prototype.validateValueCallback = function(e)
-{
- var _int = parseInt(this.getText());
-
- if(_int < 1 || _int > 59)
- return false;
-
- return true;
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Slider.js b/third-party/mexui/Core/Control/Slider.js
deleted file mode 100644
index 1abfebc6..00000000
--- a/third-party/mexui/Core/Control/Slider.js
+++ /dev/null
@@ -1,116 +0,0 @@
-mexui.util.createControlConstructor('Slider', false, function(window, x, y, w, h, isVertical, text, minText, maxText, styles, callback)
-{
- isVertical = isVertical === undefined ? false : isVertical;
- text = text === undefined ? '' : text;
- minText = minText === undefined ? '' : minText;
- maxText = maxText === undefined ? '' : maxText;
-
- mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('Slider', styles), callback);
-
- this.isVertical = isVertical;
- this.text = text;
- this.minText = minText;
- this.maxText = maxText;
-
- this.progress = 0.0;
- this.axisIndex = isVertical ? 1 : 0;
- this.innerBarSize = new Vec2(30, 25);
-});
-
-// default styles
-mexui.util.linkBaseControlStyles('Slider', {
- innerBar:
- {
- backgroundColour: toColour(0, 255, 0, 255)
- },
- minText:
- {
- textColour: toColour(0, 0, 0, 255)
- },
- maxText:
- {
- textColour: toColour(0, 0, 0, 255)
- }
-});
-
-// input
-mexui.Control.Slider.prototype.onMouseDown = function(e)
-{
- if(e.button == 0 && this.isCursorOverInnerBar())
- {
- this.sliding = true;
- e.used = true;
- }
-};
-
-mexui.Control.Slider.prototype.onMouseUp = function(e)
-{
- if(e.button == 0 && this.sliding)
- {
- this.sliding = false;
- this.checkToCallCallback();
- e.used = true;
- }
-};
-
-mexui.Control.Slider.prototype.onMouseMove = function(e, offset)
-{
- if(!this.sliding)
- return false;
-
- this.progress += this.getProgressIncreaseByPixels(offset);
- this.clampProgress();
- e.used = true;
-};
-
-// render
-mexui.Control.Slider.prototype.render = function()
-{
- var pos = this.getScreenPosition();
- var pos2 = new Vec2(pos.x, pos.y);
-
- mexui.native.drawRectangle(pos, this.size, this.getStyles('main'));
- mexui.native.drawRectangle(this.getInnerBarPosition(), this.innerBarSize, this.getStyles('innerBar'));
-
- pos.y += this.size.y;
- mexui.native.drawText(pos, this.size, this.minText, this.getStyles('minText'));
-
- var offset = (this.size.x - mexui.native.getTextWidth(this.text, this.getStyles('main'))) / 2;
- pos.x += offset;
- mexui.native.drawText(pos, this.size, this.text, this.getStyles('main'));
- pos.x -= offset;
-
- pos.x += this.size.x - mexui.native.getTextWidth(this.maxText, this.getStyles('maxText'));
- mexui.native.drawText(pos, this.size, this.maxText, this.getStyles('maxText'));
-
- if(this.isFocused())
- mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos2,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
-};
-
-// model
-mexui.Control.Slider.prototype.isCursorOverInnerBar = function()
-{
- return mexui.util.isCursorInRectangle(this.getInnerBarPosition(), this.innerBarSize);
-};
-
-mexui.Control.Slider.prototype.getInnerBarPosition = function()
-{
- var pos = this.getScreenPosition();
- pos[this.axisIndex] = mexui.util.interpolateScalar(pos.x, (pos.x + this.size.x) - this.innerBarSize.x, this.progress);
- pos.y -= 3;
- return new Vec2(pos.x, pos.y);
-};
-
-mexui.Control.Slider.prototype.getProgressIncreaseByPixels = function(offset)
-{
- return offset.x / this.size.x;
-};
-
-mexui.Control.Slider.prototype.clampProgress = function()
-{
- if(this.progress < 0.0)
- this.progress = 0.0;
- else if(this.progress > 1.0)
- this.progress = 1.0;
-};
-
diff --git a/third-party/mexui/Core/Control/TabPanel.js b/third-party/mexui/Core/Control/TabPanel.js
deleted file mode 100644
index aa83369c..00000000
--- a/third-party/mexui/Core/Control/TabPanel.js
+++ /dev/null
@@ -1,88 +0,0 @@
-mexui.util.createControlConstructor('TabPanel', true, function(window, x, y, w, h, styles)
-{
- mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('TabPanel', styles));
- mexui.Entity.ControlWithEntries.call(this, false, false);
-
- this.activeTabIndex = 0;
-});
-
-// default styles
-mexui.util.linkBaseControlStyles('TabPanel', {
- tab:
- {
- backgroundColour: toColour(240, 20, 20, 200),
- borderColour: toColour(120, 20, 20, 225),
- textColour: toColour(0, 0, 0, 255),
-
- hover:
- {
- backgroundColour: toColour(240, 20, 20, 150),
- borderColour: toColour(120, 20, 20, 120),
- textColour: toColour(0, 0, 0, 255)
- }
- }
-});
-
-// input
-mexui.Control.TabPanel.prototype.onMouseDown = function(e)
-{
- if(e.button == 0)
- {
- var pos = this.getScreenPosition();
-
- var tabX = pos.x;
- for(var i in this.axis.x.entries)
- {
- var tab = this.axis.x.entries[i];
-
- var tabPos = new Vec2(tabX, pos.y);
- var tabSize = new Vec2(mexui.native.getTextWidth(tab.text, this.getStyles('tab')) + 10, 25);
-
- if(mexui.util.isCursorInRectangle(tabPos, tabSize))
- {
- tab.setActive();
- break;
- }
-
- tabX += tabSize.x;
- }
-
- /*
- var tab = this.axis.x.getEntryByCursor();
- if(tab)
- tab.setActive();
- */
- }
-};
-
-// render
-mexui.Control.TabPanel.prototype.render = function()
-{
- var pos = this.getScreenPosition();
-
- mexui.native.drawRectangle(pos, this.size, this.getStyles('main'));
-
- var tabX = pos.x;
- for(var i in this.axis.x.entries)
- {
- var tab = this.axis.x.entries[i];
-
- var tabPos = new Vec2(tabX, pos.y);
- var tabSize = new Vec2(mexui.native.getTextWidth(tab.text, this.getStyles('tab')) + 10, 25);
- mexui.native.drawRectangle(tabPos, tabSize, this.getStyles('tab'));
- mexui.native.drawText(tabPos, tabSize, tab.text, this.getStyles('tab'));
-
- tabX += tabSize.x;
- }
-
- if(this.isFocused())
- mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
-};
-
-// model
-mexui.Control.TabPanel.prototype.tab = function(text)
-{
- var entry = new mexui.Entry.Tab(this, text);
- this.axis.x.addEntry(entry);
- return entry;
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Text.js b/third-party/mexui/Core/Control/Text.js
deleted file mode 100644
index 92532fc6..00000000
--- a/third-party/mexui/Core/Control/Text.js
+++ /dev/null
@@ -1,20 +0,0 @@
-mexui.util.createControlConstructor('Text', false, function(window, x, y, w, h, text, styles)
-{
- mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('Text', styles));
-
- this.text = text;
-});
-
-// default styles
-mexui.util.linkBaseControlStyles('Text', {});
-
-// render
-mexui.Control.Text.prototype.render = function()
-{
- var pos = this.getScreenPosition();
-
- mexui.native.drawText(pos, this.size, this.text, this.getStyles('main'));
-
- if(this.isFocused())
- mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/TextArea.js b/third-party/mexui/Core/Control/TextArea.js
deleted file mode 100644
index 0d3d1b0a..00000000
--- a/third-party/mexui/Core/Control/TextArea.js
+++ /dev/null
@@ -1,7 +0,0 @@
-mexui.util.createControlConstructor('TextArea', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('TextArea', styles), callback, false, true);
-
- this.multiLine = true;
-});
-mexui.util.extend(mexui.Control.TextArea, mexui.Control.TextInput);
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/TextInput.js b/third-party/mexui/Core/Control/TextInput.js
deleted file mode 100644
index ea1e445b..00000000
--- a/third-party/mexui/Core/Control/TextInput.js
+++ /dev/null
@@ -1,381 +0,0 @@
-mexui.util.createControlConstructor('TextInput', false, function(window, x, y, w, h, text, styles, callback, singleCharacter, multiLineSupported)
-{
- text = text || '';
- if(singleCharacter)
- multiLineSupported = false;
-
- mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('TextInput', styles), callback);
-
- this.lines = text ? mexui.util.splitLines(text) : [''];
-
- this.caretPosition = new Vec2(0, 0);
- this.multiLineSupported = multiLineSupported === undefined ? true : multiLineSupported;
- this.multiLine = this.multiLineSupported ? mexui.util.doesContainEOLChar(text) : false;
- this.masked = false;
- this.singleCharacter = singleCharacter === undefined ? false : singleCharacter;
- this.placeholder = '';
- this.caretShownForBlink = true;
- this.lineHeight = 25;
- this.maxLength = this.singleCharacter ? 1 : false;
-
- this.validValue = true;
-});
-
-// default styles
-mexui.util.linkBaseControlStyles('TextInput', {
- caret:
- {
- lineColour: toColour(0, 0, 0, 255)
- },
- placeholder:
- {
- textColour: toColour(100, 100, 100, 255)
- }
-});
-
-// input
-mexui.Control.TextInput.prototype.onMouseDown = function(e)
-{
- if(e.button == 0)
- {
- var hit = this.isCursorOverControl();
- if(hit)
- {
- this.caretPosition = this.getCaretPositionByCursor();
- }
- }
-
- mexui.Component.Control.prototype.onMouseDown.call(this, e);
-};
-
-mexui.Control.TextInput.prototype.onCharacter = function(e, character)
-{
- if(mexui.focusedControl == this)
- {
- /*
- var isValid1 = this.callback ? this.callback(character) : true;
- if(!isValid1 && isValid1 !== undefined)
- return;
- */
-
- var isValid2 = this.validateInputCallback ? this.validateInputCallback(e, character) : true;
- if(!isValid2)
- return;
-
- if(this.singleCharacter)
- {
- this.resetText();
- this.lines = [character];
- this.caretPosition.x = this.caretPosition.x < 2 ? this.caretPosition.x : 0;
- }
- else if(this.canAddCharacter())
- {
- this.lines[this.caretPosition.y] = this.getTextWithNewCharacter(character);
- this.caretPosition.x++;
- }
-
- this.checkToCallCallback();
- this.validateValue(e);
- }
-};
-
-mexui.Control.TextInput.prototype.onKeyDown = function(e, key, mods)
-{
- if(mexui.focusedControl != this)
- return;
-
- var controlIsDown = (mods & KMOD_CTRL) == KMOD_CTRL;
-
- switch(key)
- {
- case SDLK_LEFT:
- if(this.caretPosition.x != 0)
- {
- this.caretPosition.x--;
- }
- else if(this.caretPosition.y != 0)
- {
- this.caretPosition.y--;
- this.caretPosition.x = this.getCaretLine().length;
- }
- break;
- case SDLK_RIGHT:
- if(this.caretPosition.x != this.getCaretLine().length)
- {
- this.caretPosition.x++;
- }
- else if(this.caretPosition.y != (this.lines.length - 1))
- {
- this.caretPosition.y++;
- this.caretPosition.x = 0;
- }
- break;
- case SDLK_HOME:
- if(controlIsDown)
- {
- this.caretPosition.y = 0;
- this.caretPosition.x = 0;
- }
- else
- this.caretPosition.x = 0;
- break;
- case SDLK_END:
- if(controlIsDown)
- {
- this.caretPosition.y = this.lines.length - 1;
- this.caretPosition.x = this.getCaretLine().length;
- }
- else
- this.caretPosition.x = this.getCaretLine().length;
- break;
- case SDLK_DELETE:
- if(this.caretPosition.x != this.getCaretLine().length)
- {
- this.deleteCharacter(this.caretPosition);
- this.checkToCallCallback();
- }
- else if(this.caretPosition.y != (this.lines.length - 1))
- {
- this.mergeLines(this.caretPosition.y);
- this.checkToCallCallback();
- }
- break;
- case SDLK_BACKSPACE:
- if(this.caretPosition.x != 0)
- {
- this.deleteCharacter(new Vec2(this.caretPosition.x - 1, this.caretPosition.y));
- this.caretPosition.x--;
- this.checkToCallCallback();
- }
- else if(this.caretPosition.y != 0)
- {
- this.caretPosition.y--;
- this.caretPosition.x = this.getCaretLine().length;
- this.mergeLines(this.caretPosition.y);
- this.checkToCallCallback();
- }
- break;
- }
-
- if(this.multiLine)
- {
- switch(key)
- {
- case SDLK_RETURN:
- case SDLK_KP_ENTER:
- if(this.canAddCharacter())
- {
- if(this.caretPosition.x == this.getCaretLine().length)
- {
- this.addLine(this.caretPosition.y + 1);
- this.caretPosition.y++;
- this.caretPosition.x = 0;
- this.checkToCallCallback();
- }
- else
- {
- this.splitLine(this.caretPosition.y);
- this.caretPosition.y++;
- this.caretPosition.x = 0;
- this.checkToCallCallback();
- }
- }
- break;
- case SDLK_UP:
- if(this.caretPosition.y != 0)
- {
- this.caretPosition.y--;
- if(this.caretPosition.x > this.getCaretLine().length)
- this.caretPosition.x = this.getCaretLine().length;
- }
- break;
- case SDLK_DOWN:
- if(this.caretPosition.y != (this.lines.length - 1))
- {
- this.caretPosition.y++;
- if(this.caretPosition.x > this.getCaretLine().length)
- this.caretPosition.x = this.getCaretLine().length;
- }
- break;
- }
- }
-
- this.validateValue(e);
-};
-
-// render
-mexui.Control.TextInput.prototype.render = function()
-{
- var pos = this.getScreenPosition();
- var pos2 = new Vec2(pos.x, pos.y);
-
- mexui.native.drawRectangle(pos, this.size, this.getStyles('main'));
-
- if(this.isEmpty())
- {
- mexui.native.drawText(pos, this.size, this.placeholder, this.getStyles('placeholder'));
- }
- else
- {
- var lineSize = new Vec2(this.size.x, this.lineHeight);
- for(var i=0,j=this.lines.length; i (this.lines.length - 1))
- this.caretPosition.y = this.lines.length - 1;
-
- if(this.caretPosition.x < 0)
- this.caretPosition.x = 0;
- else if(this.caretPosition.x > this.lines[this.caretPosition.y].length)
- this.caretPosition.x = this.lines[this.caretPosition.y].length;
-};
-
-mexui.Control.TextInput.prototype.getCaretPositionByCursor = function()
-{
- var lineIndex = this.getCaretLineIndexByCursor();
- var charIndex = this.getCharIndexByCursor(lineIndex);
- return new Vec2(charIndex, lineIndex);
-};
-
-mexui.Control.TextInput.prototype.getCaretLineIndexByCursor = function()
-{
- var yPos = gui.cursorPosition.y - this.getScreenPosition().y;
- var lineIndex = Math.floor(yPos / this.lineHeight);
-
- if(lineIndex < 0)
- return 0;
- else if(lineIndex > (this.lines.length - 1))
- return this.lines.length - 1;
- else
- return lineIndex;
-};
-
-mexui.Control.TextInput.prototype.getCharIndexByCursor = function(lineIndex)
-{
- var xPos = gui.cursorPosition.x - this.getScreenPosition().x;
- var line = this.lines[lineIndex];
- var lineStyles = this.getStyles('caret');
-
- for(var i=0,j=line.length; i';
-
- mexui.native.drawRectangle(pos, this.arrowBoxSize, this.getStyles('main'));
- mexui.native.drawText(pos, this.arrowBoxSize, text, this.getStyles('main'));
-
- pos.x += this.arrowBoxSize.x;
- }
- }
-};
-
-// model
-mexui.Control.Time.prototype.generateText = function()
-{
- this.setText((this.hour < 10 ? '0'+this.hour : this.hour)
- +':'+(this.minute < 10 ? '0'+this.minute : this.minute)
- +':'+(this.second < 10 ? '0'+this.second : this.second));
-};
-
-mexui.Control.Time.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isPositiveIntChar(character) || character == ':';
-};
-
-mexui.Control.Time.prototype.validateValueCallback = function(e)
-{
- var parts = this.getText().split(':');
-
- if(parts.length != 3)
- return false;
-
- for(var i in parts)
- {
- var partAsStr = parts[i];
- if(partAsStr === '')
- return false;
-
- var part = parseInt(partAsStr);
-
- if(partAsStr.length == 2 && partAsStr.substr(0, 1) == '0')
- partAsStr = partAsStr.substr(1);
-
- if(!mexui.util.isPositiveInt(partAsStr))
- return false;
-
- if(part < 0)
- return false;
-
- if(part > (i == 0 ? 23 : 59))
- return false;
- }
-
- return true;
-};
-
-mexui.Control.Time.prototype.getArrowIndexByCursor = function()
-{
- var cursorPos = gui.cursorPosition;
-
- var screenPos = this.getScreenPosition();
- var firstArrowStartPos = new Vec2(screenPos.x, screenPos.y + this.valueBoxSize.y);
- var lastArrowEndPos = new Vec2(screenPos.x + (this.arrowBoxSize.x * 6), screenPos.y + this.valueBoxSize.y + this.arrowBoxSize.y);
-
- if(cursorPos.x >= firstArrowStartPos.x && cursorPos.y >= firstArrowStartPos.y && cursorPos.x <= lastArrowEndPos.x && cursorPos.y <= lastArrowEndPos.y)
- {
- return Math.floor((cursorPos.x - firstArrowStartPos.x) / this.arrowBoxSize.x);
- }
- else
- {
- return false;
- }
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Tree.js b/third-party/mexui/Core/Control/Tree.js
deleted file mode 100644
index a6e5d56b..00000000
--- a/third-party/mexui/Core/Control/Tree.js
+++ /dev/null
@@ -1,156 +0,0 @@
-mexui.util.createControlConstructor('Tree', true, function(window, x, y, w, h, styles)
-{
- mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('Tree', styles));
- mexui.Entity.ControlWithEntries.call(this, false, false);
-
- this.rowHeight = 25;
- this.rowLevelIndentation = 10;
- this.scrollMultiplier = 10.0;
-});
-
-// default styles
-mexui.util.linkBaseControlStyles('Tree', {
- row:
- {
- backgroundColour: toColour(255, 255, 255, 255),
- textColour: toColour(0, 0, 0, 255)
- },
- rowIcon:
- {
- textColour: toColour(230, 130, 0, 190)
- },
- rowLine:
- {
- lineColour: toColour(0, 0, 0, 150)
- }
-});
-
-// input
-mexui.Control.Tree.prototype.onMouseDown = function(e)
-{
- if(e.button == 0)
- {
- var pos = this.getScreenPosition();
- pos.y -= this.axis.y.getScrolledOffset();
-
- this.testRowClick(e, this.axis.y.entries, pos);
- }
-
- if(!e.used)
- mexui.Entity.ControlWithEntries.prototype.onMouseDown.call(this, e);
-};
-
-// render
-mexui.Control.Tree.prototype.render = function()
-{
- var pos = this.getScreenPosition();
- pos.y -= this.axis.y.getScrolledOffset();
-
- this.renderRows(this.axis.y.entries, 0, pos);
-
- if(this.isFocused())
- mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
-};
-
-mexui.Control.Tree.prototype.renderRows = function(rows, level, pos)
-{
- for(var i in rows)
- {
- var row = rows[i];
- var shouldDraw = pos.y >= this.getScreenPosition().y && pos.y <= (this.getScreenPosition().y + this.size.y);
-
- if(shouldDraw)
- {
- if(row.rows.length > 0)
- mexui.native.drawText(new Vec2(pos.x - (this.rowLevelIndentation * 2), pos.y), new Vec2(this.size.x, this.rowHeight), row.open ? '-' : '+', this.getStyles('rowIcon'));
-
- mexui.native.drawRectangle(pos, new Vec2(this.size.x - (this.rowLevelIndentation * level), this.rowHeight), this.getStyles('row'));
- mexui.native.drawText(pos, new Vec2(this.size.x, this.rowHeight), row.text, this.getStyles('row'));
- }
-
- pos.y += this.rowHeight;
-
- if(shouldDraw)
- {
- mexui.native.drawAALine(pos, new Vec2(pos.x + this.size.x, pos.y), this.getStyles('rowLine'));
- }
-
- if(row.rows.length > 0 && row.open)
- {
- pos.x += this.rowLevelIndentation;
- this.renderRows(row.rows, level + 1, pos);
- pos.x -= this.rowLevelIndentation;
- }
- }
-};
-
-// model
-mexui.Control.Tree.prototype.getAllEntriesLength = function(axisIndex)
-{
- return this.getRowsLength(this.axis.y.entries);
-};
-
-mexui.Control.Tree.prototype.getRowsLength = function(rows)
-{
- var length = rows.length * this.entrySize.y;
- for(var i in rows)
- {
- if(rows[i].open)
- length += this.getRowsLength(rows[i].rows);
- }
- return length;
-};
-
-mexui.Control.Tree.prototype.testRowClick = function(e, rows, pos)
-{
- for(var i in rows)
- {
- var row = rows[i];
-
- var rowPos = new Vec2(pos.x - (this.rowLevelIndentation * 2), pos.y);
- var rowSize = new Vec2(this.size.x + (this.rowLevelIndentation * 2), this.rowHeight);
- if(mexui.util.isCursorInRectangle(rowPos, rowSize))
- {
- this.onClickRow(row);
- e.used = true;
- return;
- }
-
- pos.y += this.rowHeight;
-
- if(row.rows.length > 0 && row.open)
- {
- this.testRowClick(e, row.rows, pos);
- if(e.used)
- return;
- }
- }
-};
-
-mexui.Control.Tree.prototype.onClickRow = function(row)
-{
- if(row.rows.length > 0)
- {
- //var scrollableLengthBefore = this.axis.y.getScrollableLength();
-
- row.open = !row.open;
- this.checkToShowScrollBars();
-
- /*
- if(this.scrollBars[1].shown)
- {
- var scrollableLengthAfter = this.axis.y.getScrollableLength();
- this.scrollBars[1].scrolledRatio += (scrollableLengthAfter - scrollableLengthBefore) / scrollableLengthAfter;
- }
- */
- }
-};
-
-// api
-mexui.Control.Tree.prototype.row = function(text)
-{
- var entry = new mexui.Entry.TreeRow(this, text);
- this.axis.y.addEntry(entry);
- return entry;
-};
-
diff --git a/third-party/mexui/Core/Control/Week.js b/third-party/mexui/Core/Control/Week.js
deleted file mode 100644
index a141b319..00000000
--- a/third-party/mexui/Core/Control/Week.js
+++ /dev/null
@@ -1,21 +0,0 @@
-mexui.util.createControlConstructor('Week', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('Week', styles), callback, false, false);
-});
-mexui.util.extend(mexui.Control.Week, mexui.Control.TextInput);
-
-// model
-mexui.Control.Week.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isPositiveIntChar(character);
-};
-
-mexui.Control.Week.prototype.validateValueCallback = function(e)
-{
- var _int = parseInt(this.getText());
-
- if(_int < 1 || _int > 52)
- return false;
-
- return true;
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/WeekDay.js b/third-party/mexui/Core/Control/WeekDay.js
deleted file mode 100644
index 2e4115b2..00000000
--- a/third-party/mexui/Core/Control/WeekDay.js
+++ /dev/null
@@ -1,16 +0,0 @@
-mexui.util.createControlConstructor('WeekDay', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('WeekDay', styles), callback, false, false);
-});
-mexui.util.extend(mexui.Control.WeekDay, mexui.Control.TextInput);
-
-// model
-mexui.Control.WeekDay.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isPositiveIntChar(character) || mexui.util.isLetter(character);
-};
-
-mexui.Control.WeekDay.prototype.validateValueCallback = function(e)
-{
- return mexui.util.isWeekDayIdOrName(this.getText());
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Control/Year.js b/third-party/mexui/Core/Control/Year.js
deleted file mode 100644
index b1921ec4..00000000
--- a/third-party/mexui/Core/Control/Year.js
+++ /dev/null
@@ -1,21 +0,0 @@
-mexui.util.createControlConstructor('Year', false, function(window, x, y, w, h, text, styles, callback)
-{
- mexui.Control.TextInput.call(this, window, x, y, w, h, text, this.linkControlStyles('Year', styles), callback, false, false);
-
- this.maxYearOffset = 10;
- this.minYearCallback = ()=>{ return 1900; };
- this.maxYearCallback = ()=>{ return new Date().getFullYear() + this.maxYearOffset; }
- this.twoDigitYearCapOffset = 10;
-});
-mexui.util.extend(mexui.Control.Year, mexui.Control.TextInput);
-
-// model
-mexui.Control.Year.prototype.validateInputCallback = function(e, character)
-{
- return mexui.util.isPositiveIntChar(character);
-};
-
-mexui.Control.Year.prototype.validateValueCallback = function(e)
-{
- return mexui.util.isYear(this.getText(), this.minYearCallback(), this.maxYearCallback(), this.twoDigitYearCapOffset);
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Entity/Component.js b/third-party/mexui/Core/Entity/Component.js
deleted file mode 100644
index e0afae23..00000000
--- a/third-party/mexui/Core/Entity/Component.js
+++ /dev/null
@@ -1,41 +0,0 @@
-mexui.Entity.Component = function(moveable)
-{
- this.moveable = moveable;
-
- this.moving = false;
-};
-mexui.util.extend(mexui.Entity.Component, mexui.Entity.StyleableEntity);
-
-// input
-mexui.Entity.Component.prototype.onMouseDown = function(e)
-{
- if(e.button == 0 && this.moveable && this.isCursorOverComponent())
- {
- this.moving = true;
- e.used = true;
- }
-};
-
-mexui.Entity.Component.prototype.onMouseUp = function(e)
-{
- if(e.button == 0 && this.moving)
- {
- this.moving = false;
- e.used = true;
- }
-};
-
-mexui.Entity.Component.prototype.onMouseMove = function(e, offset)
-{
- if(this.moving)
- {
- this.position = new Vec2(this.position.x + offset.x, this.position.y + offset.y);
- e.used = true;
- }
-};
-
-// model
-mexui.Entity.Component.prototype.isCursorOverComponent = function()
-{
- return mexui.util.isCursorInRectangle(this.getScreenPosition(), this.size);
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Entity/ControlAxis.js b/third-party/mexui/Core/Entity/ControlAxis.js
deleted file mode 100644
index 4bddcdec..00000000
--- a/third-party/mexui/Core/Entity/ControlAxis.js
+++ /dev/null
@@ -1,200 +0,0 @@
-mexui.Entity.ControlAxis = function(control, isVertical, manualScrollBar, entriesPositionOffset)
-{
- this.control = control;
- this.isVertical = isVertical;
- this.manualScrollBar = manualScrollBar;
-
- this.axisIndex = isVertical ? 1 : 0;
- this.entriesShown = true;
- this.entryCountShown = 15;
- this.hoveredEntryIndex = -1;
- this.entries = [];
- this.scrollBar = [];
-};
-
-// model
-
-// scroll bar initialization
-mexui.Entity.ControlAxis.prototype.initScrollBar = function()
-{
- if(this.isVertical)
- {
- var pos = mexui.util.addVec2(this.control.position, new Vec2(this.control.entrySize.x, this.control.entriesPositionOffset.y));
- this.scrollBar = new mexui.Control.ScrollBar(this.control.window, pos.x, pos.y, 25, this.getDisplayedEntriesLength(), true, this.control.styles.scrollBar);
- }
- else
- {
- var pos = mexui.util.addVec2(this.control.position, new Vec2(this.control.entriesPositionOffset.x, this.control.size.y));
- this.scrollBar = new mexui.Control.ScrollBar(this.control.window, pos.x, pos.y, this.getDisplayedEntriesLength(), 25, false, this.control.styles.scrollBar);
- }
-
- if(this.manualScrollBar)
- this.scrollBar.shown = false;
-};
-
-// add/remove entries
-mexui.Entity.ControlAxis.prototype.addEntry = function(entry)
-{
- this.entries.push(entry);
- this.checkToShowScrollBar();
-};
-
-mexui.Entity.ControlAxis.prototype.removeAllEntries = function()
-{
- this.entries = [];
- this.checkToShowScrollBar();
-};
-
-// fetch entry by position
-mexui.Entity.ControlAxis.prototype.getEntryByCursor = function()
-{
- return this.getEntryByPoint(gui.cursorPosition);
-};
-
-mexui.Entity.ControlAxis.prototype.getEntryIndexByCursor = function()
-{
- return this.getEntryIndexByPoint(gui.cursorPosition);
-};
-
-mexui.Entity.ControlAxis.prototype.getEntryByPoint = function(point)
-{
- var index = this.getEntryIndexByPoint(point);
- if(index == null)
- return null;
- return this.entries[index];
-};
-
-mexui.Entity.ControlAxis.prototype.getEntryIndexByPoint = function(point)
-{
- var screenPos = this.control.getScreenPosition();
- if(this.axisIndex == 1)
- {
- if(point.x < screenPos.x || point.x > (screenPos.x + this.control.entrySize.x))
- {
- return null;
- }
-
- var pos = new Vec2(screenPos.x + this.control.entriesPositionOffset.x, screenPos.y + this.control.entriesPositionOffset.y);
- var index = Math.floor((point.y - pos.y) / this.control.entrySize[this.axisIndex]);
- index += this.getEntryStartIndex();
-
- if(index < 0 || index >= this.entries.length)
- return null;
-
- return index;
- }
- else
- {
-
- }
-};
-
-// entries sizing
-mexui.Entity.ControlAxis.prototype.getOutsideEntriesLength = function()
-{
- return this.control.entrySize[this.axisIndex] * this.entryCountShown;
-};
-
-mexui.Entity.ControlAxis.prototype.getAllEntriesLength = function()
-{
- if(this.control.getAllEntriesLength)
- return this.control.getAllEntriesLength(this.axisIndex);
- else
- return this.getAllEntriesLength2();
-};
-
-mexui.Entity.ControlAxis.prototype.getAllEntriesLength2 = function()
-{
- return this.entries.length * this.control.entrySize[this.axisIndex];
-};
-
-mexui.Entity.ControlAxis.prototype.getDisplayedEntriesLength = function()
-{
- var sizeOffset = this.control.entriesSizeOffset[this.axisIndex];
- if(this.control.entriesOutsideControl)
- return this.getOutsideEntriesLength() + sizeOffset;
- else
- return this.control.size[this.axisIndex] + sizeOffset;
-};
-
-// entry scrolling
-mexui.Entity.ControlAxis.prototype.setScrollBarManual = function(manual)
-{
- this.manualScrollBar = manual;
-
- if(manual)
- {
- this.setScrollBarShown(false);
- }
-};
-
-mexui.Entity.ControlAxis.prototype.setScrollBarShown = function(shown)
-{
- //if(axisIndex != this.axisIndex)
- // shown = false;
-
- this.scrollBar.shown = shown;
- if(!shown)
- this.scrollBar.scrolledRatio = 0.0;
-};
-
-mexui.Entity.ControlAxis.prototype.shouldDisplayScrollBar = function()
-{
- //if(axisIndex != this.axisIndex)
- // return false;
-
- return this.getAllEntriesLength() > this.scrollBar.size[this.axisIndex];
-};
-
-mexui.Entity.ControlAxis.prototype.checkToShowScrollBar = function()
-{
- if(this.manualScrollBar)
- return;
-
- this.setScrollBarShown(this.shouldDisplayScrollBar(), true);
-};
-
-mexui.Entity.ControlAxis.prototype.getScrolledOffset = function()
-{
- if(this.axisIndex == 1)
- {
- if(!this.scrollBar.shown)
- return 0;
-
- return this.scrollBar.scrolledRatio * this.getScrollableLength();
- }
- else
- {
- return 0;
- }
-};
-
-mexui.Entity.ControlAxis.prototype.getScrolledOffsetFixedStart = function()
-{
- var entryLength = this.control.entrySize[this.axisIndex];
- return Math.floor(this.getScrolledOffset() / entryLength) * entryLength;
-};
-
-mexui.Entity.ControlAxis.prototype.getScrollableLength = function()
-{
- return this.getAllEntriesLength() - this.getOutsideEntriesLength();
-};
-
-// entry iteration
-mexui.Entity.ControlAxis.prototype.getEntryStartIndex = function() // inclusive
-{
- return Math.floor(this.getScrolledOffset() / this.control.entrySize[this.axisIndex]);
-};
-
-mexui.Entity.ControlAxis.prototype.getEntryEndIndex = function() // exclusive
-{
- return this.getEntryStartIndex() + this.getDisplayedEntryCount();
-};
-
-mexui.Entity.ControlAxis.prototype.getDisplayedEntryCount = function()
-{
- var displayedEntriesLength = this.getDisplayedEntriesLength();
- var displayedEntryCount = Math.floor(displayedEntriesLength / this.control.entrySize[this.axisIndex]);
- return this.entries.length < displayedEntryCount ? this.entries.length : displayedEntryCount;
-};
-
diff --git a/third-party/mexui/Core/Entity/ControlWithEntries.js b/third-party/mexui/Core/Entity/ControlWithEntries.js
deleted file mode 100644
index 732014ff..00000000
--- a/third-party/mexui/Core/Entity/ControlWithEntries.js
+++ /dev/null
@@ -1,98 +0,0 @@
-mexui.Entity.ControlWithEntries = function(entriesOutsideControl, manualScrollBar, entriesPositionOffset, entrySize, entriesSizeOffset)
-{
- this.entriesOutsideControl = entriesOutsideControl;
- this.entriesPositionOffset = entriesPositionOffset || new Vec2(0, 0);
- this.entrySize = entrySize || new Vec2(this.size.x, 25);
- this.entriesSizeOffset = entriesSizeOffset || new Vec2(0, 0);
-
- this.axis = {};
- this.axis.x = new mexui.Entity.ControlAxis(this, false, manualScrollBar, entriesPositionOffset);
- this.axis.y = new mexui.Entity.ControlAxis(this, true, manualScrollBar, entriesPositionOffset);
-
- this.axis.x.initScrollBar();
- this.axis.y.initScrollBar();
-
- this.checkToShowScrollBars();
-};
-mexui.util.extend(mexui.Entity.ControlWithEntries, mexui.Component.Control);
-
-// input
-mexui.Entity.ControlWithEntries.prototype.onMouseDown = function(e)
-{
- this.triggerEvent('onMouseDown', e);
-};
-
-mexui.Entity.ControlWithEntries.prototype.onMouseUp = function(e)
-{
- this.triggerEvent('onMouseUp', e);
-};
-
-mexui.Entity.ControlWithEntries.prototype.onMouseMove = function(e, offset)
-{
- for(var k in this.axis)
- {
- if(this.axis[k].entriesShown)
- {
- var hoveredEntryIndex = this.axis[k].getEntryIndexByCursor();
- if(hoveredEntryIndex == null)
- {
- this.axis[k].hoveredEntryIndex = -1;
- }
- else
- {
- e.used = true;
- this.axis[k].hoveredEntryIndex = hoveredEntryIndex;
- break;
- }
- }
- }
-
- if(!e.used)
- this.triggerEvent('onMouseMove', e, offset);
-};
-
-mexui.Entity.ControlWithEntries.prototype.onMouseWheel = function(e, data)
-{
- this.triggerEvent('onMouseWheel', e, data);
-};
-
-// render
-mexui.Entity.ControlWithEntries.prototype.renderAfter = function()
-{
- this.triggerEvent('renderAfter');
-};
-
-// model
-mexui.Entity.ControlWithEntries.prototype.triggerEvent = function(eventName, e, data)
-{
- for(var k in this.axis)
- {
- if(this.axis[k].scrollBar.shown)
- {
- this.axis[k].scrollBar[eventName].call(this.axis[k].scrollBar, e, data);
- if(e && e.used)
- return;
- }
- }
-
- mexui.Component.Control.prototype[eventName].call(this, e, data);
-};
-
-mexui.Entity.ControlWithEntries.prototype.checkToShowScrollBars = function()
-{
- this.axis.x.checkToShowScrollBar();
- this.axis.y.checkToShowScrollBar();
-};
-
-mexui.Entity.ControlWithEntries.prototype.setScrollBarsManual = function(manual)
-{
- this.axis.x.setScrollBarManual(manual);
- this.axis.y.setScrollBarManual(manual);
-};
-
-mexui.Entity.ControlWithEntries.prototype.removeAllEntries = function()
-{
- this.axis.x.removeAllEntries();
- this.axis.y.removeAllEntries();
-};
-
diff --git a/third-party/mexui/Core/Entity/StyleableEntity.js b/third-party/mexui/Core/Entity/StyleableEntity.js
deleted file mode 100644
index ea25df16..00000000
--- a/third-party/mexui/Core/Entity/StyleableEntity.js
+++ /dev/null
@@ -1,210 +0,0 @@
-mexui.Entity.StyleableEntity = function(styles)
-{
- this.styles = styles;
-
- this.shown = true;
- //this.hovered = false;
-
- this.transitions = {}; // string controlPartName => Transition transition
-
- /*
- this.transitionDelayTimer = null;
- this.transitionStartTime = 0;
- this.transitionEndTime = 0;
- this.transitionIsProcessing = false;
- this.transitionIsReverting = false;
- this.transitionProgressReached = 0.0;
- */
-};
-
-// default styles
-mexui.Entity.StyleableEntity.globalDefaultStyles = {
- all:
- {
- textFont: 'Arial',
- textSize: 14.0,
- textAlign: 0.0,
- textIndent: 5,
- textColour: toColour(0, 0, 0, 255),
-
- backgroundColour: toColour(255, 255, 255, 255),
-
- lineWeight: 1
- }
-};
-
-mexui.Entity.StyleableEntity.defaultStyles = mexui.util.linkGlobalStyles(mexui.Entity.StyleableEntity.globalDefaultStyles, {
- main:
- {
- backgroundColour: toColour(255, 255, 255, 255),
- borderColour: 'none',
- textColour: toColour(0, 0, 0, 255),
-
- hover:
- {
- backgroundColour: toColour(220, 220, 220, 255),
- borderColour: 'none',
- textColour: toColour(0, 0, 0, 255)
- }/*,
-
- focus:
- {
- borderColour: toColour(255, 128, 0, 230),
- textColour: toColour(0, 0, 0, 255)
- }
- */
- },
- focused:
- {
- borderColour: toColour(28, 119, 198, 255)
- },
- invalidValue:
- {
- borderColour: toColour(250, 5, 5, 255)
- }
-});
-
-// model
-mexui.Entity.StyleableEntity.prototype.linkControlStyles = function(controlName, styles)
-{
- return mexui.util.linkStyles(mexui.Control[controlName].defaultStyles, styles);
-};
-
-mexui.Entity.StyleableEntity.prototype.linkComponentStyles = function(componentName, styles)
-{
- return mexui.util.linkStyles(mexui.Component[componentName].defaultStyles, styles);
-};
-
-mexui.Entity.StyleableEntity.prototype.linkEntryStyles = function(entryName, styles)
-{
- return mexui.util.linkStyles(mexui.Entry[entryName].defaultStyles, styles);
-};
-
-mexui.Entity.StyleableEntity.prototype.isFocused = function()
-{
- return this == mexui.focusedControl;
-};
-
-mexui.Entity.StyleableEntity.prototype.isHovered = function()
-{
- //return this.hovered;
- return this == mexui.hoveredComponent;
-};
-
-mexui.Entity.StyleableEntity.prototype.getStyles = function(controlPartName)
-{
- var isFocused = this.isFocused();
- var isHovered = this.isHovered();
- var styles = this.styles[controlPartName];
-
- var transition = this.getTransition(controlPartName);
-
- if(transition.isProcessing())
- {
- return mexui.util.getTransitionStyles(styles, ['hover'], transition.getMainToPseudoProgress());
- }
-
- if(isHovered)
- {
- return mexui.util.mergeStyles(styles, ['hover']);
- }
-
- return styles;
-};
-
-mexui.Entity.StyleableEntity.prototype.getEntryStyles = function(data)
-{
- var styles = {};
-
- for(var i in data)
- {
- var baseStyles = data[i][0].getStyles(data[i][1]);
-
- for(var k in baseStyles)
- {
- if(baseStyles.hasOwnProperty(k) && styles[k] === undefined)
- {
- styles[k] = baseStyles[k];
- }
- }
- }
-
- for(var i in data)
- {
- var baseStyles = data[i][0].getStyles(data[i][1]);
-
- for(var k in baseStyles)
- {
- if(styles[k] === undefined)
- {
- styles[k] = baseStyles[k];
- }
- }
- }
-
- return styles;
-};
-
-// custom events
-mexui.Entity.StyleableEntity.prototype.onMouseEnter = function()
-{
- var controlParts = this.getControlPartsWithTransition();
- for(var i in controlParts)
- {
- var transition = this.getTransition(controlParts[i]);
-
- var delay = this.getTransitionDelayStyle(controlParts[i]);
- var time = this.getTransitionTimeStyle(controlParts[i]);
-
- transition.onMouseEnter(delay, time);
- }
-};
-
-mexui.Entity.StyleableEntity.prototype.onMouseExit = function()
-{
- var controlParts = this.getControlPartsWithTransition();
- for(var i in controlParts)
- {
- var transition = this.getTransition(controlParts[i]);
-
- transition.onMouseExit();
- }
-};
-
-// transitions
-mexui.Entity.StyleableEntity.prototype.getTransition = function(controlPartName)
-{
- if(!this.transitions[controlPartName])
- this.transitions[controlPartName] = new mexui.Entity.Transition;
- return this.transitions[controlPartName];
-};
-
-mexui.Entity.StyleableEntity.prototype.getControlPartsWithTransition = function()
-{
- var controlParts = [];
- for(var k in this.styles)
- {
- if(this.styles[k].hover && (this.styles[k].hover.transitionTime != null || this.styles[k].hover.transitionDelay != null))
- {
- controlParts.push(k);
- }
- }
- return controlParts;
-};
-
-mexui.Entity.StyleableEntity.prototype.getTransitionDelayStyle = function(controlPartName)
-{
- if(this.styles[controlPartName].hover.transitionDelay != null)
- return this.styles[controlPartName].hover.transitionDelay;
- else
- return mexui.Entity.Transition.defaultTransitionDelay;
-};
-
-mexui.Entity.StyleableEntity.prototype.getTransitionTimeStyle = function(controlPartName)
-{
- if(this.styles[controlPartName].hover.transitionTime != null)
- return this.styles[controlPartName].hover.transitionTime;
- else
- return mexui.Entity.Transition.defaultTransitionTime;
-};
-
diff --git a/third-party/mexui/Core/Entity/Transition.js b/third-party/mexui/Core/Entity/Transition.js
deleted file mode 100644
index b72bcffd..00000000
--- a/third-party/mexui/Core/Entity/Transition.js
+++ /dev/null
@@ -1,184 +0,0 @@
-mexui.Entity.Transition = function()
-{
- this.processing = false;
- this.interpolating = false;
- this.mainToPseudoProgress = 0.0;
- this.delayTimer = null;
- this.transitionDelay = mexui.Entity.Transition.defaultTransitionDelay;
- this.transitionTime = mexui.Entity.Transition.defaultTransitionTime;
- this.mouseIsEntered = false;
- this.lastUpdateTime = mexui.util.time();
- this.direction = true;
-};
-
-// static
-mexui.Entity.Transition.defaultTransitionDelay = 0;
-mexui.Entity.Transition.defaultTransitionTime = 1000;//400;
-
-// custom events
-mexui.Entity.Transition.prototype.onMouseEnter = function(transitionDelay, transitionTime)
-{
- if(this.isMouseEntered())
- return;
- this.setMouseEntered(true);
-
- this.transitionDelay = transitionDelay;
- this.transitionTime = transitionTime;
-
- if(transitionDelay > 0)
- {
- this.startDelay();
- }
- else if(this.isInterpolating())
- {
- this.revertInterpolationDirection();
- }
- else
- {
- this.startEnterInterpolation();
- }
-};
-
-mexui.Entity.Transition.prototype.onMouseExit = function()
-{
- if(!this.isMouseEntered())
- return;
- this.setMouseEntered(false);
-
- if(this.isDelayActive())
- {
- this.clearDelayTimer();
- }
- else if(this.isInterpolating())
- {
- this.revertInterpolationDirection();
- }
- else
- {
- this.startExitInterpolation();
- }
-};
-
-// model
-mexui.Entity.Transition.prototype.setMouseEntered = function(status)
-{
- this.mouseIsEntered = status;
-};
-
-mexui.Entity.Transition.prototype.isMouseEntered = function()
-{
- return this.mouseIsEntered;
-};
-
-// processing
-mexui.Entity.Transition.prototype.isProcessing = function()
-{
- return this.processing;
-};
-
-mexui.Entity.Transition.prototype.stopProcessing = function()
-{
- if(this.isInterpolating())
- {
- this.stopInterpolation();
- }
-
- this.delayTimer = null;
- this.processing = false;
-};
-
-// interpolation status
-mexui.Entity.Transition.prototype.startEnterInterpolation = function()
-{
- this.lastUpdateTime = mexui.util.time();
- this.processing = true;
- this.interpolating = true;
- this.direction = true;
- this.mainToPseudoProgress = 0.0;
-};
-
-mexui.Entity.Transition.prototype.startExitInterpolation = function()
-{
- this.lastUpdateTime = mexui.util.time();
- this.processing = true;
- this.interpolating = true;
- this.direction = false;
- this.mainToPseudoProgress = 1.0;
-};
-
-mexui.Entity.Transition.prototype.stopInterpolation = function()
-{
- this.interpolating = false;
-};
-
-mexui.Entity.Transition.prototype.isInterpolating = function()
-{
- return this.interpolating;
-};
-
-// interpolation direction
-mexui.Entity.Transition.prototype.revertInterpolationDirection = function()
-{
- this.lastUpdateTime = mexui.util.time();
- this.direction = !this.direction;
-};
-
-// progress
-mexui.Entity.Transition.prototype.increaseMainToPseudoProgress = function()
-{
- var timeDiff = mexui.util.time() - this.lastUpdateTime;
- this.lastUpdateTime = mexui.util.time();
- var progressDiff = timeDiff / this.transitionTime;
-
- if(this.direction)
- this.mainToPseudoProgress += progressDiff;
- else
- this.mainToPseudoProgress -= progressDiff;
-
- if(this.mainToPseudoProgress < 0.0)
- {
- this.mainToPseudoProgress = 0.0;
- this.stopProcessing();
- }
- else if(this.mainToPseudoProgress > 1.0)
- {
- this.mainToPseudoProgress = 1.0;
- }
-};
-
-mexui.Entity.Transition.prototype.getMainToPseudoProgress = function()
-{
- this.increaseMainToPseudoProgress();
-
- return this.mainToPseudoProgress;
-};
-
-mexui.Entity.Transition.prototype.getCompletionProgress = function()
-{
- if(this.direction)
- return this.mainToPseudoProgress;
- else
- return 1.0 - this.mainToPseudoProgress;
-};
-
-mexui.Entity.Transition.prototype.startDelay = function()
-{
- var that = this;
- this.delayTimer = setTimeout(function()
- {
- that.delayTimer = null;
- that.startEnterInterpolation.call(that);
- }, this.transitionDelay);
-};
-
-mexui.Entity.Transition.prototype.isDelayActive = function()
-{
- return this.delayTimer != null;
-};
-
-mexui.Entity.Transition.prototype.clearDelayTimer = function()
-{
- clearTimeout(this.delayTimer);
- this.delayTimer = null;
-};
-
diff --git a/third-party/mexui/Core/Entry/DropDownItem.js b/third-party/mexui/Core/Entry/DropDownItem.js
deleted file mode 100644
index e8c7ed01..00000000
--- a/third-party/mexui/Core/Entry/DropDownItem.js
+++ /dev/null
@@ -1,7 +0,0 @@
-mexui.Entry.DropDownItem = function(dropDown, text)
-{
- mexui.Component.Entry.call(this, dropDown, 1);
-
- this.text = text;
-};
-mexui.util.extend(mexui.Entry.DropDownItem, mexui.Component.Entry);
\ No newline at end of file
diff --git a/third-party/mexui/Core/Entry/GridColumn.js b/third-party/mexui/Core/Entry/GridColumn.js
deleted file mode 100644
index a2135ee0..00000000
--- a/third-party/mexui/Core/Entry/GridColumn.js
+++ /dev/null
@@ -1,9 +0,0 @@
-mexui.Entry.GridColumn = function(grid, text, width, height)
-{
- mexui.Component.Entry.call(this, grid, 0);
-
- this.text = text || 'Column';
- this.width = width || 100;
- this.height = height || 25;
-};
-mexui.util.extend(mexui.Entry.GridColumn, mexui.Component.Entry);
\ No newline at end of file
diff --git a/third-party/mexui/Core/Entry/GridRow.js b/third-party/mexui/Core/Entry/GridRow.js
deleted file mode 100644
index 11419eff..00000000
--- a/third-party/mexui/Core/Entry/GridRow.js
+++ /dev/null
@@ -1,13 +0,0 @@
-mexui.Entry.GridRow = function(grid, cells, styles)
-{
- mexui.Component.Entry.call(this, grid, 1);
- mexui.Entity.StyleableEntity.call(this, this.linkEntryStyles('GridRow', styles));
-
- this.cells = cells;
- this.rowHeight = 25;
-};
-mexui.util.extend(mexui.Entry.GridRow, mexui.Component.Entry);
-
-// default styles
-mexui.Entry.GridRow.defaultStyles = mexui.util.linkStyles(mexui.Entity.StyleableEntity.defaultStyles, {});
-
diff --git a/third-party/mexui/Core/Entry/ListRow.js b/third-party/mexui/Core/Entry/ListRow.js
deleted file mode 100644
index 438ec65e..00000000
--- a/third-party/mexui/Core/Entry/ListRow.js
+++ /dev/null
@@ -1,7 +0,0 @@
-mexui.Entry.ListRow = function(list, text)
-{
- mexui.Component.Entry.call(this, list, 1);
-
- this.text = text;
-};
-mexui.util.extend(mexui.Entry.ListRow, mexui.Component.Entry);
\ No newline at end of file
diff --git a/third-party/mexui/Core/Entry/Tab.js b/third-party/mexui/Core/Entry/Tab.js
deleted file mode 100644
index 436833bb..00000000
--- a/third-party/mexui/Core/Entry/Tab.js
+++ /dev/null
@@ -1,26 +0,0 @@
-mexui.Entry.Tab = function(tabPanel, text)
-{
- mexui.Component.Entry.call(this, tabPanel, 0);
-
- this.text = text;
- this.controls = [];
-};
-mexui.util.extend(mexui.Entry.Tab, mexui.Component.Entry);
-
-// model
-mexui.Entry.Tab.prototype._control = function(control)
-{
- control.shown = this.control.activeTabIndex == this.getEntryIndex();
- this.controls.push(control);
-};
-
-mexui.Entry.Tab.prototype.setActive = function()
-{
- for(var i in this.control.entries[this.control.activeTabIndex].controls)
- this.control.entries[this.control.activeTabIndex].controls[i].shown = false;
-
- this.control.activeTabIndex = this.getEntryIndex();
-
- for(var i in this.control.entries[this.control.activeTabIndex].controls)
- this.control.entries[this.control.activeTabIndex].controls[i].shown = true;
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Entry/TreeRow.js b/third-party/mexui/Core/Entry/TreeRow.js
deleted file mode 100644
index 51ed8617..00000000
--- a/third-party/mexui/Core/Entry/TreeRow.js
+++ /dev/null
@@ -1,17 +0,0 @@
-mexui.Entry.TreeRow = function(tree, text)
-{
- mexui.Component.Entry.call(this, tree, 1);
-
- this.open = true;
- this.text = text;
- this.rows = [];
-};
-mexui.util.extend(mexui.Entry.TreeRow, mexui.Component.Entry);
-
-// model
-mexui.Entry.TreeRow.prototype.row = function(text)
-{
- var entry = new mexui.Entry.TreeRow(this.control, text);
- this.rows.push(entry);
- return entry;
-};
\ No newline at end of file
diff --git a/third-party/mexui/Core/Init.js b/third-party/mexui/Core/Init.js
deleted file mode 100644
index d19a6b89..00000000
--- a/third-party/mexui/Core/Init.js
+++ /dev/null
@@ -1,2 +0,0 @@
-mexui.init();
-
diff --git a/third-party/mexui/Core/Native.js b/third-party/mexui/Core/Native.js
deleted file mode 100644
index e3a2a96e..00000000
--- a/third-party/mexui/Core/Native.js
+++ /dev/null
@@ -1,154 +0,0 @@
-mexui.native = {};
-
-// images
-mexui.native.loadImage = function(imageFilePath, imageName)
-{
- var file = openFile(imageFilePath);
- if(!file)
- {
- logToConsole(LOG_DEBUG, 'ERROR [IMAGE LOAD] - Opening File: '+imageFilePath);
- return false;
- }
-
- var image = null;
- var parts = imageFilePath.split('.');
- var ext = parts[parts.length - 1].toLowerCase();
- if(ext == 'png')
- image = graphics.loadPNG(file);
- else if(ext == 'bmp')
- image = graphics.loadBMP(file);
- else
- {
- logToConsole(LOG_DEBUG, 'ERROR [IMAGE LOAD] - Unsupported image file path extension. Currently only supports PNG or BMP.');
- return false;
- }
-
- if(!image)
- {
- file.close();
- logToConsole(LOG_DEBUG, 'ERROR [IMAGE LOAD] - Reading File: '+imageFilePath);
- return false;
- }
-
- file.close();
-
- if(imageName)
- mexui.images[imageName] = image;
-
- return image;
-};
-
-// fonts
-mexui.native.getFont = function(textSize, textFont)
-{
- var textSizeStr = textSize + '';
-
- if(!mexui.fonts[textSizeStr])
- {
- mexui.fonts[textSizeStr] = {};
- }
-
- if(!mexui.fonts[textSizeStr][textFont])
- {
- mexui.fonts[textSizeStr][textFont] = lucasFont.createDefaultFont(textSize, textFont);
- }
-
- return mexui.fonts[textSizeStr][textFont];
-};
-
-// text size
-mexui.native.getTextSize = function(text, styles, font)
-{
- if(!font)
- font = mexui.native.getFont(styles.textSize, styles.textFont);
-
- var size = font.measure(text + '', 10000, styles.textAlign, 0.0, styles.textSize, false, false);
-
- //if(text[text.length - 1] == ' ')
- // width += mexui.util.getStringCount(text, ' ') * spaceWidth;
-
- return size;
-};
-
-mexui.native.getTextWidth = function(text, styles, font)
-{
- return mexui.native.getTextSize(text, styles, font).x;
-};
-
-mexui.native.getTextHeight = function(text, styles, font)
-{
- return mexui.native.getTextSize(text, styles, font).y;
-};
-
-// render
-mexui.native.drawRectangle = function(position, size, styles)
-{
- mexui.native.drawRectangleBackground(position, size, styles);
- mexui.native.drawRectangleBorder(position, size, styles);
-};
-
-mexui.native.drawRectangleBackground = function(position, size, styles)
-{
- var backgroundColour = styles.backgroundColour != null ? styles.backgroundColour : styles.backgroundColor;
- if(backgroundColour == null || backgroundColour == 'none')
- return;
-
- graphics.drawRectangle(null, position, size, backgroundColour, backgroundColour, backgroundColour, backgroundColour);
-};
-
-mexui.native.drawRectangleBorder = function(position, size, styles)
-{
- var borderColour = styles.borderColour || styles.borderColor;
- if(borderColour == null || borderColour == 'none')
- return;
-
- var rightXPosition = position.x + size.x;
- var bottomYPosition = position.y + size.y;
-
- var topLeftPosition = new Vec2(position.x, position.y);
- var topRightPosition = new Vec2(rightXPosition, position.y);
- var bottomLeftPosition = new Vec2(position.x, bottomYPosition);
- var bottomRightPosition = new Vec2(rightXPosition, bottomYPosition);
-
- var original = styles.lineColour;
-
- styles.lineColour = styles.topBorderColour != null ? styles.topBorderColour : (styles.topBorderColor != null ? styles.topBorderColor : borderColour);
- mexui.native.drawAALine(topLeftPosition, topRightPosition, styles);
-
- styles.lineColour = styles.leftBorderColour != null ? styles.leftBorderColour : (styles.leftBorderColor != null ? styles.leftBorderColor : borderColour);
- mexui.native.drawAALine(topLeftPosition, bottomLeftPosition, styles);
-
- styles.lineColour = styles.bottomBorderColour != null ? styles.bottomBorderColour : (styles.bottomBorderColor != null ? styles.bottomBorderColor : borderColour);
- mexui.native.drawAALine(bottomLeftPosition, bottomRightPosition, styles);
-
- styles.lineColour = styles.rightBorderColour != null ? styles.rightBorderColour : (styles.rightBorderColor != null ? styles.rightBorderColor : borderColour);
- mexui.native.drawAALine(topRightPosition, bottomRightPosition, styles);
-
- styles.lineColour = original;
-};
-
-mexui.native.drawAALine = function(point1, point2, styles)
-{
- var lineColour = styles.lineColour != null ? styles.lineColour : styles.lineColor;
- if(lineColour == null || lineColour == 'none')
- return;
-
- graphics.drawRectangle(null, point1, new Vec2((point2.x - point1.x) + styles.lineWeight, (point2.y - point1.y) + styles.lineWeight), lineColour, lineColour, lineColour, lineColour);
-};
-
-mexui.native.drawText = function(position, size, text, styles)
-{
- var font = mexui.native.getFont(styles.textSize, styles.textFont);
-
- var textHeight = mexui.native.getTextHeight(text, styles, font);
- var textIndent = styles.textAlign == 0.0 || styles.textAlign == 1.0 ? styles.textIndent : 0;
- var textPos = new Vec2(position.x + textIndent, position.y + ((size.y - textHeight) / 2.0));
-
- font.render(text + '', textPos, size.x, styles.textAlign, 0.0, styles.textSize, styles.textColour != null ? styles.textColour : styles.textColor);
-};
-
-mexui.native.drawImage = function(position, size, image, styles)
-{
- graphics.drawRectangle(image, position, size);
-};
-
diff --git a/third-party/mexui/Core/Utility.js b/third-party/mexui/Core/Utility.js
deleted file mode 100644
index 25098920..00000000
--- a/third-party/mexui/Core/Utility.js
+++ /dev/null
@@ -1,704 +0,0 @@
-mexui.util = {};
-
-// static
-mexui.util.monthNames = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
-mexui.util.weekDayNames = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];
-
-// functions
-mexui.util.extend = function(d, b)
-{
- d.prototype = Object.create(b.prototype);
- d.prototype.constructor = b;
-};
-
-mexui.util.isPointInRectangle = function(point, position, size)
-{
- if(!point)
- return false; // temp bug fix
-
- return point.x >= position.x && point.y >= position.y && point.x <= (position.x + size.x) && point.y <= (position.y + size.y);
-};
-
-mexui.util.isCursorInRectangle = function(position, size)
-{
- return mexui.util.isPointInRectangle(gui.cursorPosition, position, size);
-};
-
-mexui.util.addVec2 = function(vec2a, vec2b)
-{
- return new Vec2(vec2a.x + vec2b.x, vec2a.y + vec2b.y);
-};
-
-mexui.util.subtractVec2 = function(vec2a, vec2b)
-{
- return new Vec2(vec2a.x - vec2b.x, vec2a.y - vec2b.y);
-};
-
-mexui.util.addVec3 = function(vec3a, vec3b)
-{
- return new Vec3(vec3a.x + vec3b.x, vec3a.y + vec3b.y, vec3a.z + vec3b.z);
-};
-
-mexui.util.createControlConstructor = function(controlName, hasEntries, constructor)
-{
- mexui.Control[controlName] = constructor;
- mexui.util.extend(mexui.Control[controlName], hasEntries ? mexui.Entity.ControlWithEntries : mexui.Component.Control);
-};
-
-mexui.util.linkBaseControlStyles = function(controlName, derivedStyles)
-{
- mexui.Control[controlName].defaultStyles = mexui.util.linkStyles(mexui.Component.Control.defaultStyles, derivedStyles);
-};
-
-mexui.util.linkStyles = function(baseStyles, derivedStyles)
-{
- derivedStyles = derivedStyles || {};
-
- for(var k in baseStyles)
- {
- switch(k)
- {
- case 'focus':
- case 'hover':
- continue;
- }
-
- if(!derivedStyles[k])
- derivedStyles[k] = {};
- if(!(derivedStyles[k].__proto__ instanceof Object))
- derivedStyles[k].__proto__ = baseStyles[k];
-
- /*
- var hoverBaseStyles = JSON.parse(JSON.stringify(baseStyles[k]));
- if(!derivedStyles[k].hover)
- derivedStyles[k].hover = {};
- if(!(derivedStyles[k].hover.__proto__ instanceof Object))
- derivedStyles[k].hover.__proto__ = hoverBaseStyles;
- */
- }
-
- return mexui.util.linkGlobalStyles(mexui.Entity.StyleableEntity.globalDefaultStyles, derivedStyles);
- //return derivedStyles;
-};
-
-mexui.util.linkGlobalStyles = function(baseStyles, derivedStyles)
-{
- derivedStyles = derivedStyles || {};
-
- for(var k in derivedStyles)
- {
- switch(k)
- {
- case 'focus':
- case 'hover':
- continue;
- }
-
- if(!(derivedStyles[k].__proto__ instanceof Object))
- {
- derivedStyles[k].__proto__ = baseStyles.all;
- }
- }
-
- for(var k in derivedStyles)
- {
- switch(k)
- {
- case 'focus':
- case 'hover':
- continue;
- }
-
- /*
- if(!derivedStyles[k].hasOwnProperty('hover'))
- {
- derivedStyles[k].hover = {};
- derivedStyles[k].hover.__proto__ = derivedStyles[k];
- }
- */
-
- if(derivedStyles[k].focus)
- {
- if(!(derivedStyles[k].focus.__proto__ instanceof Object))
- {
- derivedStyles[k].focus.__proto__ = baseStyles.all;
- }
-
- if(derivedStyles[k].focus.hover)
- {
- if(!(derivedStyles[k].focus.hover.__proto__ instanceof Object))
- {
- derivedStyles[k].focus.hover.__proto__ = baseStyles.all;
- }
- }
- }
-
- if(derivedStyles[k].hover)
- {
- if(!(derivedStyles[k].hover.__proto__ instanceof Object))
- {
- derivedStyles[k].hover.__proto__ = baseStyles.all;
- }
- }
- }
-
- return derivedStyles;
-};
-
-String.prototype.repeat = function(count)
-{
- return Array(count + 1).join(this);
-};
-
-mexui.util.isLetter = function(character)
-{
- var ord = character.charCodeAt(0);
- return (ord >= 65 && ord <= 90) || (ord >= 97 && ord <= 122);
-};
-
-mexui.util.isDigit = function(character)
-{
- var ord = character.charCodeAt(0);
- return ord >= 48 && ord <= 57;
-};
-
-mexui.util.isLetterOrDigit = function(character)
-{
- return mexui.util.isLetter(character) || mexui.util.isDigit(character);
-};
-
-mexui.util.isCharacterInOctetRange = function(character, min, max)
-{
- var ord = character.charCodeAt(0);
- return ord >= min && ord <= max;
-};
-
-mexui.util.interpolateScalar = function(a, b, f)
-{
- return a + ((b - a) * f);
-};
-
-mexui.util.doesContainEOLChar = function(text)
-{
- return text.indexOf("\n") != -1 || text.indexOf("\r") != -1;
-};
-
-mexui.util.splitLines = function(text)
-{
- text = text.replace("\r\n", "\n");
- text = text.replace("\r", "\n");
- return text.split("\n");
-};
-
-mexui.util.getStringCount = function(text, find)
-{
- var count = 0;
- var index = 0;
- for(;;)
- {
- index = text.indexOf(find, index);
- if(index == -1)
- break;
- count++;
- index += find.length;
- }
- return count;
-};
-
-mexui.util.stack = function()
-{
- var err = new Error();
- console.log(err.stack);
-};
-
-mexui.util.deg = function(rad)
-{
- return rad * (180 / Math.PI);
-};
-
-mexui.util.rad = function(deg)
-{
- return deg * (Math.PI / 180);
-};
-
-mexui.util.round = function(x, n)
-{
- return parseFloat(Math.round(x * Math.pow(10, n)) / Math.pow(10, n)).toFixed(n);
-};
-
-mexui.util.getCenterPosition = function(largerSize, smallerSize)
-{
- return new Vec2(
- (largerSize.x - smallerSize.x) / 2.0,
- (largerSize.y - smallerSize.y) / 2.0
- );
-};
-
-mexui.util.getWindowSize = function()
-{
- return new Vec2(gta.width, gta.height);
-};
-
-mexui.util.isRectangleInsideRectangle = function(pos1, size1, pos2, size2)
-{
- return !(pos2.x > (pos1.x + size1.x) ||
- (pos2.x + size2.x) < pos1.x ||
- pos2.y > (pos1.y + size1.y) ||
- (pos2.y + size2.y) < pos1.y);
-};
-
-mexui.util.mergeStyles = function(styles, pseudoPartNames)
-{
- var styles3 = {};
- var styles2 = [styles];
- while(styles2[0])
- {
- styles2 = [styles2[0]];
- for(var i in pseudoPartNames)
- {
- var pseudoPartName = pseudoPartNames[i];
-
- if(styles2[0] && styles2[0].hasOwnProperty(pseudoPartName))
- styles2.push(styles2[0][pseudoPartName]);
- }
-
- for(var i=styles2.length-1; i>=0; i--)
- {
- if(styles2[i] == null)
- continue;
-
- for(var k in styles2[i])
- {
- switch(k)
- {
- case 'focus':
- case 'hover':
-
- case 'transitionTime':
- case 'transitionDelay':
-
- case 'transitionDelayStartTime':
- case 'transitionStartTime':
- case 'transitionStarted':
- case 'transitionEnded':
- case 'transitionReverting':
-
- continue;
- }
- if(styles2[i].hasOwnProperty(k) && styles3[k] == null)
- {
- var styleValue = styles2[i][k];
-
- /*
- if(i > 0 && (styles2[i].transitionTime != null || styles2[i].transitionDelay != null))
- {
- var timeNow = mexui.util.time();
- if(styles2[i].transitionReverting)
- {
- var transitionTime = styles2[i].transitionTime == null ? 400 : styles2[i].transitionTime;
- var progress = (timeNow - styles2[i].transitionStartTime) / transitionTime;
- if(progress > 1.0)
- {
- styles2[i].transitionEnded = true;
- styleValue = styles2[0][k];
-
- delete styles2[i].transitionDelayStartTime;
- delete styles2[i].transitionStartTime;
- delete styles2[i].transitionStarted;
- delete styles2[i].transitionEnded;
- delete styles2[i].transitionReverting;
- }
- else
- {
- styleValue = mexui.util.interpolateStyle(k, progress, styles2[i][k], styles2[0][k]);
- }
- }
- else if(styles2[i].transitionEnded)
- {
- styleValue = styles2[i][k];
- }
- else if(styles2[i].transitionStarted)
- {
- var transitionTime = styles2[i].transitionTime == null ? 400 : styles2[i].transitionTime;
- var progress = (timeNow - styles2[i].transitionStartTime) / transitionTime;
- if(progress > 1.0)
- {
- styles2[i].transitionEnded = true;
- styleValue = styles2[i][k];
- }
- else
- {
- styleValue = mexui.util.interpolateStyle(k, progress, styles2[0][k], styles2[i][k]);
- }
- }
- else if(styles2[i].transitionDelayStartTime)
- {
- var transitionDelay = styles2[i].transitionDelay == null ? 0 : styles2[i].transitionDelay;
- if(timeNow >= (styles2[i].transitionDelayStartTime + transitionDelay))
- {
- styles2[i].transitionStarted = true;
- styles2[i].transitionStartTime = timeNow;
- styleValue = styles2[0][k];
- }
- }
- else
- {
- styles2[i].transitionDelayStartTime = timeNow;
- styleValue = styles2[0][k];
- }
- }
- */
-
- styles3[k] = styleValue;
- }
- }
- }
-
- for(var i in styles2)
- {
- if(styles2[i])
- styles2[i] = styles2[i].__proto__;
- }
- }
-
- return styles3;
-};
-
-mexui.util.getTransitionStyles = function(styles, pseudoPartNames, progress)
-{
- var styles3 = {};
- var styles2 = [styles];
- while(styles2[0])
- {
- styles2 = [styles2[0]];
- for(var i in pseudoPartNames)
- {
- var pseudoPartName = pseudoPartNames[i];
-
- if(styles2[0] && styles2[0].hasOwnProperty(pseudoPartName))
- styles2.push(styles2[0][pseudoPartName]);
- }
-
- for(var i=styles2.length-1; i>=0; i--)
- {
- if(styles2[i] == null)
- continue;
-
- for(var k in styles2[i])
- {
- switch(k)
- {
- case 'focus':
- case 'hover':
-
- case 'transitionTime':
- case 'transitionDelay':
-
- continue;
- }
- if(styles2[i].hasOwnProperty(k) && styles3[k] == null)
- {
- var styleValue = styles2[i][k];
-
- if(i > 0)
- {
- var mainStyleValue = styles2[0][k];
- var pseudoStyleValue = styles2[i][k];
-
- //console.log(mainStyleValue+' '+pseudoStyleValue);
-
- styleValue = mexui.util.interpolateStyle(k, progress, mainStyleValue, pseudoStyleValue);
- }
-
- styles3[k] = styleValue;
- }
- }
- }
-
- for(var i in styles2)
- {
- if(styles2[i])
- styles2[i] = styles2[i].__proto__;
- }
- }
-
- return styles3;
-};
-
-mexui.util.interpolateStyle = function(styleName, progress, styleValueFrom, styleValueTo)
-{
- switch(styleName)
- {
- case 'backgroundColour':
- case 'backgroundColor':
- case 'textColour':
- case 'textColor':
- case 'lineColour':
- case 'lineColor':
- case 'borderColour':
- case 'borderColor':
- if(styleValueFrom == 'none')
- styleValueFrom = toColour(255, 255, 255, 0);
- if(styleValueTo == 'none')
- styleValueTo = toColour(255, 255, 255, 0);
- return mexui.util.interpolateColour(progress, styleValueFrom, styleValueTo);
- default:
- return mexui.util.interpolateScalar(progress, styleValueFrom, styleValueTo);
- }
-};
-
-mexui.util.interpolateColour = function(progress, styleValueFrom, styleValueTo)
-{
- var rgbFrom = mexui.util.fromColour(styleValueFrom);
- var rgbTo = mexui.util.fromColour(styleValueTo);
- var rgba = [];
- for(var i=0; i<4; i++)
- {
- rgba[i] = mexui.util.interpolateScalar(progress, rgbFrom[i], rgbTo[i]);
- }
- return toColour.apply(null, rgba);
-};
-
-mexui.util.interpolateScalar = function(progress, valueFrom, valueTo)
-{
- return valueFrom + ((valueTo - valueFrom) * progress);
-};
-
-mexui.util.fromColour = function(colour)
-{
- return [
- (colour >> 16) & 0xFF,
- (colour >> 8) & 0xFF,
- colour & 0xFF,
- (colour >> 24) & 0xFF
- ];
-};
-
-mexui.util.time = function()
-{
- return gta.tickCount;
-};
-
-mexui.util.isIntChar = function(character)
-{
- return mexui.util.isPositiveIntChar(character);
-};
-
-mexui.util.isPositiveIntChar = function(character)
-{
- return mexui.util.isDigit(character) || character == '-' || character == '+' || character == 'e' || character == 'E';
-};
-
-mexui.util.isFloatChar = function(character)
-{
- return mexui.util.isIntChar(character) || character == '.';
-};
-
-mexui.util.isPositiveFloatChar = function(character)
-{
- return mexui.util.isPositiveIntChar(character) || character == '.';
-};
-
-mexui.util.isInt = function(str)
-{
- var strInt = parseInt(str);
- return !isNaN(strInt) && str.length == (strInt+'').length;
-};
-
-mexui.util.isPositiveInt = function(str)
-{
- var strInt = parseInt(str);
- return !isNaN(strInt) && strInt >= 0 && str.length == (strInt+'').length;
-};
-
-mexui.util.isFloat = function(str)
-{
- var strFloat = parseFloat(str);
- var firstDot = str.indexOf('.');
- var addOffset = (str.substr(str.length - 2, 2) == '.0' && firstDot == (str.length - 2)) ? 2 : 0;
- if(firstDot == 0)
- addOffset--;
- return !isNaN(strFloat) && str.length == ((strFloat+'').length + addOffset);
-};
-
-mexui.util.isPositiveFloat = function(str)
-{
- var strFloat = parseFloat(str);
- var firstDot = str.indexOf('.');
- var addOffset = (str.substr(str.length - 2, 2) == '.0' && firstDot == (str.length - 2)) ? 2 : 0;
- if(firstDot == 0)
- addOffset--;
- return !isNaN(strFloat) && strFloat >= 0.0 && str.length == ((strFloat+'').length + addOffset);
-};
-
-mexui.util.isMonthName = function(text)
-{
- return mexui.util.inArrayOrStartsWithInArray(text, mexui.util.monthNames, 3);
-};
-
-mexui.util.isWeekDayName = function(text)
-{
- return mexui.util.inArrayOrStartsWithInArray(text, mexui.util.weekDayNames, 3);
-};
-
-mexui.util.isDayIdSuffix = function(text)
-{
- switch(text.toLowerCase())
- {
- case 'st':
- case 'nd':
- case 'rd':
- case 'th':
- return true;
- }
- return false;
-};
-
-mexui.util.isDayIdSuffixForDayId = function(dayId, text)
-{
- switch(text.toLowerCase())
- {
- case 'st': return dayId == 1 || dayId == 21 || dayId == 31;
- case 'nd': return dayId == 2 || dayId == 22;
- case 'rd': return dayId == 3 || dayId == 23;
- case 'th': return !(dayId >= 1 && dayId <= 3) && !(dayId >= 21 && dayId <= 23) && dayId != 31;
- default: return false;
- }
-};
-
-mexui.util.isDayId = function(text)
-{
- if(text.length == 2 && text.substr(0, 1) == '0')
- text = text.substr(1);
-
- if(mexui.util.isPositiveInt(text))
- {
- var _int = parseInt(text);
- if(_int >= 1 && _int <= 31)
- return true;
- }
-
- return false;
-};
-
-mexui.util.isDayIdWithOptionalSuffix = function(text)
-{
- if(mexui.util.isDayId(text))
- return true;
-
- if(text.length > 2)
- {
- var last2Chars = text.substr(text.length - 2, 2);
- if(mexui.util.isDayIdSuffix(last2Chars))
- {
- var textWithoutLast2Chars = text.substr(0, text.length - 2);
- if(mexui.util.isDayId(textWithoutLast2Chars) && mexui.util.isDayIdSuffixForDayId(parseInt(textWithoutLast2Chars), last2Chars))
- {
- return true;
- }
- }
- }
-
- return false;
-};
-
-mexui.util.inArrayOrStartsWithInArray = function(text, arr, startsWithCharCount)
-{
- text = text.toLowerCase();
-
- for(var i in arr)
- {
- if(text === arr[i])
- {
- return true;
- }
- }
-
- if(text.length == startsWithCharCount)
- {
- for(var i in arr)
- {
- if(text === arr[i].substr(0, startsWithCharCount))
- {
- return true;
- }
- }
- }
-
- return false;
-};
-
-mexui.util.isMonthIdOrName = function(text)
-{
- var text2 = text;
- if(text2.length == 2 && text2.substr(0, 1) == '0')
- text2 = text2.substr(1);
-
- if(mexui.util.isPositiveInt(text2))
- {
- var _int = parseInt(text2);
- if(_int >= 1 && _int <= 12)
- return true;
- }
-
- return mexui.util.isMonthName(text);
-};
-
-mexui.util.isWeekDayId = function(text)
-{
- var text2 = text;
- if(text2.length == 2 && text2.substr(0, 1) == '0')
- text2 = text2.substr(1);
-
- if(mexui.util.isPositiveInt(text2))
- {
- var _int = parseInt(text2);
- if(_int >= 1 && _int <= 7)
- return true;
- }
-
- return false;
-};
-
-mexui.util.isWeekDayIdOrName = function(text)
-{
- var text2 = text;
- if(text2.length == 2 && text2.substr(0, 1) == '0')
- text2 = text2.substr(1);
-
- if(mexui.util.isPositiveInt(text2))
- {
- var _int = parseInt(text2);
- if(_int >= 1 && _int <= 7)
- return true;
- }
-
- return mexui.util.isWeekDayName(text);
-};
-
-mexui.util.expand2DigitYear = function(year, twoDigitYearCapOffset)
-{
- var currentFullYear = new Date().getFullYear();
- var currentTwoDigitYearPlusCapOffset = parseInt((currentFullYear+'').substr(2, 2)) + twoDigitYearCapOffset;
- if(year <= currentTwoDigitYearPlusCapOffset)
- year += currentFullYear - (currentFullYear % 100);
- else
- year += (currentFullYear - (currentFullYear % 100)) - 100;
- return year;
-};
-
-mexui.util.isYear = function(text, minYear, maxYear, twoDigitYearCapOffset)
-{
- var _int = parseInt(text);
-
- if(isNaN(_int))
- return false;
-
- if(_int >= 0 && _int <= 99)
- _int = mexui.util.expand2DigitYear(_int, twoDigitYearCapOffset);
-
- if(_int < minYear || _int > maxYear)
- return false;
-
- return true;
-};
\ No newline at end of file
diff --git a/third-party/mexui/Images/down-arrow.png b/third-party/mexui/Images/down-arrow.png
deleted file mode 100644
index 63fe7a57..00000000
Binary files a/third-party/mexui/Images/down-arrow.png and /dev/null differ
diff --git a/third-party/mexui/mexui.js b/third-party/mexui/mexui.js
deleted file mode 100644
index 094d0a80..00000000
--- a/third-party/mexui/mexui.js
+++ /dev/null
@@ -1,298 +0,0 @@
-var mexui = {};
-
-// data initialization
-mexui.Entity = {};
-mexui.Component = {};
-mexui.Control = {};
-mexui.Entry = {};
-
-mexui.windows = [];
-
-mexui.fonts = {};
-mexui.images = {};
-
-mexui.focusedControl = null;
-mexui.hoveredComponent = null;
-
-// initialization
-mexui.init = function()
-{
- mexui.native.loadImage('third-party/mexui/Images/down-arrow.png', 'downArrow');
- mexui.bindEvents();
- mexui.startTimers();
-};
-
-// events
-mexui.bindEvents = function()
-{
- addEventHandler('onMouseDown', function(event, mouse, button)
- {
- var e = mexui.triggerEvent('onMouseDown', {button: button});
- if(!e.clickedAControl)
- {
- mexui.focusedControl = null;
- }
- });
-
- addEventHandler('onMouseUp', function(event, mouse, button)
- {
- mexui.triggerEvent('onMouseUp', {button: button});
- });
-
- addEventHandler('onMouseMove', function(event, mouse, isAbsolute, position)
- {
- if(isAbsolute)
- return;
-
- mexui.triggerEvent('onMouseMove', new Vec2(position.x, position.y), true);
- });
-
- addEventHandler('onMouseWheel', function(event, mouse, offset, flipped)
- {
- mexui.triggerEvent('onMouseWheel', offset);
- });
-
- addEventHandler('onKeyDown', function(event, key, pkey, mods)
- {
- mexui.triggerEvent('onKeyDown', key, mods);
-
- if(key == SDLK_TAB)
- {
- mexui.cycleFocusedControl();
- }
- });
-
- addEventHandler('onCharacter', function(event, character)
- {
- mexui.triggerEvent('onCharacter', character);
-
- if(character == 't' || character == 'T')
- {
- var textInput = mexui.getFocusedTextInput();
- if(textInput)
- {
- //event.preventDefault();
- }
- }
- });
-
- addEventHandler('onBeforeDrawHUD', function(event)
- {
- mexui.render();
- });
-};
-
-mexui.unbindEvents = function()
-{
- removeEventHandler('onMouseDown');
- removeEventHandler('onMouseUp');
- removeEventHandler('onMouseMove');
- removeEventHandler('onMouseWheel');
- removeEventHandler('onKeyDown');
- removeEventHandler('onCharacter');
- removeEventHandler('onBeforeDrawHUD');
-};
-
-// timers
-mexui.startTimers = function()
-{
- setInterval(mexui.toggleTextInputCaretShownForBlink, 400);
-};
-
-// render
-mexui.render = function()
-{
- for(var i in mexui.windows)
- {
- if(mexui.windows[i].shown)
- mexui.windows[i].render.call(mexui.windows[i]);
- }
- for(var i in mexui.windows)
- {
- if(mexui.windows[i].shown)
- mexui.windows[i].renderAfter.call(mexui.windows[i]);
- }
-};
-
-// model
-mexui.triggerEvent = function(eventName, data, callBaseMethodFirst)
-{
- var e = new mexui.Component.Event();
-
- if(data.button !== undefined)
- e.button = data.button;
-
- var windows = mexui.windows.slice(0, mexui.windows.length).reverse();
- for(var i in windows)
- {
- if(windows[i].shown)
- {
- if(callBaseMethodFirst)
- {
- if(mexui.Entity.Component.prototype[eventName])
- {
- mexui.Entity.Component.prototype[eventName].call(windows[i], e, data);
- if(e.used)
- break;
- }
-
- windows[i][eventName].call(windows[i], e, data);
- if(e.used)
- break;
- }
- else
- {
- windows[i][eventName].call(windows[i], e, data);
- if(e.used)
- break;
-
- if(mexui.Entity.Component.prototype[eventName])
- {
- mexui.Entity.Component.prototype[eventName].call(windows[i], e, data);
- if(e.used)
- break;
- }
- }
- }
- }
- return e;
-};
-
-mexui.getTopWindow = function()
-{
- for(var i = mexui.windows.length - 1, j = 0; i >= j; i--)
- {
- if(mexui.windows[i].shown)
- return mexui.windows[i];
- }
- return null;
-};
-
-mexui.getShownWindows = function()
-{
- var shownWindows = [];
- for(var i = mexui.windows.length - 1, j = 0; i >= j; i--)
- {
- if(mexui.windows[i].shown)
- shownWindows.push(mexui.windows[i]);
- }
- return shownWindows;
-};
-
-mexui.getNextShownWindows = function(afterWindow)
-{
- var shownWindows = mexui.getShownWindows();
-
- var windowIndex = shownWindows.indexOf(afterWindow);
-
- var windows2 = shownWindows.splice(0, windowIndex + 1);
- var args = windows2;
- args.unshift(0);
- args.unshift(shownWindows.length);
- shownWindows.splice.apply(shownWindows, args);
-
- return shownWindows;
-};
-
-mexui.cycleFocusedControl = function()
-{
- // no windows are created
- if(mexui.windows.length == 0)
- return;
-
- // no control is focused
- if(!mexui.focusedControl)
- {
- var topWindow = mexui.getTopWindow();
- if(!topWindow)
- return;
-
- mexui.focusedControl = topWindow.getFirstShownControl();
- return;
- }
-
- // a control is focused
- var focusedControlWindow = mexui.focusedControl.window;
- var nextControl = focusedControlWindow.getNextShownControl(mexui.focusedControl);
- if(nextControl)
- {
- mexui.focusedControl = nextControl;
- return;
- }
-
- // set focus to first control on next window that has a control shown
- var shownWindows = mexui.getNextShownWindows(focusedControlWindow);
- for(var i in shownWindows)
- {
- var window = shownWindows[i];
- var firstControl = window.getFirstShownControl();
- if(firstControl)
- {
- mexui.focusedControl = firstControl;
- return;
- }
- }
-};
-
-mexui.getFocusedTextInput = function()
-{
- if(!mexui.focusedControl)
- return null;
-
- if(!(mexui.focusedControl instanceof mexui.Control.TextInput))
- return null;
-
- return mexui.focusedControl;
-};
-
-mexui.toggleTextInputCaretShownForBlink = function()
-{
- var textInput = mexui.getFocusedTextInput();
- if(!textInput)
- return;
-
- textInput.caretShownForBlink = !textInput.caretShownForBlink;
-};
-
-mexui.setHoveredComponent = function(component)
-{
- //component.hovered = true;
- mexui.hoveredComponent = component;
-};
-
-mexui.clearHoveredComponent = function()
-{
- //mexui.hoveredComponent.hovered = false;
- mexui.hoveredComponent = null;
-};
-
-// api
-mexui.window = function(x, y, w, h, title, styles)
-{
- var window = new mexui.Component.Window(x, y, w, h, title, styles);
- mexui.windows.push(window);
- return window;
-};
-
-mexui.isAnyWindowShown = function()
-{
- for(var i in mexui.windows)
- {
- if(mexui.windows[i].shown)
- return true;
- }
- return false;
-};
-
-mexui.setInput = function(showInput)
-{
- gui.showCursor(showInput, !showInput);
- //if(localPlayer)
- //{
- // if(showInput)
- // gta.setCameraLookAtEntity(new Vec3(gta.cameraMatrix.m41, gta.cameraMatrix.m42, gta.cameraMatrix.m43), localPlayer, false);
- // else
- // gta.restoreCamera(false);
- //}
-};
-
diff --git a/third-party/moment/moment.min.js b/third-party/moment/moment.min.js
new file mode 100644
index 00000000..57cd2d4f
--- /dev/null
+++ b/third-party/moment/moment.min.js
@@ -0,0 +1,2 @@
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,i;function f(){return e.apply(null,arguments)}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function u(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function l(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(var t in e)if(m(e,t))return;return 1}function r(e){return void 0===e}function h(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function a(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function d(e,t){for(var n=[],s=0;s>>0,s=0;sFe(e)?(r=e+1,a-Fe(e)):(r=e,a);return{year:r,dayOfYear:o}}function Ae(e,t,n){var s,i,r=Ge(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+je(i=e.year()-1,t,n):a>je(e.year(),t,n)?(s=a-je(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function je(e,t,n){var s=Ge(e,t,n),i=Ge(e+1,t,n);return(Fe(e)-s+i)/7}C("w",["ww",2],"wo","week"),C("W",["WW",2],"Wo","isoWeek"),L("week","w"),L("isoWeek","W"),A("week",5),A("isoWeek",5),ce("w",te),ce("ww",te,Q),ce("W",te),ce("WW",te,Q),ge(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=Z(e)});function Ie(e,t){return e.slice(t,7).concat(e.slice(0,t))}C("d",0,"do","day"),C("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),C("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),C("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),C("e",0,0,"weekday"),C("E",0,0,"isoWeekday"),L("day","d"),L("weekday","e"),L("isoWeekday","E"),A("day",11),A("weekday",11),A("isoWeekday",11),ce("d",te),ce("e",te),ce("E",te),ce("dd",function(e,t){return t.weekdaysMinRegex(e)}),ce("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ce("dddd",function(e,t){return t.weekdaysRegex(e)}),ge(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:y(n).invalidWeekday=e}),ge(["d","e","E"],function(e,t,n,s){t[s]=Z(e)});var Ze="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),$e="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),qe=de,Be=de,Je=de;function Qe(){function e(e,t){return t.length-e.length}for(var t,n,s,i,r=[],a=[],o=[],u=[],l=0;l<7;l++)t=_([2e3,1]).day(l),n=me(this.weekdaysMin(t,"")),s=me(this.weekdaysShort(t,"")),i=me(this.weekdays(t,"")),r.push(n),a.push(s),o.push(i),u.push(n),u.push(s),u.push(i);r.sort(e),a.sort(e),o.sort(e),u.sort(e),this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Xe(){return this.hours()%12||12}function Ke(e,t){C(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function et(e,t){return t._meridiemParse}C("H",["HH",2],0,"hour"),C("h",["hh",2],0,Xe),C("k",["kk",2],0,function(){return this.hours()||24}),C("hmm",0,0,function(){return""+Xe.apply(this)+T(this.minutes(),2)}),C("hmmss",0,0,function(){return""+Xe.apply(this)+T(this.minutes(),2)+T(this.seconds(),2)}),C("Hmm",0,0,function(){return""+this.hours()+T(this.minutes(),2)}),C("Hmmss",0,0,function(){return""+this.hours()+T(this.minutes(),2)+T(this.seconds(),2)}),Ke("a",!0),Ke("A",!1),L("hour","h"),A("hour",13),ce("a",et),ce("A",et),ce("H",te),ce("h",te),ce("k",te),ce("HH",te,Q),ce("hh",te,Q),ce("kk",te,Q),ce("hmm",ne),ce("hmmss",se),ce("Hmm",ne),ce("Hmmss",se),ye(["H","HH"],Me),ye(["k","kk"],function(e,t,n){var s=Z(e);t[Me]=24===s?0:s}),ye(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ye(["h","hh"],function(e,t,n){t[Me]=Z(e),y(n).bigHour=!0}),ye("hmm",function(e,t,n){var s=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s)),y(n).bigHour=!0}),ye("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s,2)),t[Se]=Z(e.substr(i)),y(n).bigHour=!0}),ye("Hmm",function(e,t,n){var s=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s))}),ye("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s,2)),t[Se]=Z(e.substr(i))});var tt=z("Hours",!0);var nt,st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Te,monthsShort:Ne,week:{dow:0,doy:6},weekdays:Ze,weekdaysMin:$e,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},it={},rt={};function at(e){return e?e.toLowerCase().replace("_","-"):e}function ot(e){for(var t,n,s,i,r=0;r=t&&function(e,t){for(var n=Math.min(e.length,t.length),s=0;s=t-1)break;t--}r++}return nt}function ut(t){var e;if(void 0===it[t]&&"undefined"!=typeof module&&module&&module.exports)try{e=nt._abbr,require("./locale/"+t),lt(e)}catch(e){it[t]=null}return it[t]}function lt(e,t){var n;return e&&((n=r(t)?dt(e):ht(e,t))?nt=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),nt._abbr}function ht(e,t){if(null===t)return delete it[e],null;var n,s=st;if(t.abbr=e,null!=it[e])Y("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=it[e]._config;else if(null!=t.parentLocale)if(null!=it[t.parentLocale])s=it[t.parentLocale]._config;else{if(null==(n=ut(t.parentLocale)))return rt[t.parentLocale]||(rt[t.parentLocale]=[]),rt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return it[e]=new x(b(s,t)),rt[e]&&rt[e].forEach(function(e){ht(e.name,e.config)}),lt(e),it[e]}function dt(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return nt;if(!o(e)){if(t=ut(e))return t;e=[e]}return ot(e)}function ct(e){var t,n=e._a;return n&&-2===y(e).overflow&&(t=n[ve]<0||11xe(n[pe],n[ve])?ke:n[Me]<0||24je(n,r,a)?y(e)._overflowWeeks=!0:null!=u?y(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[pe]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=St(e._a[pe],s[pe]),(e._dayOfYear>Fe(r)||0===e._dayOfYear)&&(y(e)._overflowDayOfYear=!0),n=Ve(r,0,e._dayOfYear),e._a[ve]=n.getUTCMonth(),e._a[ke]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=u[t]=s[t];for(;t<7;t++)e._a[t]=u[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[Me]&&0===e._a[De]&&0===e._a[Se]&&0===e._a[Ye]&&(e._nextDay=!0,e._a[Me]=0),e._d=(e._useUTC?Ve:function(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}).apply(null,u),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Me]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(y(e).weekdayMismatch=!0)}}function Ot(e){if(e._f!==f.ISO_8601)if(e._f!==f.RFC_2822){e._a=[],y(e).empty=!0;for(var t,n,s,i,r,a,o,u=""+e._i,l=u.length,h=0,d=H(e._f,e._locale).match(N)||[],c=0;cn.valueOf():n.valueOf()"}),pn.toJSON=function(){return this.isValid()?this.toISOString():null},pn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},pn.unix=function(){return Math.floor(this.valueOf()/1e3)},pn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},pn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},pn.eraName=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},pn.isLocal=function(){return!!this.isValid()&&!this._isUTC},pn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},pn.isUtc=At,pn.isUTC=At,pn.zoneAbbr=function(){return this._isUTC?"UTC":""},pn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},pn.dates=n("dates accessor is deprecated. Use date instead.",fn),pn.months=n("months accessor is deprecated. Use month instead",Ue),pn.years=n("years accessor is deprecated. Use year instead",Le),pn.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),pn.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!r(this._isDSTShifted))return this._isDSTShifted;var e,t={};return v(t,this),(t=bt(t))._a?(e=(t._isUTC?_:Tt)(t._a),this._isDSTShifted=this.isValid()&&0