Files
infineon_plc/Packages/Beckhoff.TwinCAT.HMI.Controls.14.4.1/runtimes/native1.12-tchmi/dist/TcHmiImage/TcHmiImage.esm.js
m.heisig 2d11c43579 Added minimal functionality for Robot teaching
- Added minimal HMI
- Added possibility to open and close all chamber doors
2026-01-17 09:20:39 +01:00

1 line
9.8 KiB
JavaScript

var __runInitializers=this&&this.__runInitializers||function(thisArg,initializers,value){for(var useValue=arguments.length>2,i=0;i<initializers.length;i++)value=useValue?initializers[i].call(thisArg,value):initializers[i].call(thisArg);return useValue?value:void 0},__esDecorate=this&&this.__esDecorate||function(ctor,descriptorIn,decorators,contextIn,initializers,extraInitializers){function accept(f){if(void 0!==f&&"function"!=typeof f)throw new TypeError("Function expected");return f}for(var _,kind=contextIn.kind,key="getter"===kind?"get":"setter"===kind?"set":"value",target=!descriptorIn&&ctor?contextIn.static?ctor:ctor.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor(target,contextIn.name):{}),done=!1,i=decorators.length-1;i>=0;i--){var context={};for(var p in contextIn)context[p]="access"===p?{}:contextIn[p];for(var p in contextIn.access)context.access[p]=contextIn.access[p];context.addInitializer=function(f){if(done)throw new TypeError("Cannot add initializers after decoration has completed");extraInitializers.push(accept(f||null))};var result=(0,decorators[i])("accessor"===kind?{get:descriptor.get,set:descriptor.set}:descriptor[key],context);if("accessor"===kind){if(void 0===result)continue;if(null===result||"object"!=typeof result)throw new TypeError("Object expected");(_=accept(result.get))&&(descriptor.get=_),(_=accept(result.set))&&(descriptor.set=_),(_=accept(result.init))&&initializers.unshift(_)}else(_=accept(result))&&("field"===kind?initializers.unshift(_):descriptor[key]=_)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0};import{TcHmiControl}from"Beckhoff.TwinCAT.HMI.Framework/index.esm.js";let TcHmiImage=(()=>{let ___onResized_decorators,___onLoad_decorators,___onError_decorators,_classSuper=TcHmiControl.Control,_instanceExtraInitializers=[];return class extends _classSuper{static{const _metadata="function"==typeof Symbol&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;___onResized_decorators=[TcHmi.EventHandler()],___onLoad_decorators=[TcHmi.EventHandler({checkIsEnabled:!0})],___onError_decorators=[TcHmi.EventHandler({checkIsEnabled:!0})],__esDecorate(this,null,___onResized_decorators,{kind:"method",name:"__onResized",static:!1,private:!1,access:{has:obj=>"__onResized"in obj,get:obj=>obj.__onResized},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onLoad_decorators,{kind:"method",name:"__onLoad",static:!1,private:!1,access:{has:obj=>"__onLoad"in obj,get:obj=>obj.__onLoad},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onError_decorators,{kind:"method",name:"__onError",static:!1,private:!1,access:{has:obj=>"__onError"in obj,get:obj=>obj.__onError},metadata:_metadata},null,_instanceExtraInitializers),_metadata&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata})}static#tchmiFQN="TcHmi.Controls.Beckhoff."+this.name;constructor(element,pcElement,attrs){super(element,pcElement,attrs)}__elementImage=__runInitializers(this,_instanceExtraInitializers);__src;__alt;__runtimeWidthNeededForHeight=!1;__runtimeHeightNeededForWidth=!1;__onResizedEventDestroyEvent=null;__previnit(){if(this.__elementImage=this.__element[0].querySelector(".TcHmi_Controls_Beckhoff_TcHmiImage-template-content"),this.__elementImage||(this.__elementImage=this.__element[0].querySelector(".tchmi-image-template-content")),null===this.__elementImage)throw new Error("Invalid Template.html");super.__previnit()}__init(){super.__init(),this.__destroyOnDestroy.push(TcHmi.EventProvider.registerDomEvent(this.__elementImage,"load",this.__onLoad),TcHmi.EventProvider.registerDomEvent(this.__elementImage,"error",this.__onError))}__attach(){super.__attach()}__detach(){super.__detach(),null!==this.__onResizedEventDestroyEvent&&(this.__onResizedEventDestroyEvent(),this.__onResizedEventDestroyEvent=null)}destroy(){this.__keepAlive||super.destroy()}__onResized(_event,_control){this.__asyncWorkData["System.TcHmiImage.resized"]=!0,this.__requestAsyncWork()}__doAsyncWork(timestamp){super.__doAsyncWork(timestamp),this.__asyncWorkData["System.TcHmiImage.resized"]&&(this.__asyncWorkData["System.TcHmiImage.resized"]=!1,this.__runtimeHeightNeededForWidth?this.__processWidth():this.__runtimeWidthNeededForHeight&&this.__processHeight())}__processWidth(){if("Content"===this.getWidthMode()){let newWidthStr="";const contentPixelSize=this.__getContentWidth();null!==contentPixelSize&&(newWidthStr=contentPixelSize.toFixed(3)+"px"),TcHmi.StyleProvider.setSimpleElementStyle(this.__element,"width",newWidthStr)}super.__processWidth(),"Content"===this.getHeightMode()&&"Content"!==this.getWidthMode()&&this.__processHeight()}__processHeight(){if("Content"===this.getHeightMode()){this.__intHeight=null;const contentPixelSize=this.__getContentHeight();null!==contentPixelSize&&(this.__intHeight=contentPixelSize.toFixed(3)+"px")}super.__processHeight(),"Content"===this.getWidthMode()&&"Content"!==this.getHeightMode()&&this.__processWidth()}setWidthMode(valueNew){let convertedValue=TcHmi.ValueConverter.toSizeModeWithContent(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("WidthMode")),convertedValue!==this.__widthMode&&(this.__widthMode=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"WidthMode"}),this.__processWidthMode(),"Content"===convertedValue&&"Content"===this.getHeightMode()&&this.__processHeightMode())}setHeightMode(valueNew){let convertedValue=TcHmi.ValueConverter.toSizeModeWithContent(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("HeightMode")),convertedValue!==this.__heightMode&&(this.__heightMode=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"HeightMode"}),this.__processHeightMode(),"Content"===convertedValue&&"Content"===this.getWidthMode()&&this.__processWidthMode())}__getContentWidth(){if(this.__runtimeHeightNeededForWidth=!1,"Content"!==this.getWidthMode())return super.__getContentWidth();if(!this.__src)return null;if("px"!==this.__widthUnit)return null;const imageElem=this.__elementImage;if(0===imageElem.naturalHeight||0===imageElem.naturalWidth)return null;let currentWidth=null;if("Content"===this.getHeightMode())currentWidth=imageElem.naturalWidth;else if(null!==this.__height&&void 0!==this.__height&&"Value"===this.getHeightMode())currentWidth=this.__height*imageElem.naturalWidth/imageElem.naturalHeight;else{if(this.__runtimeHeightNeededForWidth=!0,null===this.__onResizedEventDestroyEvent&&(this.__onResizedEventDestroyEvent=TcHmi.EventProvider.register(this.__id+".onResized",this.__onResized)),!this.__isAttached)return null;currentWidth=this.getRenderedHeight()*imageElem.naturalWidth/imageElem.naturalHeight}return TcHmi.Controls.limitPixelDimensionToControlBound(this,"width",currentWidth)}__getContentHeight(){if(this.__runtimeWidthNeededForHeight=!1,"Content"!==this.getHeightMode())return super.__getContentHeight();if(!this.__src)return null;if("px"!==this.__heightUnit)return null;const imageElem=this.__elementImage;if(0===imageElem.naturalHeight||0===imageElem.naturalWidth)return null;let currentHeight=null;if("Content"===this.getWidthMode())currentHeight=imageElem.naturalHeight;else if(null!==this.__width&&void 0!==this.__width&&"Value"===this.getWidthMode())currentHeight=this.__width*imageElem.naturalHeight/imageElem.naturalWidth;else{if(this.__runtimeWidthNeededForHeight=!0,null===this.__onResizedEventDestroyEvent&&(this.__onResizedEventDestroyEvent=TcHmi.EventProvider.register(this.__id+".onResized",this.__onResized)),!this.__isAttached)return null;currentHeight=this.getRenderedWidth()*imageElem.naturalHeight/imageElem.naturalWidth}return TcHmi.Controls.limitPixelDimensionToControlBound(this,"height",currentHeight)}getOriginalWidth(){return this.__elementImage.naturalWidth}getOriginalHeight(){return this.__elementImage.naturalHeight}__processAccessConfig(){super.__processAccessConfig(),this.__processSrc()}__processIsEnabled(){super.__processIsEnabled()}setSrc(valueNew){let convertedValue=TcHmi.ValueConverter.toString(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("Src")),convertedValue!==this.__src&&(this.__src=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Src"}),this.__processSrc())}getSrc(){return this.__src}__processSrc(){this.__src&&TcHmi.Access.checkAccess(this,"observe")?this.__elementImage.getAttribute("src")!==this.__src&&(this.__elementImage.src=tchmi_path(this.__src)):""!==this.__elementImage.getAttribute("src")&&(this.__elementImage.src="")}setAlt(valueNew){let convertedValue=TcHmi.ValueConverter.toString(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("Alt")),convertedValue!==this.__alt&&(this.__alt=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Alt"}),this.__processAlt())}getAlt(){return this.__alt}__processAlt(){this.__alt?this.__elementImage.alt=this.__alt:this.__elementImage.alt=""}__onLoad(event){"Content"===this.getHeightMode()&&this.__processHeight(),"Content"===this.getWidthMode()&&this.__processWidth(),TcHmi.EventProvider.raise(this.__id+".onLoad",event),TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"OriginalWidth"}),TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"OriginalHeight"})}__onError(event){"Content"===this.getHeightMode()&&this.__processHeight(),"Content"===this.getWidthMode()&&this.__processWidth(),TcHmi.EventProvider.raise(this.__id+".onError",event),TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"OriginalWidth"}),TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"OriginalHeight"})}}})();TcHmi.Controls.registerEx("TcHmiImage","TcHmi.Controls.Beckhoff",TcHmiImage,{injectInGlobalObject:!0});export{TcHmiImage as Control};