From f36c67530f56ed6b23db6229c719b73885dffe52 Mon Sep 17 00:00:00 2001 From: David Pellier Date: Wed, 15 Feb 2017 12:49:06 +0100 Subject: [PATCH] Fixe redirect after Fullscreen --- dist/castorGUI.min.js | 2 +- src/GUIManager.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/castorGUI.min.js b/dist/castorGUI.min.js index cdf0cf2..becb942 100644 --- a/dist/castorGUI.min.js +++ b/dist/castorGUI.min.js @@ -1 +1 @@ -(function(window){var document=window.document,nativeColorGUI={started:false,color:'#000000',inputs:{},hasNativeColorSupport:false,init:function(inputId){this.start();if(this.hasNativeColorSupport){return;}if(typeof inputId!=='string'){throw'inputId have to be a string id selector';}this.input=(this.inputs[inputId]=this.inputs[inputId])||document.getElementById(inputId);if(!this.input){throw'There was no input found with id:"' + inputId + '"';}this.input.value=this.color;this.input.unselectable='on';this.css(this.input,{backgroundColor:this.color,borderWidth:'0.4em 0.3em',width:'3em',cursor:'default'});this.input.onfocus=function(){nativeColorPicker.onFocus(this.id);};},start:function(){if(this.started){return;}try{this.hasNativeColorSupport=!!(document.createElement('input').type='color');}catch(e){};if(!this.hasNativeColorSupport){var object_element=document.createElement('object');object_element.classid='clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b';object_element.id='colorHelperObj';this.css(object_element,{width:'0',height:'0'});document.body.appendChild(object_element);}this.started=true;},destroy:function(inputId){var i;if(typeof inputId==='string'){this.off(this.inputs[inputId]);}else{document.body.removeChild(document.getElementById('colorHelperObj'));for(i in this.inputs){this.off(this.inputs[i]);}this.started=false;}},off:function(input){input.onfocus=null;this.css(input,{backgroundColor:'',borderWidth:'',width:'',cursor:''});},onFocus:function(inputId){this.input=this.inputs[inputId];this.color=this.getColor();this.input.value=this.color;nativeColorGUI.css(this.input,{backgroundColor:this.color,color:this.color});this.input.blur();},getColor:function(){var hex=colorHelperObj.ChooseColorDlg(this.color.replace(/#/,'')).toString(16);if(hex.length<6){var tmpstr='000000'.substring(0,6-hex.length);hex=tmpstr.concat(hex);}return'#'+hex;},css:function(el,props){for(var prop in props){el.style[prop]=props[prop];}}};window.nativeColorGUI=nativeColorGUI;}(window));var CASTORGUI=CASTORGUI||{};var guiElements=[];var objectCreate=function(proto){function construct(){}construct.prototype=proto;return new construct();};var Extends=function(ChildClass,ParentClass){ChildClass.prototype=Object.create(ParentClass.prototype)||objectCreate(ParentClass.prototype);ChildClass.prototype.constructor=ChildClass;};(function(){CASTORGUI.GUIManager=function(canvas,css,options){this.canvasCss=css;this.canvas=canvas;this.groups=[];this.guiVisible=true;this.GUIstyle=null;this.GUItheme=null;if(options){this.pixel=options.pixel;this.themeRoot=options.themeRoot||"";this.theme=options.themeGUI||"default";}else{this.pixel=true;this.themeRoot="";this.theme="default";}this.head=document.head||document.getElementsByTagName('head')[0]||null;this.html=document.body||document.getElementsByTagName('body')[0];if(this.head==null){this.header=document.createElement('head');this.head.appendChild(this.header);}this.addStyle(this.canvasCss,this.theme);document.addEventListener('webkitfullscreenchange',function(){location.reload();},false);document.addEventListener('mozfullscreenchange',function(){location.reload();},false);document.addEventListener('fullscreenchange',function(){location.reload();},false);document.addEventListener('MSFullscreenChange',function(){location.reload();},false);};CASTORGUI.GUIManager.prototype.addGuiElements=function(elem){guiElements.push(elem);};CASTORGUI.GUIManager.convertPixelToPercent=false;CASTORGUI.GUIManager.prototype.convertPixelToPercentWidth=function(pixel){var screenWidth=window.innerWidth;var valueWidth=(pixel/screenWidth)*100;return valueWidth;};CASTORGUI.GUIManager.prototype.convertPixelToPercentHeight=function(pixel){var screenHeight=window.innerHeight;var valueHeight=(pixel/screenHeight)*100;return valueHeight;};CASTORGUI.GUIManager.prototype.addStyle=function(css,theme){if(this.GUIstyle){this.head.removeChild(this.getElementById("styleGUI"));this.canvasCss=this.canvasCss+css;}else{this.canvasCss=this.canvasCss;}this.GUIstyle=document.createElement('style');this.GUIstyle.type='text/css';this.GUIstyle.media='screen';this.GUIstyle.id="styleGUI";if(this.GUIstyle.styleSheet){this.GUIstyle.styleSheet.cssText=this.canvasCss;}else{this.GUIstyle.appendChild(document.createTextNode(this.canvasCss));}this.head.appendChild(this.GUIstyle);if(this.GUItheme){this.head.removeChild(this.getElementById("themeGUI"));}this.GUItheme=document.createElement('link');this.GUItheme.type='text/css';this.GUItheme.rel='stylesheet';this.GUItheme.media='screen';this.GUItheme.id="themeGUI";this.GUItheme.href=this.themeRoot+"themesGUI/"+theme+".css";this.head.appendChild(this.GUItheme);};CASTORGUI.GUIManager.prototype.fadeOut=function(el){if(el){el.style.opacity=1;(function fade_moin(){if((el.style.opacity-=0.1)<0.1){el.style.display="none";el.style.opacity=0;}else if(el.style.opacity>0){requestAnimationFrame(fade_moin);}})();}};CASTORGUI.GUIManager.prototype.fadeIn=function(el){if(el){el.style.opacity=0;el.style.display="block";(function fade_plus(){var val=parseFloat(el.style.opacity);if(!((val+=0.1)>0.9)){el.style.opacity=1;requestAnimationFrame(fade_plus);}})();}};CASTORGUI.GUIManager.prototype.getElementById=function(id){return document.getElementById(id);};CASTORGUI.GUIManager.prototype.getCanvasOrigine=function(){var offsets=this.canvas.getBoundingClientRect(),offsetsTop=offsets.top||0,offsetsLeft=offsets.left||0;return{top:offsetsTop,left:offsetsLeft};};CASTORGUI.GUIManager.prototype.getCanvasSize=function(){var offsets=this.canvas.getBoundingClientRect(),offsetsWidth=offsets.width||0,offsetsHeight=offsets.height||0;return{width:offsetsWidth,height:offsetsHeight};};CASTORGUI.GUIManager.prototype.dispose=function(){var that=this;guiElements.forEach(function(e){if(that.getElementById(e.id)){that.html.removeChild(that.getElementById(e.id));}});return;};CASTORGUI.GUIManager.prototype.setVisible=function(bool,fade){var display;var that=this;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.guiVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.guiVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){guiElements.forEach(function(e){that.getElementById(e.id).style.display=display;});}};CASTORGUI.GUIManager.prototype.isVisible=function(){return this.guiVisible;};})();var CASTORGUI=CASTORGUI||{};!(function(moduleName,definition){if(typeof define==='function'&&typeof define.amd==='object'){define(definition);}else{this[moduleName]=definition();}})('draggable',function definition(){var currentElement,fairlyHighZIndex='10';CASTORGUI.addEventListener=function(element,eventName,handler){if(element.addEventListener){element.addEventListener(eventName,handler,false);}else if(element.attachEvent){element.attachEvent('on'+eventName,handler);}else{element['on'+eventName]=handler;}};CASTORGUI.removeEventListener=function(element,eventName,handler){if(element.removeEventListener){element.removeEventListener(eventName,handler,false);}else if(element.detachEvent){element.detachEvent('on'+eventName,handler);}else{element['on'+eventName]=null;}};CASTORGUI.draggable=function(element,handle){handle=handle||element;CASTORGUI.setPositionType(element);CASTORGUI.setDraggableListeners(element);CASTORGUI.addEventListener(handle,'mousedown',function(event){CASTORGUI.startDragging(event,element);});};CASTORGUI.setPositionType=function(element){element.style.position='absolute';};CASTORGUI.setDraggableListeners=function(element){element.draggableListeners={start:[],drag:[],stop:[]};element.whenDragStarts=CASTORGUI.addListener(element,'start');element.whenDragging=CASTORGUI.addListener(element,'drag');element.whenDragStops=CASTORGUI.addListener(element,'stop');};CASTORGUI.startDragging=function(event,element){currentElement&&CASTORGUI.sendToBack(currentElement);currentElement=CASTORGUI.bringToFront(element);var initialPosition=CASTORGUI.getInitialPosition(currentElement);currentElement.style.left=CASTORGUI.inPixels(initialPosition.left);currentElement.style.top=CASTORGUI.inPixels(initialPosition.top);currentElement.lastXPosition=event.clientX;currentElement.lastYPosition=event.clientY;var okToGoOn=CASTORGUI.triggerEvent('start',{x:initialPosition.left,y:initialPosition.top,mouseEvent:event});if(!okToGoOn){return;}CASTORGUI.addDocumentListeners();};CASTORGUI.addListener=function(element,type){return function(listener){element.draggableListeners[type].push(listener);};};CASTORGUI.triggerEvent=function(type,args){var result=true;var listeners=currentElement.draggableListeners[type];for(var i=listeners.length-1;i>=0;i--){if(listeners[i](args)===false){result=false;}};return result;};CASTORGUI.sendToBack=function(element){var decreasedZIndex=fairlyHighZIndex-1;element.style['z-index']=decreasedZIndex;element.style['zIndex']=decreasedZIndex;};CASTORGUI.bringToFront=function(element){element.style['z-index']=fairlyHighZIndex;element.style['zIndex']=fairlyHighZIndex;return element;};CASTORGUI.addDocumentListeners=function(){CASTORGUI.addEventListener(document,'selectstart',CASTORGUI.cancelDocumentSelection);CASTORGUI.addEventListener(document,'mousemove',CASTORGUI.repositionElement);CASTORGUI.addEventListener(document,'mouseup',CASTORGUI.removeDocumentListeners);CASTORGUI.addEventListener(document,"touchstart",CASTORGUI.cancelDocumentSelection);CASTORGUI.addEventListener(document,"touchmove",CASTORGUI.repositionElement);CASTORGUI.addEventListener(document,"touchend",CASTORGUI.removeDocumentListeners);CASTORGUI.addEventListener(document,"touchcancel",CASTORGUI.removeDocumentListeners);};CASTORGUI.getInitialPosition=function(element){var boundingClientRect=element.getBoundingClientRect();return{top:boundingClientRect.top,left:boundingClientRect.left};};CASTORGUI.inPixels=function(value){return value+'px';};CASTORGUI.cancelDocumentSelection=function(event){event.preventDefault&&event.preventDefault();event.stopPropagation&&event.stopPropagation();event.returnValue=false;return false;};CASTORGUI.repositionElement=function(event){event.preventDefault&&event.preventDefault();event.returnValue=false;var style=currentElement.style;var elementXPosition=parseInt(style.left,10);var elementYPosition=parseInt(style.top,10);var elementNewXPosition=elementXPosition+(event.clientX-currentElement.lastXPosition);var elementNewYPosition=elementYPosition+(event.clientY-currentElement.lastYPosition);style.left=CASTORGUI.inPixels(elementNewXPosition);style.top=CASTORGUI.inPixels(elementNewYPosition);currentElement.lastXPosition=event.clientX;currentElement.lastYPosition=event.clientY;CASTORGUI.triggerEvent('drag',{x:elementNewXPosition,y:elementNewYPosition,mouseEvent:event});};CASTORGUI.removeDocumentListeners=function(event){CASTORGUI.removeEventListener(document,'selectstart',CASTORGUI.cancelDocumentSelection);CASTORGUI.removeEventListener(document,'mousemove',CASTORGUI.repositionElement);CASTORGUI.removeEventListener(document,'mouseup',CASTORGUI.removeDocumentListeners);CASTORGUI.removeEventListener(document,"touchstart",CASTORGUI.cancelDocumentSelection);CASTORGUI.removeEventListener(document,"touchmove",CASTORGUI.repositionElement);CASTORGUI.removeEventListener(document,"touchend",CASTORGUI.removeDocumentListeners);CASTORGUI.removeEventListener(document,"touchcancel",CASTORGUI.removeDocumentListeners);var left=parseInt(currentElement.style.left,10);var top=parseInt(currentElement.style.top,10);CASTORGUI.triggerEvent('stop',{x:left,y:top,mouseEvent:event});};return CASTORGUI.draggable;});var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIWindow=function(id,options,guimanager){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.windowPosition={x:options.x,y:options.y};this.windowSize={width:options.w,height:options.h};this.colorWindow=options.backgroundColor||null;this.imageWindow=options.backgroundImage||null;this.colorContent=options.colorContent||null;this.imageContent=options.imageContent;this.buttonClose=typeof options.closeButton;this.overflow=options.overflow||"auto";this.borderWindow=options.borderWindow||null;this.borderTitle=options.borderTitle||null;this.heightTitle=options.heightTitle||30;this.fontSize=options.titleFontSize||12;this.radiusWindow=options.radiusWindow||8;this.colorTitle=options.colorTitle||"rgba(0, 0, 0, 0.4)";this.imageTitle=options.imageTitle||null;this.textAlign=options.titleTextAlign||"center";this.colorTextTitle=options.titleColor||null;this.title=options.textTitle||"Title";if(options.draggable==true||options.draggable==undefined){this.draggable=true;}else{this.draggable=false;}this.zIndex=options.zIndex||0;this.windowVisible=false;this.addElement();};Extends(CASTORGUI.GUIWindow,CASTORGUI.GUIManager);CASTORGUI.GUIWindow.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var window=document.createElement("div");window.style.position="absolute";window.style.width=this.windowSize.width+"px";window.style.height=this.windowSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){window.style.top=this.convertPixelToPercentHeight(this.windowPosition.y+this.getCanvasOrigine().top)+"%";window.style.left=this.convertPixelToPercentWidth(this.windowPosition.x+this.getCanvasOrigine().left)+"%";}else{window.style.top=(this.windowPosition.y+this.getCanvasOrigine().top)+signe;window.style.left=(this.windowPosition.x+this.getCanvasOrigine().left)+signe;}window.style.borderRadius=this.radiusWindow+"px";window.id=this.id;window.name=this.id;window.className="GUIWindow";window.style.zIndex=this.zIndex||0;window.style.backgroundColor=this.colorWindow;window.style.backgroundImage="url("+this.imageWindow+")";window.style.border=this.borderWindow;window.style.wordWrap="break-word";window.style.display="none";var titreWindow=document.createElement("div");titreWindow.className="titleWindoWGUI";titreWindow.style.width=this.windowSize.width+"px";titreWindow.style.height=this.heightTitle+"px";titreWindow.style.textAlign=this.textAlign;titreWindow.style.fontSize=this.fontSize+"px";titreWindow.style.borderRadius=this.radiusWindow+"px "+this.radiusWindow+"px 0 0";titreWindow.id=this.id+"_titre";titreWindow.style.backgroundColor=this.colorTitle;titreWindow.style.backgroundImage="url("+this.imageTitle+")";titreWindow.style.borderBottom=this.borderTitle;if(this.draggable==true){titreWindow.ondragstart=CASTORGUI.draggable(window,titreWindow);titreWindow.style.cursor="move";}titreWindow.innerHTML=this.title;titreWindow.style.zIndex=this.zIndex+1;titreWindow.style.color=this.colorTextTitle;titreWindow.style.wordWrap="break-word";var that=this;if(this.buttonClose==true||this.buttonClose=="undefined"){var close=document.createElement("button");close.innerHTML="X";close.id=this.id+"_button";close.style.position="absolute";close.style.borderRadius="12px";close.style.left=this.windowSize.width-12+"px";close.style.marginTop="-12px";close.style.width="24px";close.style.height="24px";close.style.zIndex=10000;close.onclick=function(){that.getElementById(that.id).style.display="none";that.windowVisible=false;};}var contentWindow=document.createElement("div");contentWindow.id=this.id+"_content";contentWindow.style.width=this.windowSize.width+"px";contentWindow.style.height=this.windowSize.height-38+"px";contentWindow.style.overflow=this.overflow;contentWindow.style.wordBreak="keep-all";contentWindow.style.marginTop="0px";contentWindow.style.paddingTop="5px";contentWindow.style.borderRadius="8px";contentWindow.style.backgroundColor=this.colorContent;contentWindow.style.backgroundImage="url("+this.imageContent+")";contentWindow.style.zIndex=this.zIndex+2;this.html.appendChild(window);this.getElementById(this.id).appendChild(titreWindow);if(this.buttonClose==true||this.buttonClose=="undefined"){this.getElementById(this.id+"_titre").appendChild(close);}this.getElementById(this.id).appendChild(contentWindow);this.addGuiElements(window);};CASTORGUI.GUIWindow.prototype.add=function(element){var contentForm=this.getElementById(this.id+"_content");contentForm.style.zIndex=this.zIndex+1;element.addElement(false,contentForm);};CASTORGUI.GUIWindow.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIWindow.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.windowVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.windowVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIWindow.prototype.isVisible=function(){return this.windowVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUITexture=function(id,imageUrl,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.imageUrl=imageUrl;this.textureClicked=callback||false;this.imageSize={width:options.w,height:options.h};this.imagePosition={x:options.x,y:options.y};this.imageVisible=true;this.zIndex=options.zIndex||1;this.html=document.body||document.getElementsByTagName('body')[0];if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUITexture,CASTORGUI.GUIManager);CASTORGUI.GUITexture.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var img=document.createElement("img");img.src=this.imageUrl;img.style.width=this.imageSize.width+"px";img.style.height=this.imageSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){img.style.top=this.convertPixelToPercentHeight(this.imagePosition.y+this.getCanvasOrigine().top)+"%";img.style.left=this.convertPixelToPercentWidth(this.imagePosition.x+this.getCanvasOrigine().left)+"%";}else{img.style.top=(this.imagePosition.y)+"px";img.style.left=(this.imagePosition.x)+"px";}}else{if(append==true){img.style.top=(this.imagePosition.y+this.getCanvasOrigine().top)+signe;img.style.left=(this.imagePosition.x+this.getCanvasOrigine().left)+signe;}else{img.style.top=this.imagePosition.y+signe;img.style.left=this.imagePosition.x+signe;}}img.style.position="absolute";img.style.zIndex=this.zIndex;img.id=this.id;img.name=this.id;img.className="GUITexture";if(this.textureClicked){var that=this;img.addEventListener('click',that.textureClicked,false);}if(append==true){this.html.appendChild(img);}else{element.appendChild(img);}this.addGuiElements(img);};CASTORGUI.GUITexture.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUITexture.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.imageVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.imageVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUITexture.prototype.isVisible=function(){return this.imageVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUITextfield=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.textfieldPosition={x:options.x,y:options.y};this.textfieldSize={width:options.w,height:options.h};this.value=options.value||"";this.background=options.background||null;this.border=options.border||null;this.color=options.color||null;this.placeholder=options.placeholder||"";this.zIndex=options.zIndex||2;this.textfieldVisible=true;this.onchangeTextfield=callback||"";this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUITextfield,CASTORGUI.GUIManager);CASTORGUI.GUITextfield.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var textfield=document.createElement("input");textfield.type="text";textfield.style.width=this.textfieldSize.width+"px";textfield.style.height=this.textfieldSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){textfield.style.top=this.convertPixelToPercentHeight(this.textfieldPosition.y+this.getCanvasOrigine().top)+"%";textfield.style.left=this.convertPixelToPercentWidth(this.textfieldPosition.x+this.getCanvasOrigine().left)+"%";}else{textfield.style.top=(this.textfieldPosition.y)+"px";textfield.style.left=(this.textfieldPosition.x)+"px";}}else{if(append==true){textfield.style.top=(this.textfieldPosition.y+this.getCanvasOrigine().top)+signe;textfield.style.left=(this.textfieldPosition.x+this.getCanvasOrigine().left)+signe;}else{textfield.style.top=this.textfieldPosition.y+signe;textfield.style.left=this.textfieldPosition.x+signe;}}textfield.style.position="absolute";textfield.style.display="block";textfield.id=this.id;textfield.name=this.id;textfield.className="GUITextfield";textfield.tabindex=this.tabindex;textfield.value=this.value;textfield.placeholder=this.placeholder;textfield.style.zIndex=this.zIndex;if(this.background!=null){textfield.style.background=this.background;}textfield.style.border=this.border;if(this.color!=null){textfield.style.color=this.color;}textfield.onchange=this.onchangeTextfield;if(append==true){this.html.appendChild(textfield);}else{element.appendChild(textfield);}this.addGuiElements(textfield);};CASTORGUI.GUITextfield.prototype.getValue=function(){return this.getElementById(this.id).value;};CASTORGUI.GUITextfield.prototype.setValue=function(val){this.value=val;this.getElementById(this.id).value=val;};CASTORGUI.GUITextfield.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUITextfield.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.textfieldVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.textfieldVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUITextfield.prototype.isVisible=function(){return this.textfieldVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUITextarea=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.textareaPosition={x:options.x,y:options.y};this.textareaSize={width:options.w,height:options.h};this.value=options.value||"";this.placeholder=options.placeholder||"";this.background=options.background||null;this.color=options.color||null;this.zIndex=options.zIndex||2;this.textareaVisible=true;this.onchangeTextarea=callback||"";this.tabindex=options.tabindex||0;this.append=append;if(this.append==true){this.addElement(this.append);}};Extends(CASTORGUI.GUITextarea,CASTORGUI.GUIManager);CASTORGUI.GUITextarea.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var textarea=document.createElement("textarea");textarea.cols=this.textareaSize.width;textarea.rows=this.textareaSize.height;if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){textarea.style.top=this.convertPixelToPercentHeight(this.textareaPosition.y+this.getCanvasOrigine().top)+"%";textarea.style.left=this.convertPixelToPercentWidth(this.textareaPosition.x+this.getCanvasOrigine().left)+"%";}else{textarea.style.top=(this.textareaPosition.y)+"px";textarea.style.left=(this.textareaPosition.x)+"ox";}}else{if(append==true){textarea.style.top=(this.textareaPosition.y+this.getCanvasOrigine().top)+signe;textarea.style.left=(this.textareaPosition.x+this.getCanvasOrigine().left)+signe;}else{textarea.style.top=this.textareaPosition.y+signe;textarea.style.left=this.textareaPosition.x+signe;}}textarea.style.position="absolute";textarea.style.display="block";textarea.placeholder=this.placeholder;textarea.id=this.id;textarea.name=this.id;textarea.className="GUITextarea";textarea.tabindex=this.tabindex;textarea.innerHTML=this.value;textarea.style.zIndex=this.zIndex;if(this.background!=null){textarea.style.background=this.background;}if(this.color!=null){textarea.style.color=this.color;}textarea.onchange=this.onchangeTextarea;if(append==true){this.html.appendChild(textarea);}else{element.appendChild(textarea);}this.addGuiElements(textarea);};CASTORGUI.GUITextarea.prototype.getValue=function(){return this.getElementById(this.id).value;};CASTORGUI.GUITextarea.prototype.setValue=function(val){this.value=val;this.getElementById(this.id).value=val;};CASTORGUI.GUITextarea.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUITextarea.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.textareaVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.textareaVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUITextarea.prototype.isVisible=function(){return this.textareaVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIText=function(id,options,guimanager,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);this.append=append;if(append==null||append==undefined){this.append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.textPosition={x:options.x,y:options.y};this.textSize=options.size||30;this.color=options.color||null;this.background=options.background||null;this.police=options.police||null;this.texte=options.text||"CastorGUI";this.zIndex=options.zIndex||1;this.bold=options.bold||null;this.italic=options.italic||null;this.position=options.position||"absolute";this.centerVertical=options.centerVertical||false;this.centerHorizontal=options.centerHorizontal||false;this.inline=options.inline||false;this.textVisible=true;this.textElement=null;this.font=null;if(this.append==true){this.addElement(this.append);}};Extends(CASTORGUI.GUIText,CASTORGUI.GUIManager);CASTORGUI.GUIText.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}this.font=this.textSize+"px "+this.police;this.textElement=document.createElement("span");if(this.inline==false){this.textElement.style.width="auto";}else{this.textElement.style.width=CASTORGUI.GUIText.getTextWidth(this.texte,this.font).w+"px";}this.textElement.style.height=CASTORGUI.GUIText.getTextWidth(this.texte,this.font).h+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){this.textElement.style.top=this.convertPixelToPercentHeight(this.textPosition.y+this.getCanvasOrigine().top)+"%";this.textElement.style.left=this.convertPixelToPercentWidth(this.textPosition.x+this.getCanvasOrigine().left)+"%";}else{this.textElement.style.top=(this.textPosition.y)+"px";this.textElement.style.left=(this.textPosition.x)+"px";}}else{if(append==true){this.textElement.style.top=(this.textPosition.y+this.getCanvasOrigine().top)+signe;this.textElement.style.left=(this.textPosition.x+this.getCanvasOrigine().left)+signe;}else{this.textElement.style.top=this.textPosition.y+signe;this.textElement.style.left=this.textPosition.x+signe;}}this.textElement.style.display="block";this.textElement.style.position=this.position;this.textElement.style.font=this.font;this.textElement.style.color=this.color;this.textElement.style.background=this.background;this.textElement.style.fontStyle=this.italic;this.textElement.style.fontWeight=this.bold;this.textElement.innerHTML=this.texte;this.textElement.id=this.id;this.textElement.name=this.id;this.textElement.className="GUIText";this.textElement.style.zIndex=this.zIndex;if(append==true){if(this.centerVertical){var marginTop=((this.getCanvasSize().height/2)-(CASTORGUI.GUIText.getTextWidth(this.texte,this.font).h/2));this.textElement.style.top=(marginTop+this.getCanvasOrigine().top)+signe;}if(this.centerHorizontal){var marginTotal=(this.getCanvasSize().width-CASTORGUI.GUIText.getTextWidth(this.texte,this.font).w);var marginLeft=(marginTotal/2);this.textElement.style.left=(marginLeft+this.getCanvasOrigine().left)+signe;}this.html.appendChild(this.textElement);}else{if(this.centerVertical){this.textElement.style.top="calc(50% - "+(CASTORGUI.GUIText.getTextWidth(this.texte,this.font).h/2)+"px)";}if(this.centerHorizontal=="true"){this.textElement.style.width="100%";this.textElement.style.textAlign="center";}element.appendChild(this.textElement);}this.addGuiElements(this.textElement);};CASTORGUI.GUIText.prototype.updateText=function(texte){var signe="";if(this.pixel){signe="px";}else{signe="%";}if(this.append==true){this.textElement.style.width=CASTORGUI.GUIText.getTextWidth(texte,this.font).w+signe;this.textElement.style.height=CASTORGUI.GUIText.getTextWidth(texte,this.font).h+signe;this.textElement.style.top=(this.textPosition.y+this.getCanvasOrigine().top)+signe;this.textElement.style.left=(this.textPosition.x+this.getCanvasOrigine().left)+signe;}else{this.textElement.style.top=this.textPosition.y+signe;this.textElement.style.left=this.textPosition.x+signe;}if(this.centerVertical=="true"){var marginTop=((this.getCanvasSize().height/2)-(CASTORGUI.GUIText.getTextWidth(texte,this.font).h/2));this.textElement.style.top=(marginTop+this.getCanvasOrigine().top)+signe;}if(this.centerHorizontal=="true"){var marginTotal=(this.getCanvasSize().width-CASTORGUI.GUIText.getTextWidth(texte,this.font).w);var marginLeft=(marginTotal/2);this.textElement.style.left=(marginLeft+this.getCanvasOrigine().left)+signe;}this.textElement.innerHTML=texte;};CASTORGUI.GUIText.getTextWidth=function(texte,font){var tag=document.createElement("div");tag.style.position="absolute";tag.style.left="-999em";tag.style.display="block";tag.style.whiteSpace="nowrap";tag.style.font=font||this.textSize+"px "+this.police;tag.innerHTML=texte;document.body.appendChild(tag);var result={w:tag.clientWidth+10,h:tag.clientHeight};document.body.removeChild(tag);return result;};CASTORGUI.GUIText.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIText.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.textVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.textVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIText.prototype.isVisible=function(){return this.textVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUITextLink=function(id,options,guimanager,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);this.append=append;if(append==null||append==undefined){this.append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.textPosition={x:options.x,y:options.y};this.textSize=options.size||30;this.color=options.color||null;this.background=options.background||null;this.police=options.police||null;this.texte=options.text||"google.com";this.zIndex=options.zIndex||1;this.bold=options.bold||null;this.italic=options.italic||null;this.position=options.position||"absolute";this.centerVertical=options.centerVertical||false;this.centerHorizontal=options.centerHorizontal||false;this.inline=options.inline||false;this.textVisible=true;this.textElement=null;this.font=null;this.href=options.href||"https:\/\/www.google.com";if(this.append==true){this.addElement(this.append);}};Extends(CASTORGUI.GUITextLink,CASTORGUI.GUIManager);CASTORGUI.GUITextLink.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}this.font=this.textSize+"px "+this.police;this.textElement=document.createElement("a");if(this.inline==false){this.textElement.style.width="auto";}else{this.textElement.style.width=CASTORGUI.GUITextLink.getTextWidth(this.texte,this.font).w+"px";}this.textElement.style.height=CASTORGUI.GUITextLink.getTextWidth(this.texte,this.font).h+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){this.textElement.style.top=this.convertPixelToPercentHeight(this.textPosition.y+this.getCanvasOrigine().top)+"%";this.textElement.style.left=this.convertPixelToPercentWidth(this.textPosition.x+this.getCanvasOrigine().left)+"%";}else{this.textElement.style.top=(this.textPosition.y)+"px";this.textElement.style.left=(this.textPosition.x)+"px";}}else{if(append==true){this.textElement.style.top=(this.textPosition.y+this.getCanvasOrigine().top)+signe;this.textElement.style.left=(this.textPosition.x+this.getCanvasOrigine().left)+signe;}else{this.textElement.style.top=this.textPosition.y+signe;this.textElement.style.left=this.textPosition.x+signe;}}this.textElement.style.display="block";this.textElement.style.position=this.position;this.textElement.style.font=this.font;this.textElement.style.color=this.color;this.textElement.style.background=this.background;this.textElement.style.fontStyle=this.italic;this.textElement.style.fontWeight=this.bold;this.textElement.innerHTML=this.texte;this.textElement.id=this.id;this.textElement.name=this.id;this.textElement.className="GUITextLink";this.textElement.style.zIndex=this.zIndex;this.textElement.setAttribute('href',this.href);if(append==true){if(this.centerVertical){var marginTop=((this.getCanvasSize().height/2)-(CASTORGUI.GUITextLink.getTextWidth(this.texte,this.font).h/2));this.textElement.style.top=(marginTop+this.getCanvasOrigine().top)+signe;}if(this.centerHorizontal){var marginTotal=(this.getCanvasSize().width-CASTORGUI.GUITextLink.getTextWidth(this.texte,this.font).w);var marginLeft=(marginTotal/2);this.textElement.style.left=(marginLeft+this.getCanvasOrigine().left)+signe;}this.html.appendChild(this.textElement);}else{if(this.centerVertical){this.textElement.style.top="calc(50% - "+(CASTORGUI.GUITextLink.getTextWidth(this.texte,this.font).h/2)+"px)";}if(this.centerHorizontal=="true"){this.textElement.style.width="100%";this.textElement.style.textAlign="center";}element.appendChild(this.textElement);}this.addGuiElements(this.textElement);};CASTORGUI.GUITextLink.prototype.updateText=function(texte){var signe="";if(this.pixel){signe="px";}else{signe="%";}if(this.append==true){this.textElement.style.width=CASTORGUI.GUITextLink.getTextWidth(texte,this.font).w+signe;this.textElement.style.height=CASTORGUI.GUITextLink.getTextWidth(texte,this.font).h+signe;this.textElement.style.top=(this.textPosition.y+this.getCanvasOrigine().top)+signe;this.textElement.style.left=(this.textPosition.x+this.getCanvasOrigine().left)+signe;}else{this.textElement.style.top=this.textPosition.y+signe;this.textElement.style.left=this.textPosition.x+signe;}if(this.centerVertical=="true"){var marginTop=((this.getCanvasSize().height/2)-(CASTORGUI.GUITextLink.getTextWidth(texte,this.font).h/2));this.textElement.style.top=(marginTop+this.getCanvasOrigine().top)+signe;}if(this.centerHorizontal=="true"){var marginTotal=(this.getCanvasSize().width-CASTORGUI.GUITextLink.getTextWidth(texte,this.font).w);var marginLeft=(marginTotal/2);this.textElement.style.left=(marginLeft+this.getCanvasOrigine().left)+signe;}this.textElement.innerHTML=texte;};CASTORGUI.GUITextLink.getTextWidth=function(texte,font){var tag=document.createElement("div");tag.style.position="absolute";tag.style.left="-999em";tag.style.display="block";tag.style.whiteSpace="nowrap";tag.style.font=font||this.textSize+"px "+this.police;tag.innerHTML=texte;document.body.appendChild(tag);var result={w:tag.clientWidth+10,h:tag.clientHeight};document.body.removeChild(tag);return result;};CASTORGUI.GUITextLink.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUITextLink.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.textVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.textVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUITextLink.prototype.isVisible=function(){return this.textVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUISlider=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.sliderPosition={x:options.x,y:options.y};this.sliderSize={width:options.w,height:options.h};this.min=options.min||0;this.max=options.max||100;this.step=options.step||1;this.value=options.value||(this.max/2);this.zIndex=options.zIndex||1;this.orient=options.orient||"horizontal";this.sliderVisible=true;this.onchangeSlider=callback||false;this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUISlider,CASTORGUI.GUIManager);CASTORGUI.GUISlider.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var slider=document.createElement("input");slider.type="range";slider.min=this.min;slider.max=this.max;slider.value=this.value;slider.step=this.step;slider.className="GUISlider";slider.tabindex=this.tabindex;slider.style.width=this.sliderSize.width+"px";slider.style.height=this.sliderSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){slider.style.top=this.convertPixelToPercentHeight(this.sliderPosition.y+this.getCanvasOrigine().top)+"%";slider.style.left=this.convertPixelToPercentWidth(this.sliderPosition.x+this.getCanvasOrigine().left)+"%";}else{slider.style.top=(this.sliderPosition.y)+"px";slider.style.left=(this.sliderPosition.x)+"px";}}else{if(append==true){slider.style.top=(this.sliderPosition.y+this.getCanvasOrigine().top)+signe;slider.style.left=(this.sliderPosition.x+this.getCanvasOrigine().left)+signe;}else{slider.style.top=this.sliderPosition.y+signe;slider.style.left=this.sliderPosition.x+signe;}}slider.style.position="absolute";slider.id=this.id;slider.name=this.id;slider.style.zIndex=this.zIndex;if(this.orient=="vertical"||this.orient=="Vertical"){slider.style.writingMode="bt-lr";slider.style.WebkitAppearance="slider-vertical";}slider.oninput=this.onchangeSlider;slider.onchange=this.onchangeSlider;if(append==true){this.html.appendChild(slider);}else{element.appendChild(slider);}this.addGuiElements(slider);};CASTORGUI.GUISlider.prototype.getValue=function(){return this.getElementById(this.id).value;};CASTORGUI.GUISlider.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUISlider.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.sliderVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.sliderVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUISlider.prototype.isVisible=function(){return this.sliderVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUISelect=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.selectPosition={x:options.x,y:options.y};this.selectSize={width:options.w,height:options.h};this.zIndex=options.zIndex||1;this.selectVisible=true;this.onchangeSelectoptions=callback||false;this.tabindex=options.tabindex||0;this.optionsListe=[];this.append=append;if(this.append==true){this.addElement(this.append);}};Extends(CASTORGUI.GUISelect,CASTORGUI.GUIManager);CASTORGUI.GUISelect.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var that=this;var select=document.createElement("select");select.style.width=this.selectSize.width+"px";select.style.height=this.selectSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){select.style.top=this.convertPixelToPercentHeight(this.selectPosition.y+this.getCanvasOrigine().top)+"%";select.style.left=this.convertPixelToPercentWidth(this.selectPosition.x+this.getCanvasOrigine().left)+"%";}else{select.style.top=(this.selectPosition.y)+"px";select.style.left=(this.selectPosition.x)+"px";}}else{if(append==true){select.style.top=(this.selectPosition.y+this.getCanvasOrigine().top)+signe;select.style.left=(this.selectPosition.x+this.getCanvasOrigine().left)+signe;}else{select.style.top=this.selectPosition.y+signe;select.style.left=this.selectPosition.x+signe;}}select.style.position="absolute";select.id=this.id;select.name=this.id;select.className="GUISelect";select.tabindex=this.tabindex;select.style.zIndex=this.zIndex;select.onchange=this.onchangeSelectoptions;if(append==true){this.html.appendChild(select);}else{element.appendChild(select);this.optionsListe.forEach(function(options){that.getElementById(that.id).appendChild(options);});}this.addGuiElements(select);};CASTORGUI.GUISelect.prototype.addOptions=function(value,text){var options=document.createElement("option");options.value=value;options.innerHTML=text;if(this.append==false){this.optionsListe.push(options);}else{this.getElementById(this.id).appendChild(options);}};CASTORGUI.GUISelect.prototype.findOptionSelected=function(withIndex){if(withIndex==undefined)withIndex=false;var elSel=this.getElementById(this.id);var str=elSel.options[elSel.selectedIndex].text;if(withIndex==true){return elSel.selectedIndex;}else{return str;}};CASTORGUI.GUISelect.prototype.removeOption=function(value){var elSel=this.getElementById(this.id);for(var i=0;i<=elSel.length-1;i++){if(elSel.options[i].text==value){elSel.remove(i);break;}}if(this.append==false){for(var b in arr){if(arr[b]==value){arr.splice(b,1);break;}}}return;};CASTORGUI.GUISelect.prototype.changeItem=function(oldValue,newValue){var elSel=this.getElementById(this.id);for(var i=0;i<=elSel.length-1;i++){if(elSel.options[i].text==oldValue){elSel.options[i].text=newValue;elSel.options[i].value=newValue;break;}}return;};CASTORGUI.GUISelect.prototype.selectedItem=function(item){var elSel=this.getElementById(this.id);for(var i=0;i<=elSel.length-1;i++){if(elSel.options[i].text==item){elSel.options[i].setAttribute('selected',true);}else{elSel.options[i].removeAttribute('selected');}}return;};CASTORGUI.GUISelect.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUISelect.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.selectVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.selectVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUISelect.prototype.isVisible=function(){return this.selectVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIRadio=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.name=options.name||"NameRadio"+id;this.html=document.body||document.getElementsByTagName('body')[0];this.radioPosition={x:options.x,y:options.y};this.radioSize=options.size||1.0;this.zIndex=options.zIndex||1;this.radioVisible=true;this.onClickRadio=callback||false;this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUIRadio,CASTORGUI.GUIManager);CASTORGUI.GUIRadio.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var radio=document.createElement("input");radio.type="radio";radio.style.width=(this.radioSize*16)+"px";radio.style.height=(this.radioSize*16)+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){radio.style.top=this.convertPixelToPercentHeight(this.radioPosition.y+this.getCanvasOrigine().top)+"%";radio.style.left=this.convertPixelToPercentWidth(this.radioPosition.x+this.getCanvasOrigine().left)+"%";}else{radio.style.top=(this.radioPosition.y)+"px";radio.style.left=(this.radioPosition.x)+"px";}}else{if(append==true){radio.style.top=(this.radioPosition.y+this.getCanvasOrigine().top)+signe;radio.style.left=(this.radioPosition.x+this.getCanvasOrigine().left)+signe;}else{radio.style.top=this.radioPosition.y+signe;radio.style.left=this.radioPosition.x+signe;}}radio.style.position="absolute";radio.style.padding="0px";radio.style.margin="0px";radio.id=this.id;radio.tabindex=this.tabindex;radio.className="GUIRadio";radio.name=this.name;radio.style.zIndex=this.zIndex;radio.onclick=this.onClickRadio;if(append==true){this.html.appendChild(radio);}else{element.appendChild(radio);}this.addGuiElements(radio);};CASTORGUI.GUIRadio.prototype.isChecked=function(){if(this.getElementById(this.id).checked){return true;}else{return false;}};CASTORGUI.GUIRadio.prototype.setChecked=function(value){this.getElementById(this.id).checked=value;};CASTORGUI.GUIRadio.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIRadio.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.radioVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.radioVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIRadio.prototype.isVisible=function(){return this.radioVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUILabel=function(id,options,guimanager,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.labelPosition={x:options.x,y:options.y};this.labelSize={width:options.w,height:options.h};this.textLabel=options.text;this.zIndex=options.zIndex||1;this.labelVisible=true;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUILabel,CASTORGUI.GUIManager);CASTORGUI.GUILabel.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var label=document.createElement("label");if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){label.style.top=this.convertPixelToPercentHeight(this.labelPosition.y+this.getCanvasOrigine().top)+"%";label.style.left=this.convertPixelToPercentWidth(this.labelPosition.x+this.getCanvasOrigine().left)+"%";}else{label.style.top=(this.labelPosition.y)+"px";label.style.left=(this.labelPosition.x)+"px";}}else{if(append==true){label.style.top=(this.labelPosition.y+this.getCanvasOrigine().top)+signe;label.style.left=(this.labelPosition.x+this.getCanvasOrigine().left)+signe;}else{label.style.top=this.labelPosition.y+signe;label.style.left=this.labelPosition.x+signe;}}label.style.position="absolute";label.id=this.id;label.name=this.id;label.className="GUILabel";label.innerHTML=this.textLabel;label.style.zIndex=this.zIndex;if(append==true){this.html.appendChild(label);}else{element.appendChild(label);}this.addGuiElements(label);};CASTORGUI.GUILabel.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUILabel.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.labelVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.labelVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUILabel.prototype.isVisible=function(){return this.labelVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIGroup=function(name,options,guimanager){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);this.html=document.body||document.getElementsByTagName('body')[0];if(options){this.groupPosition={x:options.x,y:options.y};}this.guiManager=guimanager;this.name=name;this.elementsGoup=[];this.guiManager.groups.push(this);this.groupVisible=true;};Extends(CASTORGUI.GUIGroup,CASTORGUI.GUIManager);CASTORGUI.GUIGroup.prototype.add=function(guiElement){this.elementsGoup.push(guiElement);};CASTORGUI.GUIGroup.prototype.dispose=function(){var that=this;this.elementsGoup.forEach(function(e){if(that.getElementById(e.id)){that.html.removeChild(that.getElementById(e.id));}});return;};CASTORGUI.GUIGroup.prototype.setVisible=function(bool){var display;var that=this;if(bool==true){display="block";this.groupVisible=true;}else{display="none";this.groupVisible=false;}this.elementsGoup.forEach(function(e){that.getElementById(e.id).style.display=display;});return;};CASTORGUI.GUIGroup.prototype.isVisible=function(){return this.groupVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIFieldset=function(id,options,guimanager,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.fieldsetPosition={x:options.x,y:options.y};this.fieldsetSize={width:options.w,height:options.h};this.legend=options.legend;this.zIndex=options.zIndex||1;this.fieldsetVisible=true;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUIFieldset,CASTORGUI.GUIManager);CASTORGUI.GUIFieldset.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var fieldset=document.createElement("fieldset");fieldset.style.width=this.fieldsetSize.width+"px";fieldset.style.height=this.fieldsetSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){fieldset.style.top=this.convertPixelToPercentHeight(this.fieldsetPosition.y+this.getCanvasOrigine().top)+"%";fieldset.style.left=this.convertPixelToPercentWidth(this.fieldsetPosition.x+this.getCanvasOrigine().left)+"%";}else{fieldset.style.top=(this.fieldsetPosition.y)+"px";fieldset.style.left=(this.fieldsetPosition.x)+"px";}}else{if(append==true){fieldset.style.top=(this.fieldsetPosition.y+this.getCanvasOrigine().top)+signe;fieldset.style.left=(this.fieldsetPosition.x+this.getCanvasOrigine().left)+signe;}else{fieldset.style.top=(this.fieldsetPosition.y)+signe;fieldset.style.left=(this.fieldsetPosition.x)+signe;}}fieldset.style.position="absolute";fieldset.id=this.id;fieldset.name=this.id;fieldset.className="GUIFieldset";fieldset.style.zIndex=this.zIndex;this.html.appendChild(fieldset);var legend=document.createElement("legend");legend.innerHTML=this.legend;if(append==true){this.getElementById(this.id).appendChild(legend);}else{element.appendChild(legend);}this.addGuiElements(fieldset);};CASTORGUI.GUIFieldset.prototype.add=function(element){var contentFieldSet=this.getElementById(this.id);element.addElement(false,contentFieldSet);};CASTORGUI.GUIFieldset.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIFieldset.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.fieldsetVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.fieldsetVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIFieldset.prototype.isVisible=function(){return this.fieldsetVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUICheckbox=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.checkboxPosition={x:options.x,y:options.y};this.checkboxSize=options.size||1.0;this.zIndex=options.zIndex||1.0;this.checkboxVisible=true;this.onClickCheckbox=callback||"";this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUICheckbox,CASTORGUI.GUIManager);CASTORGUI.GUICheckbox.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var checkbox=document.createElement("input");checkbox.type="checkbox";checkbox.style.width=(this.checkboxSize*16)+"px";checkbox.style.height=(this.checkboxSize*16)+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){checkbox.style.top=this.convertPixelToPercentHeight(this.checkboxPosition.y+this.getCanvasOrigine().top)+"%";checkbox.style.left=this.convertPixelToPercentWidth(this.checkboxPosition.x+this.getCanvasOrigine().left)+"%";}else{checkbox.style.top=(this.checkboxPosition.y)+"px";checkbox.style.left=(this.checkboxPosition.x)+"px";}}else{if(append==true){checkbox.style.top=(this.checkboxPosition.y+this.getCanvasOrigine().top)+signe;checkbox.style.left=(this.checkboxPosition.x+this.getCanvasOrigine().left)+signe;}else{checkbox.style.top=this.checkboxPosition.y+signe;checkbox.style.left=this.checkboxPosition.x+signe;}}checkbox.style.position="absolute";checkbox.style.padding="0px";checkbox.style.margin="0px";checkbox.id=this.id;checkbox.name=this.id;checkbox.className="GUICheckbox";checkbox.tabindex=this.tabindex;checkbox.style.zIndex=this.zIndex;checkbox.onclick=this.onClickCheckbox;if(append==true){this.html.appendChild(checkbox);}else{element.appendChild(checkbox);}this.addGuiElements(checkbox);};CASTORGUI.GUICheckbox.prototype.isChecked=function(){if(this.getElementById(this.id).checked){return true;}else{return false;}};CASTORGUI.GUICheckbox.prototype.setChecked=function(value){this.getElementById(this.id).checked=value;};CASTORGUI.GUICheckbox.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUICheckbox.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.checkboxVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.checkboxVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUICheckbox.prototype.isVisible=function(){return this.checkboxVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIButton=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.buttonPosition={x:options.x,y:options.y};this.buttonSize={width:options.w,height:options.h};this.value=options.value||"Ok";this.buttonVisible=true;this.onClickButton=callback||false;this.imageButton=options.backgroundImage||null;this.colorButton=options.backgroundColor||null;this.borderRadiusButton=options.borderRadiusButton||null;this.borderButton=options.borderButton||null;this.colorText=options.colorText||null;this.zIndex=options.zIndex||1;this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUIButton,CASTORGUI.GUIManager);CASTORGUI.GUIButton.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var button=document.createElement("button");button.style.width=this.buttonSize.width+"px";button.style.height=this.buttonSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){button.style.top=this.convertPixelToPercentHeight(this.buttonPosition.y+this.getCanvasOrigine().top)+"%";button.style.left=this.convertPixelToPercentWidth(this.buttonPosition.x+this.getCanvasOrigine().left)+"%";}else{button.style.top=(this.buttonPosition.y)+"px";button.style.left=(this.buttonPosition.x)+"px";}}else{if(append==true){button.style.top=(this.buttonPosition.y+this.getCanvasOrigine().top)+signe;button.style.left=(this.buttonPosition.x+this.getCanvasOrigine().left)+signe;}else{button.style.top=this.buttonPosition.y+signe;button.style.left=this.buttonPosition.x+signe;}}button.innerHTML=this.value;button.style.position="absolute";button.id=this.id;button.name=this.id;button.style.zIndex=this.zIndex;button.className="GUIButton";button.tabindex=this.tabindex;button.style.borderRadius=this.borderRadiusButton;if(this.imageButton!=null){button.style.backgroundImage="url("+this.imageButton+")";}else{button.style.background=this.colorButton;}button.style.border=this.borderButton;button.style.color=this.colorText;button.onclick=this.onClickButton;if(append==true){this.html.appendChild(button);}else{element.appendChild(button);}this.addGuiElements(button);};CASTORGUI.GUIButton.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIButton.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.buttonVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.buttonVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIButton.prototype.isVisible=function(){return this.buttonVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIDialog=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.dialogSize={width:options.w,height:options.h};this.dialogPosition={x:options.x,y:options.y};this.overflow=options.overflow||"auto";this.borderDialog=options.border||null;this.colorDialog=options.backgroundColor||null;this.imageDialog=options.backgroundImage||null;this.buttonDialog=options.closeDialog||"true";this.imageButtonDialog=options.imageButtonDialog||"false";this.urlImage=options.urlImage||null;this.callback=callback||null;this.radius=options.radius||8;this.zIndex=options.zIndex||0;this.dialogVisible=false;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUIDialog,CASTORGUI.GUIManager);CASTORGUI.GUIDialog.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var dialog=document.createElement("div");dialog.style.width=this.dialogSize.width+"px";dialog.style.height=this.dialogSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){dialog.style.top=this.convertPixelToPercentHeight(this.dialogPosition.y+this.getCanvasOrigine().top)+"%";dialog.style.left=this.convertPixelToPercentWidth(this.dialogPosition.x+this.getCanvasOrigine().left)+"%";}else{dialog.style.top=(this.dialogPosition.y+this.getCanvasOrigine().top)+signe;dialog.style.left=(this.dialogPosition.x+this.getCanvasOrigine().left)+signe;}dialog.style.position="absolute";dialog.id=this.id;dialog.name=this.id;dialog.className="GUIDialog";dialog.style.zIndex=this.zIndex;dialog.style.background=this.colorDialog;dialog.style.borderRadius=this.radius+"px";dialog.style.backgroundImage="url("+this.imageDialog+")";dialog.style.border=this.borderDialog;dialog.style.display="none";dialog.style.overflow=this.overflow;var eventButton=null;if(append==true){this.html.appendChild(dialog);}else{element.appendChild(dialog);}if(this.buttonDialog=="true"){eventButton=document.createElement("button");eventButton.innerHTML="X";eventButton.id=this.id+"_button";eventButton.style.position="absolute";eventButton.style.borderRadius="12px";eventButton.style.border="2px solid black";eventButton.style.left=this.dialogSize.width-12+signe;eventButton.style.marginTop="-12px";eventButton.style.width="25px";eventButton.style.height="25px";eventButton.style.zIndex=10000;eventButton.onclick=function(){document.body.removeChild(dialog);};this.getElementById(this.id).appendChild(eventButton);}else if(this.imageButtonDialog=="true"){var that=this;this._getSizeImage(this.urlImage,function(result){var sizeImageW=result.w;var sizeImageH=result.h;eventButton=document.createElement("img");eventButton.src=that.urlImage;eventButton.id=that.id+"_button";eventButton.style.position="absolute";eventButton.style.left=that.dialogSize.width-(sizeImageW/2)+signe;eventButton.style.marginTop="-"+(sizeImageH/2)+signe;eventButton.style.width=sizeImageW+signe;eventButton.style.height=sizeImageH+signe;eventButton.style.cursor="pointer";eventButton.style.zIndex=10000;eventButton.onclick=that.callback;that.getElementById(that.id).appendChild(eventButton);});}else if(this.buttonDialog=="false"&&this.imageButtonDialog=="false"&&this.callback){dialog.onclick=this.callback;dialog.style.cursor="pointer";}this.addGuiElements(dialog);};CASTORGUI.GUIDialog.prototype._getSizeImage=function(URL,callback){var image=new Image();image.src=URL;image.onload=function(){var result={w:image.width,h:image.height};callback(result);};};CASTORGUI.GUIDialog.prototype.add=function(element){var contentDialog=this.getElementById(this.id);contentDialog.style.zIndex=this.zIndex+1;element.style.zIndex+2;element.addElement(false,contentDialog);};CASTORGUI.GUIDialog.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIDialog.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.dialogVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.dialogVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIDialog.prototype.isVisible=function(){return this.dialogVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIProgress=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.progress=null;this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.progressPosition={x:options.x,y:options.y};this.progressSize={width:options.w,height:options.h};this.min=options.min||0;this.max=options.max||100;this.value=options.value||0;this.background=options.background||null;this.backgroundValue=options.backgroundValue||null;this.zIndex=options.zIndex||1;this.orient=options.orient||"horizontal";this.progressVisible=true;this.onchangeProgress=callback||"";this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUIProgress,CASTORGUI.GUIManager);CASTORGUI.GUIProgress.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}this.progress=document.createElement("progress");this.progress.min=this.min;this.progress.max=this.max;this.progress.value=this.value;this.progress.style.width=this.progressSize.width+"px";this.progress.style.height=this.progressSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){this.progress.style.top=this.convertPixelToPercentHeight(this.progressPosition.y+this.getCanvasOrigine().top)+"%";this.progress.style.left=this.convertPixelToPercentWidth(this.progressPosition.x+this.getCanvasOrigine().left)+"%";}else{this.progress.style.top=(this.progressPosition.y)+"px";this.progress.style.left=(this.progressPosition.x)+"px";}}else{if(append==true){this.progress.style.top=(this.progressPosition.y+this.getCanvasOrigine().top)+signe;this.progress.style.left=(this.progressPosition.x+this.getCanvasOrigine().left)+signe;}else{this.progress.style.top=(this.progressPosition.y)+signe;this.progress.style.left=(this.progressPosition.x)+signe;}}this.progress.style.position="absolute";this.progress.id=this.id;this.progress.className="GUIProgress";this.progress.tabindex=this.tabindex;this.progress.name=this.id;this.progress.style.zIndex=this.zIndex;if(this.orient=="vertical"||this.orient=="Vertical"){this.progress.style.writingMode="bt-lr";this.progress.style.WebkitAppearance="progress-vertical";}var cssProgress="#"+this.id+" {"+"background-color:"+this.background+";"+"} #"+this.id+"::after {"+"background-color:"+this.backgroundValue+";"+"} #"+this.id+"::-webkit-progress-bar {"+"background-color:"+this.background+";"+"} #"+this.id+"::-webkit-progress-value {"+"background-color:"+this.backgroundValue+";"+"} #"+this.id+"::-moz-progress-bar {"+"background-color:"+this.background+";"+"}";this.addStyle(cssProgress);this.progress.onchange=this.onchangeProgress;if(append==true){this.html.appendChild(this.progress);}else{element.appendChild(this.progress);}this.addGuiElements(this.progress);};CASTORGUI.GUIProgress.prototype.updateValue=function(value){this.progress.value=value;};CASTORGUI.GUIProgress.prototype.getValue=function(){return this.progress.value;};CASTORGUI.GUIProgress.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIProgress.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.progressVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.progressVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIProgress.prototype.isVisible=function(){return this.progressVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUISpinner=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.numberPosition={x:options.x,y:options.y};this.numberSize={width:options.w,height:options.h};this.min=options.min||0;this.max=options.max||100;this.step=options.step||1;this.value=options.value||(this.max/2);this.zIndex=options.zIndex||1;this.orient=options.orient||"horizontal";this.numberVisible=true;this.onchangeNumber=callback||false;this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUISpinner,CASTORGUI.GUIManager);CASTORGUI.GUISpinner.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var number=document.createElement("input");number.type="number";number.min=this.min;number.max=this.max;number.value=this.value;number.step=this.step;number.style.width=this.numberSize.width+signe;number.style.height=this.numberSize.height+signe;if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){number.style.top=this.convertPixelToPercentHeight(this.numberPosition.y+this.getCanvasOrigine().top)+"%";number.style.left=this.convertPixelToPercentWidth(this.numberPosition.x+this.getCanvasOrigine().left)+"%";}else{number.style.top=(this.numberPosition.y)+"px";number.style.left=(this.numberPosition.x)+"px";}}else{if(append==true){number.style.top=(this.numberPosition.y+this.getCanvasOrigine().top)+signe;number.style.left=(this.numberPosition.x+this.getCanvasOrigine().left)+signe;}else{number.style.top=this.numberPosition.y+signe;number.style.left=this.numberPosition.x+signe;}}number.style.position="absolute";number.id=this.id;number.name=this.id;number.className="GUISpinner";number.tabindex=this.tabindex;number.style.zIndex=this.zIndex;number.oninput=this.onchangeNumber;number.onchange=this.onchangeNumber;if(append==true){this.html.appendChild(number);}else{element.appendChild(number);}this.addGuiElements(number);};CASTORGUI.GUISpinner.prototype.getValue=function(){return this.getElementById(this.id).value;};CASTORGUI.GUISpinner.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUISpinner.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.numberVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.numberVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUISpinner.prototype.isVisible=function(){return this.numberVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIMeter=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.meter=nullthis.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.meterPosition={x:options.x,y:options.y};this.meterSize={width:options.w,height:options.h};this.border=options.border||0;this.background=options.background||null;this.backgroundValue=options.backgroundValue||null;this.min=options.min||0;this.max=options.max||100;this.value=options.value||0;this.zIndex=options.zIndex||1;this.orient=options.orient||"horizontal";this.meterVisible=true;this.onchangeMeter=callback||"";this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUIMeter,CASTORGUI.GUIManager);CASTORGUI.GUIMeter.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}this.meter=document.createElement("meter");this.meter.min=this.min;this.meter.max=this.max;this.meter.value=this.value;this.meter.style.width=this.meterSize.width+"px";this.meter.style.height=this.meterSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){this.meter.style.top=this.convertPixelToPercentWidth(this.meterPosition.y+this.getCanvasOrigine().top)+"%";this.meter.style.left=this.convertPixelToPercentHeight(this.meterPosition.x+this.getCanvasOrigine().left)+"%";}else{this.meter.style.top=(this.meterPosition.y)+"px";this.meter.style.left=(this.meterPosition.x)+"px";}}else{if(append==true){this.meter.style.top=(this.meterPosition.y+this.getCanvasOrigine().top)+signe;this.meter.style.left=(this.meterPosition.x+this.getCanvasOrigine().left)+signe;}else{this.meter.style.top=this.meterPosition.y+signe;this.meter.style.left=this.meterPosition.x+signe;}}this.meter.style.position="absolute";this.meter.id=this.id;this.meter.name=this.id;this.meter.className="GUIMeter";this.meter.tabindex=this.tabindex;this.meter.style.zIndex=this.zIndex;if(this.orient=="vertical"||this.orient=="Vertical"){this.meter.style.writingMode="bt-lr";this.meter.style.WebkitAppearance="meter-vertical";}this.meter.onchange=this.onchangeMeter;var cssMeter="#"+this.id+" {"+"border:"+this.border+";"+"border-radius:"+this.borderRadius+";"+"background-color:"+this.background+";"+"} #"+this.id+"::after {"+"border:"+this.border+";"+"border-radius:"+this.borderRadius+";"+"background-color:"+this.backgroundValue+";"+"} #"+this.id+"::-webkit-progress-bar {"+"border:"+this.border+";"+"border-radius:"+this.borderRadius+";"+"background-color:"+this.background+";"+"} #"+this.id+"::-webkit-progress-value {"+"border:"+this.border+";"+"border-radius:"+this.borderRadius+";"+"background-color:"+this.backgroundValue+";"+"} #"+this.id+"::-moz-progress-bar {"+"border:"+this.border+";"+"border-radius:"+this.borderRadius+";"+"background-color:"+this.background+";"+"}";this.addStyle(cssMeter);if(append==true){this.html.appendChild(this.meter);}else{element.appendChild(this.meter);}this.addGuiElements(this.meter);};CASTORGUI.GUIMeter.prototype.updateValue=function(value){this.meter.value=value;};CASTORGUI.GUIMeter.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIMeter.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.meterVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.meterVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIMeter.prototype.isVisible=function(){return this.meterVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIPanel=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.divPosition={x:options.x,y:options.y};this.divSize={width:options.w,height:options.h};this.divVisible=false;this.overflow=options.overflow||"auto";this.borderRadiusDiv=options.borderRadiusPanel||"10px";this.imageDiv=options.backgroundImage||null;this.colorDiv=options.backgroundColor||null;this.borderDiv=options.borderPanel||null;this.position=options.position||"absolute";this.zIndex=options.zIndex||1;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUIPanel,CASTORGUI.GUIManager);CASTORGUI.GUIPanel.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var div=document.createElement("div");if(this.divSize.width>0||this.divSize.height>0){div.style.width=this.divSize.width+"px";div.style.height=this.divSize.height+"px";}if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){if(this.divPosition.x>0){div.style.left=this.convertPixelToPercentWidth(this.divPosition.x+this.getCanvasOrigine().left)+"%";}if(this.divPosition.y>0){div.style.top=this.convertPixelToPercentHeight(this.divPosition.y+this.getCanvasOrigine().top)+"%";}}else{if(this.divPosition.x>0){div.style.marginLeft=this.convertPixelToPercentWidth(this.divPosition.x)+"%";}if(this.divPosition.y>0){div.style.marginTop=this.convertPixelToPercentHeight(this.divPosition.y)+"%";}}}else{if(append==true){if(this.divPosition.x>0){div.style.left=(this.divPosition.x+this.getCanvasOrigine().left)+signe;}if(this.divPosition.y>0){div.style.top=(this.divPosition.y+this.getCanvasOrigine().top)+signe;}}else{if(this.divPosition.x>0){div.style.marginLeft=this.divPosition.x+signe;}if(this.divPosition.y>0){div.style.marginTop=this.divPosition.y+signe;}}}div.id=this.id;div.name=this.id;div.className="GUIPanel";div.style.position=this.position;div.style.overflow=this.overflow;div.style.zIndex=this.zIndex;div.style.backgroundImage="url("+this.imageDiv+")";div.style.backgroundColor=this.colorDiv;div.style.borderRadius=this.borderRadiusDiv;div.style.border=this.borderDiv;div.style.display="none";if(append==true){this.html.appendChild(div);}else{element.appendChild(div);}this.addGuiElements(div);};CASTORGUI.GUIPanel.prototype.add=function(element){var contentPanel=this.getElementById(this.id);contentPanel.style.zIndex=this.zIndex+1;element.addElement(false,contentPanel);};CASTORGUI.GUIPanel.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIPanel.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.divVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.divVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIPanel.prototype.isVisible=function(){return this.divVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIColor=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.colorPosition={x:options.x,y:options.y};this.colorSize={width:options.w,height:options.h};this.value=options.value||"#e30000";this.zIndex=options.zIndex||1;this.colorVisible=true;this.onchangeColor=callback||"";this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUIColor,CASTORGUI.GUIManager);CASTORGUI.GUIColor.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var color=document.createElement("input");color.type="color";color.value=this.value;color.className="GUIColor";color.tabindex=this.tabindex;color.style.width=this.colorSize.width+"px";color.style.height=this.colorSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){color.style.top=this.convertPixelToPercentHeight(this.colorPosition.y+this.getCanvasOrigine().top)+"%";color.style.left=this.convertPixelToPercentWidth(this.colorPosition.x+this.getCanvasOrigine().left)+"%";}else{color.style.top=(this.colorPosition.y)+"px";color.style.left=(this.colorPosition.x)+"px";}}else{if(append==true){color.style.top=(this.colorPosition.y+this.getCanvasOrigine().top)+signe;color.style.left=(this.colorPosition.x+this.getCanvasOrigine().left)+signe;}else{color.style.top=this.colorPosition.y+signe;color.style.left=this.colorPosition.x+signe;}}color.style.position="absolute";color.id=this.id;color.name=this.id;color.style.zIndex=this.zIndex;color.onchange=this.onchangeColor;if((navigator.userAgent.indexOf("MSIE")!=-1)||(navigator.appName=="Netscape")||(!!document.documentMode==true)||navigator.appVersion.indexOf('Edge')>-1||(navigator.appVersion.indexOf('Trident')==-1)){window.nativeColorGUI.init(this.id);}if(append==true){this.html.appendChild(color);}else{element.appendChild(color);}this.addGuiElements(color);};CASTORGUI.GUIColor.prototype.getColor=function(rgb){if(rgb==undefined){rgb=true;hex=false;}else if(rgb==true){rgb=true;hex=false;}else{rgb=false;hex=true;}var valueColor=null;if(rgb==true){valueColor=hexToRgb(this.getElementById(this.id).value);}else if(hex==true){valueColor=this.getElementById(this.id).value;}return valueColor;};CASTORGUI.GUIColor.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIColor.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.colorVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.colorVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIColor.prototype.isVisible=function(){return this.colorVisible;};})();var hexToR=function(h){return parseInt((cutHex(h)).substring(0,2),16)};var hexToG=function(h){return parseInt((cutHex(h)).substring(2,4),16)};var hexToB=function(h){return parseInt((cutHex(h)).substring(4,6),16)};var cutHex=function(h){return(h.charAt(0)=="#")?h.substring(1,7):h};var hexToRgb=function(hex){var c_r=hexToR(hex)/255,c_g=hexToG(hex)/255,c_b=hexToB(hex)/255;return{r:c_r,g:c_g,b:c_b};};var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.DataBase=function(useSessionStorage){if(useSessionStorage==undefined||useSessionStorage==false){this.database=window.localStorage;}else{this.database=window.sessionStorage;}};CASTORGUI.DataBase.prototype.deleteDataBase=function(){this.database.clear();};CASTORGUI.DataBase.prototype.deleteTable=function(table){this.database.removeItem(table);};CASTORGUI.DataBase.prototype.deleteField=function(table,field){var champ=table[field];this.database.removeItem(champ);};CASTORGUI.DataBase.prototype.deleteItemFromField=function(table,field,item){var valeur=table[field][item];this.database.removeItem(item);};CASTORGUI.DataBase.prototype.addTable=function(table){var empty=JSON.stringify({});this.database.setItem(table,empty);};CASTORGUI.DataBase.prototype.createField=function(table,field,value){var data=JSON.stringify(value);var json=eval("({"+field+" : "+data+"})");this.database.setItem(table,JSON.stringify(json));};CASTORGUI.DataBase.prototype.insertItemFromField=function(table,field,item,value){var data=JSON.stringify(value);this.database.setItem(table[field][item],data);};CASTORGUI.DataBase.prototype.selectItem=function(table,field,item){var theTable=$.parseJSON(this.database[table]);return theTable[field][item];};CASTORGUI.DataBase.prototype.selectAllItems=function(table,field){var theTable=$.parseJSON(this.database[table][field]);return theTable;};CASTORGUI.DataBase.prototype.selectAllTable=function(table){var theTable=$.parseJSON(this.database[table]);return theTable;};CASTORGUI.DataBase.prototype.selectAllDataBase=function(){return$.parseJSON(this.database);};CASTORGUI.DataBase.prototype.updateItem=function(table,field,item,value){this.database[table][field][item]=value;};CASTORGUI.DataBase.prototype.getLimit=function(){return this.database.length-1;};CASTORGUI.DataBase.prototype.isSupported=function(){if(typeof localStorage!='undefined'){return true;}else{return false;}};})(); \ No newline at end of file +(function(window){var document=window.document,nativeColorGUI={started:false,color:'#000000',inputs:{},hasNativeColorSupport:false,init:function(inputId){this.start();if(this.hasNativeColorSupport){return;}if(typeof inputId!=='string'){throw'inputId have to be a string id selector';}this.input=(this.inputs[inputId]=this.inputs[inputId])||document.getElementById(inputId);if(!this.input){throw'There was no input found with id:"' + inputId + '"';}this.input.value=this.color;this.input.unselectable='on';this.css(this.input,{backgroundColor:this.color,borderWidth:'0.4em 0.3em',width:'3em',cursor:'default'});this.input.onfocus=function(){nativeColorPicker.onFocus(this.id);};},start:function(){if(this.started){return;}try{this.hasNativeColorSupport=!!(document.createElement('input').type='color');}catch(e){};if(!this.hasNativeColorSupport){var object_element=document.createElement('object');object_element.classid='clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b';object_element.id='colorHelperObj';this.css(object_element,{width:'0',height:'0'});document.body.appendChild(object_element);}this.started=true;},destroy:function(inputId){var i;if(typeof inputId==='string'){this.off(this.inputs[inputId]);}else{document.body.removeChild(document.getElementById('colorHelperObj'));for(i in this.inputs){this.off(this.inputs[i]);}this.started=false;}},off:function(input){input.onfocus=null;this.css(input,{backgroundColor:'',borderWidth:'',width:'',cursor:''});},onFocus:function(inputId){this.input=this.inputs[inputId];this.color=this.getColor();this.input.value=this.color;nativeColorGUI.css(this.input,{backgroundColor:this.color,color:this.color});this.input.blur();},getColor:function(){var hex=colorHelperObj.ChooseColorDlg(this.color.replace(/#/,'')).toString(16);if(hex.length<6){var tmpstr='000000'.substring(0,6-hex.length);hex=tmpstr.concat(hex);}return'#'+hex;},css:function(el,props){for(var prop in props){el.style[prop]=props[prop];}}};window.nativeColorGUI=nativeColorGUI;}(window));var CASTORGUI=CASTORGUI||{};var guiElements=[];var objectCreate=function(proto){function construct(){}construct.prototype=proto;return new construct();};var Extends=function(ChildClass,ParentClass){ChildClass.prototype=Object.create(ParentClass.prototype)||objectCreate(ParentClass.prototype);ChildClass.prototype.constructor=ChildClass;};(function(){CASTORGUI.GUIManager=function(canvas,css,options){this.canvasCss=css;this.canvas=canvas;this.groups=[];this.guiVisible=true;this.GUIstyle=null;this.GUItheme=null;if(options){this.pixel=options.pixel;this.themeRoot=options.themeRoot||"";this.theme=options.themeGUI||"default";}else{this.pixel=true;this.themeRoot="";this.theme="default";}this.head=document.head||document.getElementsByTagName('head')[0]||null;this.html=document.body||document.getElementsByTagName('body')[0];if(this.head==null){this.header=document.createElement('head');this.head.appendChild(this.header);}this.addStyle(this.canvasCss,this.theme);};CASTORGUI.GUIManager.prototype.addGuiElements=function(elem){guiElements.push(elem);};CASTORGUI.GUIManager.convertPixelToPercent=false;CASTORGUI.GUIManager.prototype.convertPixelToPercentWidth=function(pixel){var screenWidth=window.innerWidth;var valueWidth=(pixel/screenWidth)*100;return valueWidth;};CASTORGUI.GUIManager.prototype.convertPixelToPercentHeight=function(pixel){var screenHeight=window.innerHeight;var valueHeight=(pixel/screenHeight)*100;return valueHeight;};CASTORGUI.GUIManager.prototype.addStyle=function(css,theme){if(this.GUIstyle){this.head.removeChild(this.getElementById("styleGUI"));this.canvasCss=this.canvasCss+css;}else{this.canvasCss=this.canvasCss;}this.GUIstyle=document.createElement('style');this.GUIstyle.type='text/css';this.GUIstyle.media='screen';this.GUIstyle.id="styleGUI";if(this.GUIstyle.styleSheet){this.GUIstyle.styleSheet.cssText=this.canvasCss;}else{this.GUIstyle.appendChild(document.createTextNode(this.canvasCss));}this.head.appendChild(this.GUIstyle);if(this.GUItheme){this.head.removeChild(this.getElementById("themeGUI"));}this.GUItheme=document.createElement('link');this.GUItheme.type='text/css';this.GUItheme.rel='stylesheet';this.GUItheme.media='screen';this.GUItheme.id="themeGUI";this.GUItheme.href=this.themeRoot+"themesGUI/"+theme+".css";this.head.appendChild(this.GUItheme);};CASTORGUI.GUIManager.prototype.fadeOut=function(el){if(el){el.style.opacity=1;(function fade_moin(){if((el.style.opacity-=0.1)<0.1){el.style.display="none";el.style.opacity=0;}else if(el.style.opacity>0){requestAnimationFrame(fade_moin);}})();}};CASTORGUI.GUIManager.prototype.fadeIn=function(el){if(el){el.style.opacity=0;el.style.display="block";(function fade_plus(){var val=parseFloat(el.style.opacity);if(!((val+=0.1)>0.9)){el.style.opacity=1;requestAnimationFrame(fade_plus);}})();}};CASTORGUI.GUIManager.prototype.getElementById=function(id){return document.getElementById(id);};CASTORGUI.GUIManager.prototype.getCanvasOrigine=function(){var offsets=this.canvas.getBoundingClientRect(),offsetsTop=offsets.top||0,offsetsLeft=offsets.left||0;return{top:offsetsTop,left:offsetsLeft};};CASTORGUI.GUIManager.prototype.getCanvasSize=function(){var offsets=this.canvas.getBoundingClientRect(),offsetsWidth=offsets.width||0,offsetsHeight=offsets.height||0;return{width:offsetsWidth,height:offsetsHeight};};CASTORGUI.GUIManager.prototype.dispose=function(){var that=this;guiElements.forEach(function(e){if(that.getElementById(e.id)){that.html.removeChild(that.getElementById(e.id));}});return;};CASTORGUI.GUIManager.prototype.setVisible=function(bool,fade){var display;var that=this;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.guiVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.guiVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){guiElements.forEach(function(e){that.getElementById(e.id).style.display=display;});}};CASTORGUI.GUIManager.prototype.isVisible=function(){return this.guiVisible;};})();var CASTORGUI=CASTORGUI||{};!(function(moduleName,definition){if(typeof define==='function'&&typeof define.amd==='object'){define(definition);}else{this[moduleName]=definition();}})('draggable',function definition(){var currentElement,fairlyHighZIndex='10';CASTORGUI.addEventListener=function(element,eventName,handler){if(element.addEventListener){element.addEventListener(eventName,handler,false);}else if(element.attachEvent){element.attachEvent('on'+eventName,handler);}else{element['on'+eventName]=handler;}};CASTORGUI.removeEventListener=function(element,eventName,handler){if(element.removeEventListener){element.removeEventListener(eventName,handler,false);}else if(element.detachEvent){element.detachEvent('on'+eventName,handler);}else{element['on'+eventName]=null;}};CASTORGUI.draggable=function(element,handle){handle=handle||element;CASTORGUI.setPositionType(element);CASTORGUI.setDraggableListeners(element);CASTORGUI.addEventListener(handle,'mousedown',function(event){CASTORGUI.startDragging(event,element);});};CASTORGUI.setPositionType=function(element){element.style.position='absolute';};CASTORGUI.setDraggableListeners=function(element){element.draggableListeners={start:[],drag:[],stop:[]};element.whenDragStarts=CASTORGUI.addListener(element,'start');element.whenDragging=CASTORGUI.addListener(element,'drag');element.whenDragStops=CASTORGUI.addListener(element,'stop');};CASTORGUI.startDragging=function(event,element){currentElement&&CASTORGUI.sendToBack(currentElement);currentElement=CASTORGUI.bringToFront(element);var initialPosition=CASTORGUI.getInitialPosition(currentElement);currentElement.style.left=CASTORGUI.inPixels(initialPosition.left);currentElement.style.top=CASTORGUI.inPixels(initialPosition.top);currentElement.lastXPosition=event.clientX;currentElement.lastYPosition=event.clientY;var okToGoOn=CASTORGUI.triggerEvent('start',{x:initialPosition.left,y:initialPosition.top,mouseEvent:event});if(!okToGoOn){return;}CASTORGUI.addDocumentListeners();};CASTORGUI.addListener=function(element,type){return function(listener){element.draggableListeners[type].push(listener);};};CASTORGUI.triggerEvent=function(type,args){var result=true;var listeners=currentElement.draggableListeners[type];for(var i=listeners.length-1;i>=0;i--){if(listeners[i](args)===false){result=false;}};return result;};CASTORGUI.sendToBack=function(element){var decreasedZIndex=fairlyHighZIndex-1;element.style['z-index']=decreasedZIndex;element.style['zIndex']=decreasedZIndex;};CASTORGUI.bringToFront=function(element){element.style['z-index']=fairlyHighZIndex;element.style['zIndex']=fairlyHighZIndex;return element;};CASTORGUI.addDocumentListeners=function(){CASTORGUI.addEventListener(document,'selectstart',CASTORGUI.cancelDocumentSelection);CASTORGUI.addEventListener(document,'mousemove',CASTORGUI.repositionElement);CASTORGUI.addEventListener(document,'mouseup',CASTORGUI.removeDocumentListeners);CASTORGUI.addEventListener(document,"touchstart",CASTORGUI.cancelDocumentSelection);CASTORGUI.addEventListener(document,"touchmove",CASTORGUI.repositionElement);CASTORGUI.addEventListener(document,"touchend",CASTORGUI.removeDocumentListeners);CASTORGUI.addEventListener(document,"touchcancel",CASTORGUI.removeDocumentListeners);};CASTORGUI.getInitialPosition=function(element){var boundingClientRect=element.getBoundingClientRect();return{top:boundingClientRect.top,left:boundingClientRect.left};};CASTORGUI.inPixels=function(value){return value+'px';};CASTORGUI.cancelDocumentSelection=function(event){event.preventDefault&&event.preventDefault();event.stopPropagation&&event.stopPropagation();event.returnValue=false;return false;};CASTORGUI.repositionElement=function(event){event.preventDefault&&event.preventDefault();event.returnValue=false;var style=currentElement.style;var elementXPosition=parseInt(style.left,10);var elementYPosition=parseInt(style.top,10);var elementNewXPosition=elementXPosition+(event.clientX-currentElement.lastXPosition);var elementNewYPosition=elementYPosition+(event.clientY-currentElement.lastYPosition);style.left=CASTORGUI.inPixels(elementNewXPosition);style.top=CASTORGUI.inPixels(elementNewYPosition);currentElement.lastXPosition=event.clientX;currentElement.lastYPosition=event.clientY;CASTORGUI.triggerEvent('drag',{x:elementNewXPosition,y:elementNewYPosition,mouseEvent:event});};CASTORGUI.removeDocumentListeners=function(event){CASTORGUI.removeEventListener(document,'selectstart',CASTORGUI.cancelDocumentSelection);CASTORGUI.removeEventListener(document,'mousemove',CASTORGUI.repositionElement);CASTORGUI.removeEventListener(document,'mouseup',CASTORGUI.removeDocumentListeners);CASTORGUI.removeEventListener(document,"touchstart",CASTORGUI.cancelDocumentSelection);CASTORGUI.removeEventListener(document,"touchmove",CASTORGUI.repositionElement);CASTORGUI.removeEventListener(document,"touchend",CASTORGUI.removeDocumentListeners);CASTORGUI.removeEventListener(document,"touchcancel",CASTORGUI.removeDocumentListeners);var left=parseInt(currentElement.style.left,10);var top=parseInt(currentElement.style.top,10);CASTORGUI.triggerEvent('stop',{x:left,y:top,mouseEvent:event});};return CASTORGUI.draggable;});var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIWindow=function(id,options,guimanager){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.windowPosition={x:options.x,y:options.y};this.windowSize={width:options.w,height:options.h};this.colorWindow=options.backgroundColor||null;this.imageWindow=options.backgroundImage||null;this.colorContent=options.colorContent||null;this.imageContent=options.imageContent;this.buttonClose=typeof options.closeButton;this.overflow=options.overflow||"auto";this.borderWindow=options.borderWindow||null;this.borderTitle=options.borderTitle||null;this.heightTitle=options.heightTitle||30;this.fontSize=options.titleFontSize||12;this.radiusWindow=options.radiusWindow||8;this.colorTitle=options.colorTitle||"rgba(0, 0, 0, 0.4)";this.imageTitle=options.imageTitle||null;this.textAlign=options.titleTextAlign||"center";this.colorTextTitle=options.titleColor||null;this.title=options.textTitle||"Title";if(options.draggable==true||options.draggable==undefined){this.draggable=true;}else{this.draggable=false;}this.zIndex=options.zIndex||0;this.windowVisible=false;this.addElement();};Extends(CASTORGUI.GUIWindow,CASTORGUI.GUIManager);CASTORGUI.GUIWindow.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var window=document.createElement("div");window.style.position="absolute";window.style.width=this.windowSize.width+"px";window.style.height=this.windowSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){window.style.top=this.convertPixelToPercentHeight(this.windowPosition.y+this.getCanvasOrigine().top)+"%";window.style.left=this.convertPixelToPercentWidth(this.windowPosition.x+this.getCanvasOrigine().left)+"%";}else{window.style.top=(this.windowPosition.y+this.getCanvasOrigine().top)+signe;window.style.left=(this.windowPosition.x+this.getCanvasOrigine().left)+signe;}window.style.borderRadius=this.radiusWindow+"px";window.id=this.id;window.name=this.id;window.className="GUIWindow";window.style.zIndex=this.zIndex||0;window.style.backgroundColor=this.colorWindow;window.style.backgroundImage="url("+this.imageWindow+")";window.style.border=this.borderWindow;window.style.wordWrap="break-word";window.style.display="none";var titreWindow=document.createElement("div");titreWindow.className="titleWindoWGUI";titreWindow.style.width=this.windowSize.width+"px";titreWindow.style.height=this.heightTitle+"px";titreWindow.style.textAlign=this.textAlign;titreWindow.style.fontSize=this.fontSize+"px";titreWindow.style.borderRadius=this.radiusWindow+"px "+this.radiusWindow+"px 0 0";titreWindow.id=this.id+"_titre";titreWindow.style.backgroundColor=this.colorTitle;titreWindow.style.backgroundImage="url("+this.imageTitle+")";titreWindow.style.borderBottom=this.borderTitle;if(this.draggable==true){titreWindow.ondragstart=CASTORGUI.draggable(window,titreWindow);titreWindow.style.cursor="move";}titreWindow.innerHTML=this.title;titreWindow.style.zIndex=this.zIndex+1;titreWindow.style.color=this.colorTextTitle;titreWindow.style.wordWrap="break-word";var that=this;if(this.buttonClose==true||this.buttonClose=="undefined"){var close=document.createElement("button");close.innerHTML="X";close.id=this.id+"_button";close.style.position="absolute";close.style.borderRadius="12px";close.style.left=this.windowSize.width-12+"px";close.style.marginTop="-12px";close.style.width="24px";close.style.height="24px";close.style.zIndex=10000;close.onclick=function(){that.getElementById(that.id).style.display="none";that.windowVisible=false;};}var contentWindow=document.createElement("div");contentWindow.id=this.id+"_content";contentWindow.style.width=this.windowSize.width+"px";contentWindow.style.height=this.windowSize.height-38+"px";contentWindow.style.overflow=this.overflow;contentWindow.style.wordBreak="keep-all";contentWindow.style.marginTop="0px";contentWindow.style.paddingTop="5px";contentWindow.style.borderRadius="8px";contentWindow.style.backgroundColor=this.colorContent;contentWindow.style.backgroundImage="url("+this.imageContent+")";contentWindow.style.zIndex=this.zIndex+2;this.html.appendChild(window);this.getElementById(this.id).appendChild(titreWindow);if(this.buttonClose==true||this.buttonClose=="undefined"){this.getElementById(this.id+"_titre").appendChild(close);}this.getElementById(this.id).appendChild(contentWindow);this.addGuiElements(window);};CASTORGUI.GUIWindow.prototype.add=function(element){var contentForm=this.getElementById(this.id+"_content");contentForm.style.zIndex=this.zIndex+1;element.addElement(false,contentForm);};CASTORGUI.GUIWindow.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIWindow.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.windowVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.windowVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIWindow.prototype.isVisible=function(){return this.windowVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUITexture=function(id,imageUrl,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.imageUrl=imageUrl;this.textureClicked=callback||false;this.imageSize={width:options.w,height:options.h};this.imagePosition={x:options.x,y:options.y};this.imageVisible=true;this.zIndex=options.zIndex||1;this.html=document.body||document.getElementsByTagName('body')[0];if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUITexture,CASTORGUI.GUIManager);CASTORGUI.GUITexture.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var img=document.createElement("img");img.src=this.imageUrl;img.style.width=this.imageSize.width+"px";img.style.height=this.imageSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){img.style.top=this.convertPixelToPercentHeight(this.imagePosition.y+this.getCanvasOrigine().top)+"%";img.style.left=this.convertPixelToPercentWidth(this.imagePosition.x+this.getCanvasOrigine().left)+"%";}else{img.style.top=(this.imagePosition.y)+"px";img.style.left=(this.imagePosition.x)+"px";}}else{if(append==true){img.style.top=(this.imagePosition.y+this.getCanvasOrigine().top)+signe;img.style.left=(this.imagePosition.x+this.getCanvasOrigine().left)+signe;}else{img.style.top=this.imagePosition.y+signe;img.style.left=this.imagePosition.x+signe;}}img.style.position="absolute";img.style.zIndex=this.zIndex;img.id=this.id;img.name=this.id;img.className="GUITexture";if(this.textureClicked){var that=this;img.addEventListener('click',that.textureClicked,false);}if(append==true){this.html.appendChild(img);}else{element.appendChild(img);}this.addGuiElements(img);};CASTORGUI.GUITexture.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUITexture.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.imageVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.imageVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUITexture.prototype.isVisible=function(){return this.imageVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUITextfield=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.textfieldPosition={x:options.x,y:options.y};this.textfieldSize={width:options.w,height:options.h};this.value=options.value||"";this.background=options.background||null;this.border=options.border||null;this.color=options.color||null;this.placeholder=options.placeholder||"";this.zIndex=options.zIndex||2;this.textfieldVisible=true;this.onchangeTextfield=callback||"";this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUITextfield,CASTORGUI.GUIManager);CASTORGUI.GUITextfield.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var textfield=document.createElement("input");textfield.type="text";textfield.style.width=this.textfieldSize.width+"px";textfield.style.height=this.textfieldSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){textfield.style.top=this.convertPixelToPercentHeight(this.textfieldPosition.y+this.getCanvasOrigine().top)+"%";textfield.style.left=this.convertPixelToPercentWidth(this.textfieldPosition.x+this.getCanvasOrigine().left)+"%";}else{textfield.style.top=(this.textfieldPosition.y)+"px";textfield.style.left=(this.textfieldPosition.x)+"px";}}else{if(append==true){textfield.style.top=(this.textfieldPosition.y+this.getCanvasOrigine().top)+signe;textfield.style.left=(this.textfieldPosition.x+this.getCanvasOrigine().left)+signe;}else{textfield.style.top=this.textfieldPosition.y+signe;textfield.style.left=this.textfieldPosition.x+signe;}}textfield.style.position="absolute";textfield.style.display="block";textfield.id=this.id;textfield.name=this.id;textfield.className="GUITextfield";textfield.tabindex=this.tabindex;textfield.value=this.value;textfield.placeholder=this.placeholder;textfield.style.zIndex=this.zIndex;if(this.background!=null){textfield.style.background=this.background;}textfield.style.border=this.border;if(this.color!=null){textfield.style.color=this.color;}textfield.onchange=this.onchangeTextfield;if(append==true){this.html.appendChild(textfield);}else{element.appendChild(textfield);}this.addGuiElements(textfield);};CASTORGUI.GUITextfield.prototype.getValue=function(){return this.getElementById(this.id).value;};CASTORGUI.GUITextfield.prototype.setValue=function(val){this.value=val;this.getElementById(this.id).value=val;};CASTORGUI.GUITextfield.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUITextfield.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.textfieldVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.textfieldVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUITextfield.prototype.isVisible=function(){return this.textfieldVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUITextarea=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.textareaPosition={x:options.x,y:options.y};this.textareaSize={width:options.w,height:options.h};this.value=options.value||"";this.placeholder=options.placeholder||"";this.background=options.background||null;this.color=options.color||null;this.zIndex=options.zIndex||2;this.textareaVisible=true;this.onchangeTextarea=callback||"";this.tabindex=options.tabindex||0;this.append=append;if(this.append==true){this.addElement(this.append);}};Extends(CASTORGUI.GUITextarea,CASTORGUI.GUIManager);CASTORGUI.GUITextarea.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var textarea=document.createElement("textarea");textarea.cols=this.textareaSize.width;textarea.rows=this.textareaSize.height;if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){textarea.style.top=this.convertPixelToPercentHeight(this.textareaPosition.y+this.getCanvasOrigine().top)+"%";textarea.style.left=this.convertPixelToPercentWidth(this.textareaPosition.x+this.getCanvasOrigine().left)+"%";}else{textarea.style.top=(this.textareaPosition.y)+"px";textarea.style.left=(this.textareaPosition.x)+"ox";}}else{if(append==true){textarea.style.top=(this.textareaPosition.y+this.getCanvasOrigine().top)+signe;textarea.style.left=(this.textareaPosition.x+this.getCanvasOrigine().left)+signe;}else{textarea.style.top=this.textareaPosition.y+signe;textarea.style.left=this.textareaPosition.x+signe;}}textarea.style.position="absolute";textarea.style.display="block";textarea.placeholder=this.placeholder;textarea.id=this.id;textarea.name=this.id;textarea.className="GUITextarea";textarea.tabindex=this.tabindex;textarea.innerHTML=this.value;textarea.style.zIndex=this.zIndex;if(this.background!=null){textarea.style.background=this.background;}if(this.color!=null){textarea.style.color=this.color;}textarea.onchange=this.onchangeTextarea;if(append==true){this.html.appendChild(textarea);}else{element.appendChild(textarea);}this.addGuiElements(textarea);};CASTORGUI.GUITextarea.prototype.getValue=function(){return this.getElementById(this.id).value;};CASTORGUI.GUITextarea.prototype.setValue=function(val){this.value=val;this.getElementById(this.id).value=val;};CASTORGUI.GUITextarea.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUITextarea.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.textareaVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.textareaVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUITextarea.prototype.isVisible=function(){return this.textareaVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIText=function(id,options,guimanager,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);this.append=append;if(append==null||append==undefined){this.append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.textPosition={x:options.x,y:options.y};this.textSize=options.size||30;this.color=options.color||null;this.background=options.background||null;this.police=options.police||null;this.texte=options.text||"CastorGUI";this.zIndex=options.zIndex||1;this.bold=options.bold||null;this.italic=options.italic||null;this.position=options.position||"absolute";this.centerVertical=options.centerVertical||false;this.centerHorizontal=options.centerHorizontal||false;this.inline=options.inline||false;this.textVisible=true;this.textElement=null;this.font=null;if(this.append==true){this.addElement(this.append);}};Extends(CASTORGUI.GUIText,CASTORGUI.GUIManager);CASTORGUI.GUIText.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}this.font=this.textSize+"px "+this.police;this.textElement=document.createElement("span");if(this.inline==false){this.textElement.style.width="auto";}else{this.textElement.style.width=CASTORGUI.GUIText.getTextWidth(this.texte,this.font).w+"px";}this.textElement.style.height=CASTORGUI.GUIText.getTextWidth(this.texte,this.font).h+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){this.textElement.style.top=this.convertPixelToPercentHeight(this.textPosition.y+this.getCanvasOrigine().top)+"%";this.textElement.style.left=this.convertPixelToPercentWidth(this.textPosition.x+this.getCanvasOrigine().left)+"%";}else{this.textElement.style.top=(this.textPosition.y)+"px";this.textElement.style.left=(this.textPosition.x)+"px";}}else{if(append==true){this.textElement.style.top=(this.textPosition.y+this.getCanvasOrigine().top)+signe;this.textElement.style.left=(this.textPosition.x+this.getCanvasOrigine().left)+signe;}else{this.textElement.style.top=this.textPosition.y+signe;this.textElement.style.left=this.textPosition.x+signe;}}this.textElement.style.display="block";this.textElement.style.position=this.position;this.textElement.style.font=this.font;this.textElement.style.color=this.color;this.textElement.style.background=this.background;this.textElement.style.fontStyle=this.italic;this.textElement.style.fontWeight=this.bold;this.textElement.innerHTML=this.texte;this.textElement.id=this.id;this.textElement.name=this.id;this.textElement.className="GUIText";this.textElement.style.zIndex=this.zIndex;if(append==true){if(this.centerVertical){var marginTop=((this.getCanvasSize().height/2)-(CASTORGUI.GUIText.getTextWidth(this.texte,this.font).h/2));this.textElement.style.top=(marginTop+this.getCanvasOrigine().top)+signe;}if(this.centerHorizontal){var marginTotal=(this.getCanvasSize().width-CASTORGUI.GUIText.getTextWidth(this.texte,this.font).w);var marginLeft=(marginTotal/2);this.textElement.style.left=(marginLeft+this.getCanvasOrigine().left)+signe;}this.html.appendChild(this.textElement);}else{if(this.centerVertical){this.textElement.style.top="calc(50% - "+(CASTORGUI.GUIText.getTextWidth(this.texte,this.font).h/2)+"px)";}if(this.centerHorizontal=="true"){this.textElement.style.width="100%";this.textElement.style.textAlign="center";}element.appendChild(this.textElement);}this.addGuiElements(this.textElement);};CASTORGUI.GUIText.prototype.updateText=function(texte){var signe="";if(this.pixel){signe="px";}else{signe="%";}if(this.append==true){this.textElement.style.width=CASTORGUI.GUIText.getTextWidth(texte,this.font).w+signe;this.textElement.style.height=CASTORGUI.GUIText.getTextWidth(texte,this.font).h+signe;this.textElement.style.top=(this.textPosition.y+this.getCanvasOrigine().top)+signe;this.textElement.style.left=(this.textPosition.x+this.getCanvasOrigine().left)+signe;}else{this.textElement.style.top=this.textPosition.y+signe;this.textElement.style.left=this.textPosition.x+signe;}if(this.centerVertical=="true"){var marginTop=((this.getCanvasSize().height/2)-(CASTORGUI.GUIText.getTextWidth(texte,this.font).h/2));this.textElement.style.top=(marginTop+this.getCanvasOrigine().top)+signe;}if(this.centerHorizontal=="true"){var marginTotal=(this.getCanvasSize().width-CASTORGUI.GUIText.getTextWidth(texte,this.font).w);var marginLeft=(marginTotal/2);this.textElement.style.left=(marginLeft+this.getCanvasOrigine().left)+signe;}this.textElement.innerHTML=texte;};CASTORGUI.GUIText.getTextWidth=function(texte,font){var tag=document.createElement("div");tag.style.position="absolute";tag.style.left="-999em";tag.style.display="block";tag.style.whiteSpace="nowrap";tag.style.font=font||this.textSize+"px "+this.police;tag.innerHTML=texte;document.body.appendChild(tag);var result={w:tag.clientWidth+10,h:tag.clientHeight};document.body.removeChild(tag);return result;};CASTORGUI.GUIText.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIText.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.textVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.textVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIText.prototype.isVisible=function(){return this.textVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUITextLink=function(id,options,guimanager,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);this.append=append;if(append==null||append==undefined){this.append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.textPosition={x:options.x,y:options.y};this.textSize=options.size||30;this.color=options.color||null;this.background=options.background||null;this.police=options.police||null;this.texte=options.text||"google.com";this.zIndex=options.zIndex||1;this.bold=options.bold||null;this.italic=options.italic||null;this.position=options.position||"absolute";this.centerVertical=options.centerVertical||false;this.centerHorizontal=options.centerHorizontal||false;this.inline=options.inline||false;this.textVisible=true;this.textElement=null;this.font=null;this.href=options.href||"https:\/\/www.google.com";if(this.append==true){this.addElement(this.append);}};Extends(CASTORGUI.GUITextLink,CASTORGUI.GUIManager);CASTORGUI.GUITextLink.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}this.font=this.textSize+"px "+this.police;this.textElement=document.createElement("a");if(this.inline==false){this.textElement.style.width="auto";}else{this.textElement.style.width=CASTORGUI.GUITextLink.getTextWidth(this.texte,this.font).w+"px";}this.textElement.style.height=CASTORGUI.GUITextLink.getTextWidth(this.texte,this.font).h+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){this.textElement.style.top=this.convertPixelToPercentHeight(this.textPosition.y+this.getCanvasOrigine().top)+"%";this.textElement.style.left=this.convertPixelToPercentWidth(this.textPosition.x+this.getCanvasOrigine().left)+"%";}else{this.textElement.style.top=(this.textPosition.y)+"px";this.textElement.style.left=(this.textPosition.x)+"px";}}else{if(append==true){this.textElement.style.top=(this.textPosition.y+this.getCanvasOrigine().top)+signe;this.textElement.style.left=(this.textPosition.x+this.getCanvasOrigine().left)+signe;}else{this.textElement.style.top=this.textPosition.y+signe;this.textElement.style.left=this.textPosition.x+signe;}}this.textElement.style.display="block";this.textElement.style.position=this.position;this.textElement.style.font=this.font;this.textElement.style.color=this.color;this.textElement.style.background=this.background;this.textElement.style.fontStyle=this.italic;this.textElement.style.fontWeight=this.bold;this.textElement.innerHTML=this.texte;this.textElement.id=this.id;this.textElement.name=this.id;this.textElement.className="GUITextLink";this.textElement.style.zIndex=this.zIndex;this.textElement.setAttribute('href',this.href);if(append==true){if(this.centerVertical){var marginTop=((this.getCanvasSize().height/2)-(CASTORGUI.GUITextLink.getTextWidth(this.texte,this.font).h/2));this.textElement.style.top=(marginTop+this.getCanvasOrigine().top)+signe;}if(this.centerHorizontal){var marginTotal=(this.getCanvasSize().width-CASTORGUI.GUITextLink.getTextWidth(this.texte,this.font).w);var marginLeft=(marginTotal/2);this.textElement.style.left=(marginLeft+this.getCanvasOrigine().left)+signe;}this.html.appendChild(this.textElement);}else{if(this.centerVertical){this.textElement.style.top="calc(50% - "+(CASTORGUI.GUITextLink.getTextWidth(this.texte,this.font).h/2)+"px)";}if(this.centerHorizontal=="true"){this.textElement.style.width="100%";this.textElement.style.textAlign="center";}element.appendChild(this.textElement);}this.addGuiElements(this.textElement);};CASTORGUI.GUITextLink.prototype.updateText=function(texte){var signe="";if(this.pixel){signe="px";}else{signe="%";}if(this.append==true){this.textElement.style.width=CASTORGUI.GUITextLink.getTextWidth(texte,this.font).w+signe;this.textElement.style.height=CASTORGUI.GUITextLink.getTextWidth(texte,this.font).h+signe;this.textElement.style.top=(this.textPosition.y+this.getCanvasOrigine().top)+signe;this.textElement.style.left=(this.textPosition.x+this.getCanvasOrigine().left)+signe;}else{this.textElement.style.top=this.textPosition.y+signe;this.textElement.style.left=this.textPosition.x+signe;}if(this.centerVertical=="true"){var marginTop=((this.getCanvasSize().height/2)-(CASTORGUI.GUITextLink.getTextWidth(texte,this.font).h/2));this.textElement.style.top=(marginTop+this.getCanvasOrigine().top)+signe;}if(this.centerHorizontal=="true"){var marginTotal=(this.getCanvasSize().width-CASTORGUI.GUITextLink.getTextWidth(texte,this.font).w);var marginLeft=(marginTotal/2);this.textElement.style.left=(marginLeft+this.getCanvasOrigine().left)+signe;}this.textElement.innerHTML=texte;};CASTORGUI.GUITextLink.getTextWidth=function(texte,font){var tag=document.createElement("div");tag.style.position="absolute";tag.style.left="-999em";tag.style.display="block";tag.style.whiteSpace="nowrap";tag.style.font=font||this.textSize+"px "+this.police;tag.innerHTML=texte;document.body.appendChild(tag);var result={w:tag.clientWidth+10,h:tag.clientHeight};document.body.removeChild(tag);return result;};CASTORGUI.GUITextLink.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUITextLink.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.textVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.textVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUITextLink.prototype.isVisible=function(){return this.textVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUISlider=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.sliderPosition={x:options.x,y:options.y};this.sliderSize={width:options.w,height:options.h};this.min=options.min||0;this.max=options.max||100;this.step=options.step||1;this.value=options.value||(this.max/2);this.zIndex=options.zIndex||1;this.orient=options.orient||"horizontal";this.sliderVisible=true;this.onchangeSlider=callback||false;this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUISlider,CASTORGUI.GUIManager);CASTORGUI.GUISlider.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var slider=document.createElement("input");slider.type="range";slider.min=this.min;slider.max=this.max;slider.value=this.value;slider.step=this.step;slider.className="GUISlider";slider.tabindex=this.tabindex;slider.style.width=this.sliderSize.width+"px";slider.style.height=this.sliderSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){slider.style.top=this.convertPixelToPercentHeight(this.sliderPosition.y+this.getCanvasOrigine().top)+"%";slider.style.left=this.convertPixelToPercentWidth(this.sliderPosition.x+this.getCanvasOrigine().left)+"%";}else{slider.style.top=(this.sliderPosition.y)+"px";slider.style.left=(this.sliderPosition.x)+"px";}}else{if(append==true){slider.style.top=(this.sliderPosition.y+this.getCanvasOrigine().top)+signe;slider.style.left=(this.sliderPosition.x+this.getCanvasOrigine().left)+signe;}else{slider.style.top=this.sliderPosition.y+signe;slider.style.left=this.sliderPosition.x+signe;}}slider.style.position="absolute";slider.id=this.id;slider.name=this.id;slider.style.zIndex=this.zIndex;if(this.orient=="vertical"||this.orient=="Vertical"){slider.style.writingMode="bt-lr";slider.style.WebkitAppearance="slider-vertical";}slider.oninput=this.onchangeSlider;slider.onchange=this.onchangeSlider;if(append==true){this.html.appendChild(slider);}else{element.appendChild(slider);}this.addGuiElements(slider);};CASTORGUI.GUISlider.prototype.getValue=function(){return this.getElementById(this.id).value;};CASTORGUI.GUISlider.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUISlider.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.sliderVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.sliderVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUISlider.prototype.isVisible=function(){return this.sliderVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUISelect=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.selectPosition={x:options.x,y:options.y};this.selectSize={width:options.w,height:options.h};this.zIndex=options.zIndex||1;this.selectVisible=true;this.onchangeSelectoptions=callback||false;this.tabindex=options.tabindex||0;this.optionsListe=[];this.append=append;if(this.append==true){this.addElement(this.append);}};Extends(CASTORGUI.GUISelect,CASTORGUI.GUIManager);CASTORGUI.GUISelect.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var that=this;var select=document.createElement("select");select.style.width=this.selectSize.width+"px";select.style.height=this.selectSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){select.style.top=this.convertPixelToPercentHeight(this.selectPosition.y+this.getCanvasOrigine().top)+"%";select.style.left=this.convertPixelToPercentWidth(this.selectPosition.x+this.getCanvasOrigine().left)+"%";}else{select.style.top=(this.selectPosition.y)+"px";select.style.left=(this.selectPosition.x)+"px";}}else{if(append==true){select.style.top=(this.selectPosition.y+this.getCanvasOrigine().top)+signe;select.style.left=(this.selectPosition.x+this.getCanvasOrigine().left)+signe;}else{select.style.top=this.selectPosition.y+signe;select.style.left=this.selectPosition.x+signe;}}select.style.position="absolute";select.id=this.id;select.name=this.id;select.className="GUISelect";select.tabindex=this.tabindex;select.style.zIndex=this.zIndex;select.onchange=this.onchangeSelectoptions;if(append==true){this.html.appendChild(select);}else{element.appendChild(select);this.optionsListe.forEach(function(options){that.getElementById(that.id).appendChild(options);});}this.addGuiElements(select);};CASTORGUI.GUISelect.prototype.addOptions=function(value,text){var options=document.createElement("option");options.value=value;options.innerHTML=text;if(this.append==false){this.optionsListe.push(options);}else{this.getElementById(this.id).appendChild(options);}};CASTORGUI.GUISelect.prototype.findOptionSelected=function(withIndex){if(withIndex==undefined)withIndex=false;var elSel=this.getElementById(this.id);var str=elSel.options[elSel.selectedIndex].text;if(withIndex==true){return elSel.selectedIndex;}else{return str;}};CASTORGUI.GUISelect.prototype.removeOption=function(value){var elSel=this.getElementById(this.id);for(var i=0;i<=elSel.length-1;i++){if(elSel.options[i].text==value){elSel.remove(i);break;}}if(this.append==false){for(var b in arr){if(arr[b]==value){arr.splice(b,1);break;}}}return;};CASTORGUI.GUISelect.prototype.changeItem=function(oldValue,newValue){var elSel=this.getElementById(this.id);for(var i=0;i<=elSel.length-1;i++){if(elSel.options[i].text==oldValue){elSel.options[i].text=newValue;elSel.options[i].value=newValue;break;}}return;};CASTORGUI.GUISelect.prototype.selectedItem=function(item){var elSel=this.getElementById(this.id);for(var i=0;i<=elSel.length-1;i++){if(elSel.options[i].text==item){elSel.options[i].setAttribute('selected',true);}else{elSel.options[i].removeAttribute('selected');}}return;};CASTORGUI.GUISelect.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUISelect.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.selectVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.selectVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUISelect.prototype.isVisible=function(){return this.selectVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIRadio=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.name=options.name||"NameRadio"+id;this.html=document.body||document.getElementsByTagName('body')[0];this.radioPosition={x:options.x,y:options.y};this.radioSize=options.size||1.0;this.zIndex=options.zIndex||1;this.radioVisible=true;this.onClickRadio=callback||false;this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUIRadio,CASTORGUI.GUIManager);CASTORGUI.GUIRadio.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var radio=document.createElement("input");radio.type="radio";radio.style.width=(this.radioSize*16)+"px";radio.style.height=(this.radioSize*16)+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){radio.style.top=this.convertPixelToPercentHeight(this.radioPosition.y+this.getCanvasOrigine().top)+"%";radio.style.left=this.convertPixelToPercentWidth(this.radioPosition.x+this.getCanvasOrigine().left)+"%";}else{radio.style.top=(this.radioPosition.y)+"px";radio.style.left=(this.radioPosition.x)+"px";}}else{if(append==true){radio.style.top=(this.radioPosition.y+this.getCanvasOrigine().top)+signe;radio.style.left=(this.radioPosition.x+this.getCanvasOrigine().left)+signe;}else{radio.style.top=this.radioPosition.y+signe;radio.style.left=this.radioPosition.x+signe;}}radio.style.position="absolute";radio.style.padding="0px";radio.style.margin="0px";radio.id=this.id;radio.tabindex=this.tabindex;radio.className="GUIRadio";radio.name=this.name;radio.style.zIndex=this.zIndex;radio.onclick=this.onClickRadio;if(append==true){this.html.appendChild(radio);}else{element.appendChild(radio);}this.addGuiElements(radio);};CASTORGUI.GUIRadio.prototype.isChecked=function(){if(this.getElementById(this.id).checked){return true;}else{return false;}};CASTORGUI.GUIRadio.prototype.setChecked=function(value){this.getElementById(this.id).checked=value;};CASTORGUI.GUIRadio.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIRadio.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.radioVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.radioVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIRadio.prototype.isVisible=function(){return this.radioVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUILabel=function(id,options,guimanager,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.labelPosition={x:options.x,y:options.y};this.labelSize={width:options.w,height:options.h};this.textLabel=options.text;this.zIndex=options.zIndex||1;this.labelVisible=true;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUILabel,CASTORGUI.GUIManager);CASTORGUI.GUILabel.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var label=document.createElement("label");if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){label.style.top=this.convertPixelToPercentHeight(this.labelPosition.y+this.getCanvasOrigine().top)+"%";label.style.left=this.convertPixelToPercentWidth(this.labelPosition.x+this.getCanvasOrigine().left)+"%";}else{label.style.top=(this.labelPosition.y)+"px";label.style.left=(this.labelPosition.x)+"px";}}else{if(append==true){label.style.top=(this.labelPosition.y+this.getCanvasOrigine().top)+signe;label.style.left=(this.labelPosition.x+this.getCanvasOrigine().left)+signe;}else{label.style.top=this.labelPosition.y+signe;label.style.left=this.labelPosition.x+signe;}}label.style.position="absolute";label.id=this.id;label.name=this.id;label.className="GUILabel";label.innerHTML=this.textLabel;label.style.zIndex=this.zIndex;if(append==true){this.html.appendChild(label);}else{element.appendChild(label);}this.addGuiElements(label);};CASTORGUI.GUILabel.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUILabel.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.labelVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.labelVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUILabel.prototype.isVisible=function(){return this.labelVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIGroup=function(name,options,guimanager){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);this.html=document.body||document.getElementsByTagName('body')[0];if(options){this.groupPosition={x:options.x,y:options.y};}this.guiManager=guimanager;this.name=name;this.elementsGoup=[];this.guiManager.groups.push(this);this.groupVisible=true;};Extends(CASTORGUI.GUIGroup,CASTORGUI.GUIManager);CASTORGUI.GUIGroup.prototype.add=function(guiElement){this.elementsGoup.push(guiElement);};CASTORGUI.GUIGroup.prototype.dispose=function(){var that=this;this.elementsGoup.forEach(function(e){if(that.getElementById(e.id)){that.html.removeChild(that.getElementById(e.id));}});return;};CASTORGUI.GUIGroup.prototype.setVisible=function(bool){var display;var that=this;if(bool==true){display="block";this.groupVisible=true;}else{display="none";this.groupVisible=false;}this.elementsGoup.forEach(function(e){that.getElementById(e.id).style.display=display;});return;};CASTORGUI.GUIGroup.prototype.isVisible=function(){return this.groupVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIFieldset=function(id,options,guimanager,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.fieldsetPosition={x:options.x,y:options.y};this.fieldsetSize={width:options.w,height:options.h};this.legend=options.legend;this.zIndex=options.zIndex||1;this.fieldsetVisible=true;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUIFieldset,CASTORGUI.GUIManager);CASTORGUI.GUIFieldset.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var fieldset=document.createElement("fieldset");fieldset.style.width=this.fieldsetSize.width+"px";fieldset.style.height=this.fieldsetSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){fieldset.style.top=this.convertPixelToPercentHeight(this.fieldsetPosition.y+this.getCanvasOrigine().top)+"%";fieldset.style.left=this.convertPixelToPercentWidth(this.fieldsetPosition.x+this.getCanvasOrigine().left)+"%";}else{fieldset.style.top=(this.fieldsetPosition.y)+"px";fieldset.style.left=(this.fieldsetPosition.x)+"px";}}else{if(append==true){fieldset.style.top=(this.fieldsetPosition.y+this.getCanvasOrigine().top)+signe;fieldset.style.left=(this.fieldsetPosition.x+this.getCanvasOrigine().left)+signe;}else{fieldset.style.top=(this.fieldsetPosition.y)+signe;fieldset.style.left=(this.fieldsetPosition.x)+signe;}}fieldset.style.position="absolute";fieldset.id=this.id;fieldset.name=this.id;fieldset.className="GUIFieldset";fieldset.style.zIndex=this.zIndex;this.html.appendChild(fieldset);var legend=document.createElement("legend");legend.innerHTML=this.legend;if(append==true){this.getElementById(this.id).appendChild(legend);}else{element.appendChild(legend);}this.addGuiElements(fieldset);};CASTORGUI.GUIFieldset.prototype.add=function(element){var contentFieldSet=this.getElementById(this.id);element.addElement(false,contentFieldSet);};CASTORGUI.GUIFieldset.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIFieldset.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.fieldsetVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.fieldsetVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIFieldset.prototype.isVisible=function(){return this.fieldsetVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUICheckbox=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.checkboxPosition={x:options.x,y:options.y};this.checkboxSize=options.size||1.0;this.zIndex=options.zIndex||1.0;this.checkboxVisible=true;this.onClickCheckbox=callback||"";this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUICheckbox,CASTORGUI.GUIManager);CASTORGUI.GUICheckbox.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var checkbox=document.createElement("input");checkbox.type="checkbox";checkbox.style.width=(this.checkboxSize*16)+"px";checkbox.style.height=(this.checkboxSize*16)+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){checkbox.style.top=this.convertPixelToPercentHeight(this.checkboxPosition.y+this.getCanvasOrigine().top)+"%";checkbox.style.left=this.convertPixelToPercentWidth(this.checkboxPosition.x+this.getCanvasOrigine().left)+"%";}else{checkbox.style.top=(this.checkboxPosition.y)+"px";checkbox.style.left=(this.checkboxPosition.x)+"px";}}else{if(append==true){checkbox.style.top=(this.checkboxPosition.y+this.getCanvasOrigine().top)+signe;checkbox.style.left=(this.checkboxPosition.x+this.getCanvasOrigine().left)+signe;}else{checkbox.style.top=this.checkboxPosition.y+signe;checkbox.style.left=this.checkboxPosition.x+signe;}}checkbox.style.position="absolute";checkbox.style.padding="0px";checkbox.style.margin="0px";checkbox.id=this.id;checkbox.name=this.id;checkbox.className="GUICheckbox";checkbox.tabindex=this.tabindex;checkbox.style.zIndex=this.zIndex;checkbox.onclick=this.onClickCheckbox;if(append==true){this.html.appendChild(checkbox);}else{element.appendChild(checkbox);}this.addGuiElements(checkbox);};CASTORGUI.GUICheckbox.prototype.isChecked=function(){if(this.getElementById(this.id).checked){return true;}else{return false;}};CASTORGUI.GUICheckbox.prototype.setChecked=function(value){this.getElementById(this.id).checked=value;};CASTORGUI.GUICheckbox.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUICheckbox.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.checkboxVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.checkboxVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUICheckbox.prototype.isVisible=function(){return this.checkboxVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIButton=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.buttonPosition={x:options.x,y:options.y};this.buttonSize={width:options.w,height:options.h};this.value=options.value||"Ok";this.buttonVisible=true;this.onClickButton=callback||false;this.imageButton=options.backgroundImage||null;this.colorButton=options.backgroundColor||null;this.borderRadiusButton=options.borderRadiusButton||null;this.borderButton=options.borderButton||null;this.colorText=options.colorText||null;this.zIndex=options.zIndex||1;this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUIButton,CASTORGUI.GUIManager);CASTORGUI.GUIButton.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var button=document.createElement("button");button.style.width=this.buttonSize.width+"px";button.style.height=this.buttonSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){button.style.top=this.convertPixelToPercentHeight(this.buttonPosition.y+this.getCanvasOrigine().top)+"%";button.style.left=this.convertPixelToPercentWidth(this.buttonPosition.x+this.getCanvasOrigine().left)+"%";}else{button.style.top=(this.buttonPosition.y)+"px";button.style.left=(this.buttonPosition.x)+"px";}}else{if(append==true){button.style.top=(this.buttonPosition.y+this.getCanvasOrigine().top)+signe;button.style.left=(this.buttonPosition.x+this.getCanvasOrigine().left)+signe;}else{button.style.top=this.buttonPosition.y+signe;button.style.left=this.buttonPosition.x+signe;}}button.innerHTML=this.value;button.style.position="absolute";button.id=this.id;button.name=this.id;button.style.zIndex=this.zIndex;button.className="GUIButton";button.tabindex=this.tabindex;button.style.borderRadius=this.borderRadiusButton;if(this.imageButton!=null){button.style.backgroundImage="url("+this.imageButton+")";}else{button.style.background=this.colorButton;}button.style.border=this.borderButton;button.style.color=this.colorText;button.onclick=this.onClickButton;if(append==true){this.html.appendChild(button);}else{element.appendChild(button);}this.addGuiElements(button);};CASTORGUI.GUIButton.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIButton.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.buttonVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.buttonVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIButton.prototype.isVisible=function(){return this.buttonVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIDialog=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.dialogSize={width:options.w,height:options.h};this.dialogPosition={x:options.x,y:options.y};this.overflow=options.overflow||"auto";this.borderDialog=options.border||null;this.colorDialog=options.backgroundColor||null;this.imageDialog=options.backgroundImage||null;this.buttonDialog=options.closeDialog||"true";this.imageButtonDialog=options.imageButtonDialog||"false";this.urlImage=options.urlImage||null;this.callback=callback||null;this.radius=options.radius||8;this.zIndex=options.zIndex||0;this.dialogVisible=false;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUIDialog,CASTORGUI.GUIManager);CASTORGUI.GUIDialog.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var dialog=document.createElement("div");dialog.style.width=this.dialogSize.width+"px";dialog.style.height=this.dialogSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){dialog.style.top=this.convertPixelToPercentHeight(this.dialogPosition.y+this.getCanvasOrigine().top)+"%";dialog.style.left=this.convertPixelToPercentWidth(this.dialogPosition.x+this.getCanvasOrigine().left)+"%";}else{dialog.style.top=(this.dialogPosition.y+this.getCanvasOrigine().top)+signe;dialog.style.left=(this.dialogPosition.x+this.getCanvasOrigine().left)+signe;}dialog.style.position="absolute";dialog.id=this.id;dialog.name=this.id;dialog.className="GUIDialog";dialog.style.zIndex=this.zIndex;dialog.style.background=this.colorDialog;dialog.style.borderRadius=this.radius+"px";dialog.style.backgroundImage="url("+this.imageDialog+")";dialog.style.border=this.borderDialog;dialog.style.display="none";dialog.style.overflow=this.overflow;var eventButton=null;if(append==true){this.html.appendChild(dialog);}else{element.appendChild(dialog);}if(this.buttonDialog=="true"){eventButton=document.createElement("button");eventButton.innerHTML="X";eventButton.id=this.id+"_button";eventButton.style.position="absolute";eventButton.style.borderRadius="12px";eventButton.style.border="2px solid black";eventButton.style.left=this.dialogSize.width-12+signe;eventButton.style.marginTop="-12px";eventButton.style.width="25px";eventButton.style.height="25px";eventButton.style.zIndex=10000;eventButton.onclick=function(){document.body.removeChild(dialog);};this.getElementById(this.id).appendChild(eventButton);}else if(this.imageButtonDialog=="true"){var that=this;this._getSizeImage(this.urlImage,function(result){var sizeImageW=result.w;var sizeImageH=result.h;eventButton=document.createElement("img");eventButton.src=that.urlImage;eventButton.id=that.id+"_button";eventButton.style.position="absolute";eventButton.style.left=that.dialogSize.width-(sizeImageW/2)+signe;eventButton.style.marginTop="-"+(sizeImageH/2)+signe;eventButton.style.width=sizeImageW+signe;eventButton.style.height=sizeImageH+signe;eventButton.style.cursor="pointer";eventButton.style.zIndex=10000;eventButton.onclick=that.callback;that.getElementById(that.id).appendChild(eventButton);});}else if(this.buttonDialog=="false"&&this.imageButtonDialog=="false"&&this.callback){dialog.onclick=this.callback;dialog.style.cursor="pointer";}this.addGuiElements(dialog);};CASTORGUI.GUIDialog.prototype._getSizeImage=function(URL,callback){var image=new Image();image.src=URL;image.onload=function(){var result={w:image.width,h:image.height};callback(result);};};CASTORGUI.GUIDialog.prototype.add=function(element){var contentDialog=this.getElementById(this.id);contentDialog.style.zIndex=this.zIndex+1;element.style.zIndex+2;element.addElement(false,contentDialog);};CASTORGUI.GUIDialog.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIDialog.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.dialogVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.dialogVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIDialog.prototype.isVisible=function(){return this.dialogVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIProgress=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.progress=null;this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.progressPosition={x:options.x,y:options.y};this.progressSize={width:options.w,height:options.h};this.min=options.min||0;this.max=options.max||100;this.value=options.value||0;this.background=options.background||null;this.backgroundValue=options.backgroundValue||null;this.zIndex=options.zIndex||1;this.orient=options.orient||"horizontal";this.progressVisible=true;this.onchangeProgress=callback||"";this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUIProgress,CASTORGUI.GUIManager);CASTORGUI.GUIProgress.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}this.progress=document.createElement("progress");this.progress.min=this.min;this.progress.max=this.max;this.progress.value=this.value;this.progress.style.width=this.progressSize.width+"px";this.progress.style.height=this.progressSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){this.progress.style.top=this.convertPixelToPercentHeight(this.progressPosition.y+this.getCanvasOrigine().top)+"%";this.progress.style.left=this.convertPixelToPercentWidth(this.progressPosition.x+this.getCanvasOrigine().left)+"%";}else{this.progress.style.top=(this.progressPosition.y)+"px";this.progress.style.left=(this.progressPosition.x)+"px";}}else{if(append==true){this.progress.style.top=(this.progressPosition.y+this.getCanvasOrigine().top)+signe;this.progress.style.left=(this.progressPosition.x+this.getCanvasOrigine().left)+signe;}else{this.progress.style.top=(this.progressPosition.y)+signe;this.progress.style.left=(this.progressPosition.x)+signe;}}this.progress.style.position="absolute";this.progress.id=this.id;this.progress.className="GUIProgress";this.progress.tabindex=this.tabindex;this.progress.name=this.id;this.progress.style.zIndex=this.zIndex;if(this.orient=="vertical"||this.orient=="Vertical"){this.progress.style.writingMode="bt-lr";this.progress.style.WebkitAppearance="progress-vertical";}var cssProgress="#"+this.id+" {"+"background-color:"+this.background+";"+"} #"+this.id+"::after {"+"background-color:"+this.backgroundValue+";"+"} #"+this.id+"::-webkit-progress-bar {"+"background-color:"+this.background+";"+"} #"+this.id+"::-webkit-progress-value {"+"background-color:"+this.backgroundValue+";"+"} #"+this.id+"::-moz-progress-bar {"+"background-color:"+this.background+";"+"}";this.addStyle(cssProgress);this.progress.onchange=this.onchangeProgress;if(append==true){this.html.appendChild(this.progress);}else{element.appendChild(this.progress);}this.addGuiElements(this.progress);};CASTORGUI.GUIProgress.prototype.updateValue=function(value){this.progress.value=value;};CASTORGUI.GUIProgress.prototype.getValue=function(){return this.progress.value;};CASTORGUI.GUIProgress.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIProgress.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.progressVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.progressVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIProgress.prototype.isVisible=function(){return this.progressVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUISpinner=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.numberPosition={x:options.x,y:options.y};this.numberSize={width:options.w,height:options.h};this.min=options.min||0;this.max=options.max||100;this.step=options.step||1;this.value=options.value||(this.max/2);this.zIndex=options.zIndex||1;this.orient=options.orient||"horizontal";this.numberVisible=true;this.onchangeNumber=callback||false;this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUISpinner,CASTORGUI.GUIManager);CASTORGUI.GUISpinner.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var number=document.createElement("input");number.type="number";number.min=this.min;number.max=this.max;number.value=this.value;number.step=this.step;number.style.width=this.numberSize.width+signe;number.style.height=this.numberSize.height+signe;if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){number.style.top=this.convertPixelToPercentHeight(this.numberPosition.y+this.getCanvasOrigine().top)+"%";number.style.left=this.convertPixelToPercentWidth(this.numberPosition.x+this.getCanvasOrigine().left)+"%";}else{number.style.top=(this.numberPosition.y)+"px";number.style.left=(this.numberPosition.x)+"px";}}else{if(append==true){number.style.top=(this.numberPosition.y+this.getCanvasOrigine().top)+signe;number.style.left=(this.numberPosition.x+this.getCanvasOrigine().left)+signe;}else{number.style.top=this.numberPosition.y+signe;number.style.left=this.numberPosition.x+signe;}}number.style.position="absolute";number.id=this.id;number.name=this.id;number.className="GUISpinner";number.tabindex=this.tabindex;number.style.zIndex=this.zIndex;number.oninput=this.onchangeNumber;number.onchange=this.onchangeNumber;if(append==true){this.html.appendChild(number);}else{element.appendChild(number);}this.addGuiElements(number);};CASTORGUI.GUISpinner.prototype.getValue=function(){return this.getElementById(this.id).value;};CASTORGUI.GUISpinner.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUISpinner.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.numberVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.numberVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUISpinner.prototype.isVisible=function(){return this.numberVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIMeter=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.meter=nullthis.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.meterPosition={x:options.x,y:options.y};this.meterSize={width:options.w,height:options.h};this.border=options.border||0;this.background=options.background||null;this.backgroundValue=options.backgroundValue||null;this.min=options.min||0;this.max=options.max||100;this.value=options.value||0;this.zIndex=options.zIndex||1;this.orient=options.orient||"horizontal";this.meterVisible=true;this.onchangeMeter=callback||"";this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUIMeter,CASTORGUI.GUIManager);CASTORGUI.GUIMeter.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}this.meter=document.createElement("meter");this.meter.min=this.min;this.meter.max=this.max;this.meter.value=this.value;this.meter.style.width=this.meterSize.width+"px";this.meter.style.height=this.meterSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){this.meter.style.top=this.convertPixelToPercentWidth(this.meterPosition.y+this.getCanvasOrigine().top)+"%";this.meter.style.left=this.convertPixelToPercentHeight(this.meterPosition.x+this.getCanvasOrigine().left)+"%";}else{this.meter.style.top=(this.meterPosition.y)+"px";this.meter.style.left=(this.meterPosition.x)+"px";}}else{if(append==true){this.meter.style.top=(this.meterPosition.y+this.getCanvasOrigine().top)+signe;this.meter.style.left=(this.meterPosition.x+this.getCanvasOrigine().left)+signe;}else{this.meter.style.top=this.meterPosition.y+signe;this.meter.style.left=this.meterPosition.x+signe;}}this.meter.style.position="absolute";this.meter.id=this.id;this.meter.name=this.id;this.meter.className="GUIMeter";this.meter.tabindex=this.tabindex;this.meter.style.zIndex=this.zIndex;if(this.orient=="vertical"||this.orient=="Vertical"){this.meter.style.writingMode="bt-lr";this.meter.style.WebkitAppearance="meter-vertical";}this.meter.onchange=this.onchangeMeter;var cssMeter="#"+this.id+" {"+"border:"+this.border+";"+"border-radius:"+this.borderRadius+";"+"background-color:"+this.background+";"+"} #"+this.id+"::after {"+"border:"+this.border+";"+"border-radius:"+this.borderRadius+";"+"background-color:"+this.backgroundValue+";"+"} #"+this.id+"::-webkit-progress-bar {"+"border:"+this.border+";"+"border-radius:"+this.borderRadius+";"+"background-color:"+this.background+";"+"} #"+this.id+"::-webkit-progress-value {"+"border:"+this.border+";"+"border-radius:"+this.borderRadius+";"+"background-color:"+this.backgroundValue+";"+"} #"+this.id+"::-moz-progress-bar {"+"border:"+this.border+";"+"border-radius:"+this.borderRadius+";"+"background-color:"+this.background+";"+"}";this.addStyle(cssMeter);if(append==true){this.html.appendChild(this.meter);}else{element.appendChild(this.meter);}this.addGuiElements(this.meter);};CASTORGUI.GUIMeter.prototype.updateValue=function(value){this.meter.value=value;};CASTORGUI.GUIMeter.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIMeter.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.meterVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.meterVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIMeter.prototype.isVisible=function(){return this.meterVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIPanel=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.divPosition={x:options.x,y:options.y};this.divSize={width:options.w,height:options.h};this.divVisible=false;this.overflow=options.overflow||"auto";this.borderRadiusDiv=options.borderRadiusPanel||"10px";this.imageDiv=options.backgroundImage||null;this.colorDiv=options.backgroundColor||null;this.borderDiv=options.borderPanel||null;this.position=options.position||"absolute";this.zIndex=options.zIndex||1;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUIPanel,CASTORGUI.GUIManager);CASTORGUI.GUIPanel.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var div=document.createElement("div");if(this.divSize.width>0||this.divSize.height>0){div.style.width=this.divSize.width+"px";div.style.height=this.divSize.height+"px";}if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){if(this.divPosition.x>0){div.style.left=this.convertPixelToPercentWidth(this.divPosition.x+this.getCanvasOrigine().left)+"%";}if(this.divPosition.y>0){div.style.top=this.convertPixelToPercentHeight(this.divPosition.y+this.getCanvasOrigine().top)+"%";}}else{if(this.divPosition.x>0){div.style.marginLeft=this.convertPixelToPercentWidth(this.divPosition.x)+"%";}if(this.divPosition.y>0){div.style.marginTop=this.convertPixelToPercentHeight(this.divPosition.y)+"%";}}}else{if(append==true){if(this.divPosition.x>0){div.style.left=(this.divPosition.x+this.getCanvasOrigine().left)+signe;}if(this.divPosition.y>0){div.style.top=(this.divPosition.y+this.getCanvasOrigine().top)+signe;}}else{if(this.divPosition.x>0){div.style.marginLeft=this.divPosition.x+signe;}if(this.divPosition.y>0){div.style.marginTop=this.divPosition.y+signe;}}}div.id=this.id;div.name=this.id;div.className="GUIPanel";div.style.position=this.position;div.style.overflow=this.overflow;div.style.zIndex=this.zIndex;div.style.backgroundImage="url("+this.imageDiv+")";div.style.backgroundColor=this.colorDiv;div.style.borderRadius=this.borderRadiusDiv;div.style.border=this.borderDiv;div.style.display="none";if(append==true){this.html.appendChild(div);}else{element.appendChild(div);}this.addGuiElements(div);};CASTORGUI.GUIPanel.prototype.add=function(element){var contentPanel=this.getElementById(this.id);contentPanel.style.zIndex=this.zIndex+1;element.addElement(false,contentPanel);};CASTORGUI.GUIPanel.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIPanel.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.divVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.divVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIPanel.prototype.isVisible=function(){return this.divVisible;};})();var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.GUIColor=function(id,options,guimanager,callback,append){CASTORGUI.GUIManager.call(this,guimanager.canvas,guimanager.canvasCss);if(append==null||append==undefined){append=true;}this.id=id;this.html=document.body||document.getElementsByTagName('body')[0];this.colorPosition={x:options.x,y:options.y};this.colorSize={width:options.w,height:options.h};this.value=options.value||"#e30000";this.zIndex=options.zIndex||1;this.colorVisible=true;this.onchangeColor=callback||"";this.tabindex=options.tabindex||0;if(append==true){this.addElement(append);}};Extends(CASTORGUI.GUIColor,CASTORGUI.GUIManager);CASTORGUI.GUIColor.prototype.addElement=function(append,element){var signe="";if(this.pixel){signe="px";}else{signe="%";}var color=document.createElement("input");color.type="color";color.value=this.value;color.className="GUIColor";color.tabindex=this.tabindex;color.style.width=this.colorSize.width+"px";color.style.height=this.colorSize.height+"px";if(CASTORGUI.GUIManager.convertPixelToPercent==true){if(append==true){color.style.top=this.convertPixelToPercentHeight(this.colorPosition.y+this.getCanvasOrigine().top)+"%";color.style.left=this.convertPixelToPercentWidth(this.colorPosition.x+this.getCanvasOrigine().left)+"%";}else{color.style.top=(this.colorPosition.y)+"px";color.style.left=(this.colorPosition.x)+"px";}}else{if(append==true){color.style.top=(this.colorPosition.y+this.getCanvasOrigine().top)+signe;color.style.left=(this.colorPosition.x+this.getCanvasOrigine().left)+signe;}else{color.style.top=this.colorPosition.y+signe;color.style.left=this.colorPosition.x+signe;}}color.style.position="absolute";color.id=this.id;color.name=this.id;color.style.zIndex=this.zIndex;color.onchange=this.onchangeColor;if((navigator.userAgent.indexOf("MSIE")!=-1)||(navigator.appName=="Netscape")||(!!document.documentMode==true)||navigator.appVersion.indexOf('Edge')>-1||(navigator.appVersion.indexOf('Trident')==-1)){window.nativeColorGUI.init(this.id);}if(append==true){this.html.appendChild(color);}else{element.appendChild(color);}this.addGuiElements(color);};CASTORGUI.GUIColor.prototype.getColor=function(rgb){if(rgb==undefined){rgb=true;hex=false;}else if(rgb==true){rgb=true;hex=false;}else{rgb=false;hex=true;}var valueColor=null;if(rgb==true){valueColor=hexToRgb(this.getElementById(this.id).value);}else if(hex==true){valueColor=this.getElementById(this.id).value;}return valueColor;};CASTORGUI.GUIColor.prototype.dispose=function(){return this.html.removeChild(this.getElementById(this.id));};CASTORGUI.GUIColor.prototype.setVisible=function(bool,fade){var display;if(fade==undefined)fade=true;var element=this.getElementById(this.id);if(bool==true){display="block";this.colorVisible=true;if(fade==true){this.fadeIn(element);}}else{display="none";this.colorVisible=false;if(fade==true){this.fadeOut(element);}}if(fade==false){element.style.display=display;}};CASTORGUI.GUIColor.prototype.isVisible=function(){return this.colorVisible;};})();var hexToR=function(h){return parseInt((cutHex(h)).substring(0,2),16)};var hexToG=function(h){return parseInt((cutHex(h)).substring(2,4),16)};var hexToB=function(h){return parseInt((cutHex(h)).substring(4,6),16)};var cutHex=function(h){return(h.charAt(0)=="#")?h.substring(1,7):h};var hexToRgb=function(hex){var c_r=hexToR(hex)/255,c_g=hexToG(hex)/255,c_b=hexToB(hex)/255;return{r:c_r,g:c_g,b:c_b};};var CASTORGUI=CASTORGUI||{};(function(){CASTORGUI.DataBase=function(useSessionStorage){if(useSessionStorage==undefined||useSessionStorage==false){this.database=window.localStorage;}else{this.database=window.sessionStorage;}};CASTORGUI.DataBase.prototype.deleteDataBase=function(){this.database.clear();};CASTORGUI.DataBase.prototype.deleteTable=function(table){this.database.removeItem(table);};CASTORGUI.DataBase.prototype.deleteField=function(table,field){var champ=table[field];this.database.removeItem(champ);};CASTORGUI.DataBase.prototype.deleteItemFromField=function(table,field,item){var valeur=table[field][item];this.database.removeItem(item);};CASTORGUI.DataBase.prototype.addTable=function(table){var empty=JSON.stringify({});this.database.setItem(table,empty);};CASTORGUI.DataBase.prototype.createField=function(table,field,value){var data=JSON.stringify(value);var json=eval("({"+field+" : "+data+"})");this.database.setItem(table,JSON.stringify(json));};CASTORGUI.DataBase.prototype.insertItemFromField=function(table,field,item,value){var data=JSON.stringify(value);this.database.setItem(table[field][item],data);};CASTORGUI.DataBase.prototype.selectItem=function(table,field,item){var theTable=$.parseJSON(this.database[table]);return theTable[field][item];};CASTORGUI.DataBase.prototype.selectAllItems=function(table,field){var theTable=$.parseJSON(this.database[table][field]);return theTable;};CASTORGUI.DataBase.prototype.selectAllTable=function(table){var theTable=$.parseJSON(this.database[table]);return theTable;};CASTORGUI.DataBase.prototype.selectAllDataBase=function(){return$.parseJSON(this.database);};CASTORGUI.DataBase.prototype.updateItem=function(table,field,item,value){this.database[table][field][item]=value;};CASTORGUI.DataBase.prototype.getLimit=function(){return this.database.length-1;};CASTORGUI.DataBase.prototype.isSupported=function(){if(typeof localStorage!='undefined'){return true;}else{return false;}};})(); \ No newline at end of file diff --git a/src/GUIManager.js b/src/GUIManager.js index ef75cd5..b7705ab 100644 --- a/src/GUIManager.js +++ b/src/GUIManager.js @@ -36,10 +36,10 @@ var Extends = function(ChildClass, ParentClass) { // ClassB (child) herite de cl this.head.appendChild(this.header); } this.addStyle(this.canvasCss, this.theme); - document.addEventListener('webkitfullscreenchange', function() {location.reload();}, false); - document.addEventListener('mozfullscreenchange', function() {location.reload();}, false); - document.addEventListener('fullscreenchange', function() {location.reload();}, false); - document.addEventListener('MSFullscreenChange', function() {location.reload();}, false); + //document.addEventListener('webkitfullscreenchange', function() {location.reload();}, false); + //document.addEventListener('mozfullscreenchange', function() {location.reload();}, false); + //document.addEventListener('fullscreenchange', function() {location.reload();}, false); + //document.addEventListener('MSFullscreenChange', function() {location.reload();}, false); }; CASTORGUI.GUIManager.prototype.addGuiElements = function(elem)