1 line
75 KiB
JavaScript
1 line
75 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 TcHmiTachometer=(()=>{var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k,_l,_m;let ___onResized_decorators,___onMove_decorators,___onResolverForValueFormatWatchCallback_decorators,___onResolverForRangeWatchCallback_decorators,___onResolverForTickDefinitionWatchCallback_decorators,___onResolverForLabelFormatWatchCallback_decorators,___onResolverForValueColorWatchCallback_decorators,___onResolverForLabelColorWatchCallback_decorators,___onResolverForUnitColorWatchCallback_decorators,___onResolverForTickColorWatchCallback_decorators,___onResolverForGaugeBackgroundColorWatchCallback_decorators,___onResolverForNeedleColorWatchCallback_decorators,___onResolverForMarkersWatchCallback_decorators,___onResolverForLegendLabelColorWatchCallback_decorators,_classSuper=TcHmiControl.Control,_instanceExtraInitializers=[];return class TcHmiTachometer extends _classSuper{static{const _metadata="function"==typeof Symbol&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;___onResized_decorators=[TcHmi.EventHandler()],___onMove_decorators=[TcHmi.EventHandler()],___onResolverForValueFormatWatchCallback_decorators=[(_a=TcHmi).CallbackMethod.bind(_a)],___onResolverForRangeWatchCallback_decorators=[(_b=TcHmi).CallbackMethod.bind(_b)],___onResolverForTickDefinitionWatchCallback_decorators=[(_c=TcHmi).CallbackMethod.bind(_c)],___onResolverForLabelFormatWatchCallback_decorators=[(_d=TcHmi).CallbackMethod.bind(_d)],___onResolverForValueColorWatchCallback_decorators=[(_e=TcHmi).CallbackMethod.bind(_e)],___onResolverForLabelColorWatchCallback_decorators=[(_f=TcHmi).CallbackMethod.bind(_f)],___onResolverForUnitColorWatchCallback_decorators=[(_g=TcHmi).CallbackMethod.bind(_g)],___onResolverForTickColorWatchCallback_decorators=[(_h=TcHmi).CallbackMethod.bind(_h)],___onResolverForGaugeBackgroundColorWatchCallback_decorators=[(_j=TcHmi).CallbackMethod.bind(_j)],___onResolverForNeedleColorWatchCallback_decorators=[(_k=TcHmi).CallbackMethod.bind(_k)],___onResolverForMarkersWatchCallback_decorators=[(_l=TcHmi).CallbackMethod.bind(_l)],___onResolverForLegendLabelColorWatchCallback_decorators=[(_m=TcHmi).CallbackMethod.bind(_m)],__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,___onMove_decorators,{kind:"method",name:"__onMove",static:!1,private:!1,access:{has:obj=>"__onMove"in obj,get:obj=>obj.__onMove},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForValueFormatWatchCallback_decorators,{kind:"method",name:"__onResolverForValueFormatWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForValueFormatWatchCallback"in obj,get:obj=>obj.__onResolverForValueFormatWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForRangeWatchCallback_decorators,{kind:"method",name:"__onResolverForRangeWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForRangeWatchCallback"in obj,get:obj=>obj.__onResolverForRangeWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForTickDefinitionWatchCallback_decorators,{kind:"method",name:"__onResolverForTickDefinitionWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForTickDefinitionWatchCallback"in obj,get:obj=>obj.__onResolverForTickDefinitionWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForLabelFormatWatchCallback_decorators,{kind:"method",name:"__onResolverForLabelFormatWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForLabelFormatWatchCallback"in obj,get:obj=>obj.__onResolverForLabelFormatWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForValueColorWatchCallback_decorators,{kind:"method",name:"__onResolverForValueColorWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForValueColorWatchCallback"in obj,get:obj=>obj.__onResolverForValueColorWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForLabelColorWatchCallback_decorators,{kind:"method",name:"__onResolverForLabelColorWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForLabelColorWatchCallback"in obj,get:obj=>obj.__onResolverForLabelColorWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForUnitColorWatchCallback_decorators,{kind:"method",name:"__onResolverForUnitColorWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForUnitColorWatchCallback"in obj,get:obj=>obj.__onResolverForUnitColorWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForTickColorWatchCallback_decorators,{kind:"method",name:"__onResolverForTickColorWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForTickColorWatchCallback"in obj,get:obj=>obj.__onResolverForTickColorWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForGaugeBackgroundColorWatchCallback_decorators,{kind:"method",name:"__onResolverForGaugeBackgroundColorWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForGaugeBackgroundColorWatchCallback"in obj,get:obj=>obj.__onResolverForGaugeBackgroundColorWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForNeedleColorWatchCallback_decorators,{kind:"method",name:"__onResolverForNeedleColorWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForNeedleColorWatchCallback"in obj,get:obj=>obj.__onResolverForNeedleColorWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForMarkersWatchCallback_decorators,{kind:"method",name:"__onResolverForMarkersWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForMarkersWatchCallback"in obj,get:obj=>obj.__onResolverForMarkersWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForLegendLabelColorWatchCallback_decorators,{kind:"method",name:"__onResolverForLegendLabelColorWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForLegendLabelColorWatchCallback"in obj,get:obj=>obj.__onResolverForLegendLabelColorWatchCallback},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)}__elementTemplateRoot=__runInitializers(this,_instanceExtraInitializers);__elementSvg;__elementBackgroundCircle;__elementMainTickContainer;__elementSubTickContainer;__elementLabelContainer;__elementRangeContainer;__elementMarkersContainer;__elementValueText;__elementUnitText;__elementNeedle;__elementNeedlePointer;__elementNeedleBase;__startPosition;__endPosition;__minValue;__maxValue;__ignoreInvalidValues;__step;__range;__showLabels;__decimalDigits;__showValueText;__showTicks;__labelPosition;__tickDefinition;__labelRange;__subTickPosition;__value;__lastReportedValue;__valueFormat;__unit;__markers;__legendFontFamily;__legendFontSize;__legendFontStyle;__legendFontWeight;__legendLabelColor;__elementLegend;__labelFontSize;__labelFontSizeUnit;__labelFontFamily;__labelFontStyle;__labelFontWeight;__labelFormat;__numberFormatter=new Intl.NumberFormat("en-US",{maximumFractionDigits:15,minimumFractionDigits:0});__valueFontSize;__valueFontSizeUnit;__valueFontFamily;__valueFontStyle;__valueFontWeight;__unitFontSize;__unitFontSizeUnit;__unitFontFamily;__unitFontStyle;__unitFontWeight;__valueColor;__labelColor;__unitColor;__tickColor;__gaugeBackgroundColor;__needleColor;__needleLength;__baseAnimationTime;__gaugeAlignment;__oldNeedleValue=null;__needleConfig="";__proportions={mainTickLength:0,subTickLength:0,rangeThickness:0,labelRadius:0,tickRadius:0,rangeRadius:0,outerRadius:0,startAngle:220,endAngle:-40,markerRadius:0};__labels=[];__internalValue=0;__internalMinValue=0;__internalMaxValue=0;__elementInvalidNotification;__updateInvalidNotificationTimer=0;__localizationReader=void 0;__triggerAsyncLayout=!1;__needleAnimation=null;__previnit(){if(this.__elementTemplateRoot=this.__element[0].getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiTachometer-template")[0],this.__elementSvg=this.__elementTemplateRoot.getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-svg")[0],this.__elementBackgroundCircle=this.__elementSvg.getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-circle-outside")[0],this.__elementMainTickContainer=this.__elementSvg.getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-main-tick-container")[0],this.__elementSubTickContainer=this.__elementSvg.getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-sub-tick-container")[0],this.__elementLabelContainer=this.__elementSvg.getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-label-container")[0],this.__elementRangeContainer=this.__elementSvg.getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-range-container")[0],this.__elementValueText=this.__elementSvg.getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-display-value")[0],this.__elementUnitText=this.__elementSvg.getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-display-unit")[0],this.__elementNeedle=this.__elementSvg.getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-needle")[0],this.__elementNeedlePointer=this.__elementSvg.getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-needle-pointer")[0],this.__elementNeedleBase=this.__elementSvg.getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-needle-base")[0],this.__elementInvalidNotification=document.createElement("div"),this.__elementInvalidNotification.classList.add("TcHmi_Controls_Beckhoff_TcHmiTachometer-invalid-notification"),!(this.__elementTemplateRoot&&this.__elementSvg&&this.__elementBackgroundCircle&&this.__elementMainTickContainer&&this.__elementSubTickContainer&&this.__elementLabelContainer&&this.__elementRangeContainer&&this.__elementValueText&&this.__elementUnitText&&this.__elementNeedle&&this.__elementNeedlePointer&&this.__elementNeedleBase))throw new Error("Invalid Template.html");this.__destroyOnDestroy.push(this.__localization.watch(data=>{data.error===TcHmi.Errors.NONE&&data.reader&&(this.__localizationReader=data.reader,this.__elementInvalidNotification.isConnected&&(void 0!==this.__value&&this.__value<this.__internalMinValue&&(this.__elementInvalidNotification.title=tchmi_format_string(this.__localizationReader.get("Tooltip_LessThanMin_Text"),this.__internalMinValue.toString())),void 0!==this.__value&&this.__value>this.__internalMaxValue&&(this.__elementInvalidNotification.title=tchmi_format_string(this.__localizationReader.get("Tooltip_GreaterThanMax_Text"),this.__internalMaxValue.toString()))))})),super.__previnit()}__init(){super.__init()}__attach(){super.__attach(),this.__destroyOnDetach.push(TcHmi.EventProvider.register(this.__id+".onResized",this.__onResized),TcHmi.EventProvider.register(this.__id+".onMoved",this.__onMove)),this.__processValue(),this.__updateInvalidNotificationTimer=setInterval(()=>this.__updateInvalidNotification(),500)}__detach(){super.__detach(),this.__updateInvalidNotificationTimer&&(clearInterval(this.__updateInvalidNotificationTimer),this.__updateInvalidNotificationTimer=0),this.__elementInvalidNotification.isConnected&&TcHmi.TopMostLayer.remove(this,this.__elementInvalidNotification),this.__triggerAsyncLayout=!1,this.__needleAnimation=null}destroy(){this.__keepAlive||super.destroy()}__onResized(_event,_ctrl){0===this.__labels.length&&this.__showLabels&&this.__labelRange&&this.__labelRange>0&&this.__processShowLabels(!1),this.__updateLayout(),this.__updateInvalidNotification()}__onMove(){this.__updateInvalidNotification()}__updateInvalidNotification(){if(this.__isAttached)if(this.__ignoreInvalidValues||void 0===this.__value||this.__isValid(this.__value))this.__elementInvalidNotification.isConnected&&TcHmi.TopMostLayer.remove(this,this.__elementInvalidNotification);else{let boundingRect=this.__element[0].getBoundingClientRect();const width=boundingRect.width,height=boundingRect.height;let radius=this.__proportions.outerRadius;const notificationSize=30,notificationDiagonal=Math.sqrt(notificationSize*notificationSize*2);let left=0,top=0,notificationMovedOutwards=!1;if(radius>0){radius<2*notificationSize&&(radius+=(2*notificationSize-radius)/2,notificationMovedOutwards=!0);const offsetAngle=Math.asin(notificationDiagonal/2/radius),notificationOffset={x:radius*Math.cos(-(Math.PI/4+offsetAngle)),y:radius*Math.sin(-(Math.PI/4+offsetAngle))},gaugeCenterOffset={x:0,y:0};if(width<=height)switch(gaugeCenterOffset.x=width/2,this.__gaugeAlignment){case"Start":gaugeCenterOffset.y=gaugeCenterOffset.x;break;case"Center":gaugeCenterOffset.y=height/2;break;case"End":gaugeCenterOffset.y=gaugeCenterOffset.x+(height-width)}else switch(gaugeCenterOffset.y=height/2,this.__gaugeAlignment){case"Start":gaugeCenterOffset.x=gaugeCenterOffset.y;break;case"Center":gaugeCenterOffset.x=width/2;break;case"End":gaugeCenterOffset.x=gaugeCenterOffset.y+(width-height)}left=boundingRect.left+gaugeCenterOffset.x+notificationOffset.x,top=boundingRect.top+gaugeCenterOffset.y+notificationOffset.y}(notificationMovedOutwards?[document.elementsFromPoint(boundingRect.left+width-1,boundingRect.top)]:[document.elementsFromPoint(left,top+1),document.elementsFromPoint(left+29,top+29)]).every(elementStack=>{const controlIndex=elementStack.indexOf(notificationMovedOutwards?this.__elementTemplateRoot:this.__elementBackgroundCircle);return-1!==controlIndex&&(0===controlIndex||!!elementStack[controlIndex-1].closest("#tchmi-system-topmostlayer-master"))})?(this.__elementInvalidNotification.style.left=left+"px",this.__elementInvalidNotification.style.top=top+"px",this.__localizationReader&&(void 0!==this.__value&&this.__value<this.__internalMinValue&&(this.__elementInvalidNotification.title=tchmi_format_string(this.__localizationReader.get("Tooltip_LessThanMin_Text"),this.__internalMinValue.toString())),void 0!==this.__value&&this.__value>this.__internalMaxValue&&(this.__elementInvalidNotification.title=tchmi_format_string(this.__localizationReader.get("Tooltip_GreaterThanMax_Text"),this.__internalMaxValue.toString()))),TcHmi.TopMostLayer.add(this,this.__elementInvalidNotification,{closeOnBackground:!1,dimBackground:!1,modal:!1,justAbove:{reference:this.__element[0],conflictResolution:TcHmi.TopMostLayer.ConflictResolution.Down}})):this.__elementInvalidNotification.isConnected&&TcHmi.TopMostLayer.remove(this,this.__elementInvalidNotification)}}__updateNeedle(value){value=(value=value>=this.__internalMinValue?value:this.__internalMinValue)<=this.__internalMaxValue?value:this.__internalMaxValue;let transform=" rotate("+this.__calcAngleFromValue(value)+", "+this.__proportions.outerRadius+", "+this.__proportions.outerRadius+")";this.__elementNeedle.setAttribute("transform",transform)}__calcAngleFromValue(value){if(this.__internalMaxValue===this.__internalMinValue)return this.__proportions.startAngle;let angleOfOne=(this.__proportions.startAngle-this.__proportions.endAngle)/(this.__internalMaxValue-this.__internalMinValue),angleFromStart=Math.abs(this.__internalMinValue-value)*angleOfOne;return(360-(this.__proportions.startAngle-angleFromStart-90))%360}__getProportions(){let width=this.getRenderedWidth();if(!width)return;let height=this.getRenderedHeight();if(!height)return;this.__elementLegend&&(height-=this.__elementLegend.getBoundingClientRect().height);let size=0;switch(this.__gaugeAlignment){case"Start":this.__elementTemplateRoot.style.placeItems="start";break;case"Center":this.__elementTemplateRoot.style.placeItems="center";break;case"End":this.__elementTemplateRoot.style.placeItems="end"}size=width<=height?width:height,this.__element[0].style.setProperty("--square-size",size+"px");let outerRadius=size/2,mainTickLength=.1*outerRadius,subTickLength=.05*outerRadius,rangeThickness=.05*outerRadius,labelThickness=0,labelSpace=0,tickSpace=0,rangeSpace=0,markerSpace=0,needleLength=.7*outerRadius;void 0!==this.__needleLength&&(needleLength=outerRadius*this.__needleLength/100);let needleBase=.05*outerRadius;this.__labels.forEach(label=>{let boundingRect=label.element.getBoundingClientRect(),hypotenuse_x=boundingRect.width,hypotenuse_length=(boundingRect.height,Math.sqrt(boundingRect.width*boundingRect.width+boundingRect.height*boundingRect.height)),angle=Math.asin(hypotenuse_x/hypotenuse_length)-label.angle%90*(Math.PI/180),distance=Math.cos(angle)*hypotenuse_length;distance>labelThickness&&(labelThickness=distance)}),this.__markers&&this.__markers.size>0&&(markerSpace=10),labelThickness>0&&(labelSpace=labelThickness+5),this.__showTicks&&void 0!==this.__tickDefinition&&null!==this.__tickDefinition&&(this.__tickDefinition.mainTickRange>0||this.__tickDefinition.subTickRange>0)&&(tickSpace=mainTickLength+10),null!==this.__range&&void 0!==this.__range&&this.__range.length>0&&(rangeSpace=rangeThickness+10),this.__markers&&this.__markers.size>0&&(markerSpace=10);let labelPadding=10+labelThickness/2;"Inside"===this.__labelPosition&&(labelPadding+=tickSpace,labelPadding+=rangeSpace,labelPadding+=markerSpace);let tickPadding=10;"Inside"===this.__labelPosition?(tickPadding+=rangeSpace,tickPadding+=markerSpace):tickPadding+=labelSpace,"Inside"===this.__subTickPosition&&(tickPadding+=mainTickLength);let rangePadding=10+rangeThickness/2;"Outside"===this.__labelPosition?(rangePadding+=labelSpace,rangePadding+=tickSpace):rangePadding+=markerSpace;let startAngle=(void 0!==this.__startPosition?this.__startPosition:0)%360;startAngle=startAngle<0?startAngle+360:startAngle;let endAngle=(void 0!==this.__endPosition?this.__endPosition:0)%360;endAngle=startAngle-endAngle>360?endAngle+360:endAngle,endAngle=startAngle-endAngle<=0?endAngle-360:endAngle;let markerRadius=0;return markerRadius="Outside"===this.__labelPosition?outerRadius-labelSpace-tickSpace-markerSpace/2-rangeSpace:outerRadius-markerSpace,{mainTickLength:mainTickLength>0?mainTickLength:0,subTickLength:subTickLength>0?subTickLength:0,rangeThickness:rangeThickness>0?rangeThickness:0,labelRadius:outerRadius-labelPadding>0?outerRadius-labelPadding:0,tickRadius:outerRadius-tickPadding>0?outerRadius-tickPadding:0,rangeRadius:outerRadius-rangePadding>0?outerRadius-rangePadding:0,outerRadius:outerRadius>0?outerRadius:0,startAngle,endAngle,needleBase,needleLength,markerRadius:markerRadius>0?markerRadius:0}}__updateLayout(){this.__triggerAsyncLayout=!0,this.__requestAsyncWork()}__doAsyncWork(timestamp=performance.now()){if(super.__doAsyncWork(timestamp),this.__triggerAsyncLayout){this.__triggerAsyncLayout=!1;let newProportions=this.__getProportions();if(!newProportions)return;newProportions.outerRadius!==this.__proportions.outerRadius&&(this.__elementBackgroundCircle.setAttribute("cx",newProportions.outerRadius.toString()),this.__elementBackgroundCircle.setAttribute("cy",newProportions.outerRadius.toString()),this.__elementBackgroundCircle.setAttribute("r",newProportions.outerRadius.toString()),this.__elementValueText.setAttribute("x",newProportions.outerRadius.toString()),this.__elementValueText.setAttribute("y",(2*newProportions.outerRadius-2*newProportions.mainTickLength).toString()),this.__elementUnitText.setAttribute("x",newProportions.outerRadius.toString()),this.__elementUnitText.setAttribute("y",(2*newProportions.outerRadius-2*newProportions.mainTickLength).toString()),this.__elementMainTickContainer.setAttribute("transform","translate("+newProportions.outerRadius+", "+newProportions.outerRadius+")"),this.__elementSubTickContainer.setAttribute("transform","translate("+newProportions.outerRadius+", "+newProportions.outerRadius+")"),this.__elementNeedleBase.setAttribute("cx",newProportions.outerRadius.toString()),this.__elementNeedleBase.setAttribute("cy",newProportions.outerRadius.toString()),this.__elementNeedleBase.setAttribute("r",newProportions.needleBase.toString()),this.__elementNeedlePointer.setAttribute("x1",newProportions.outerRadius.toString()),this.__elementNeedlePointer.setAttribute("y1",(newProportions.outerRadius-newProportions.needleBase-1).toString()),this.__elementNeedlePointer.setAttribute("x2",newProportions.outerRadius.toString()),this.__elementMarkersContainer&&this.__elementMarkersContainer.setAttribute("transform","translate("+newProportions.outerRadius+", "+newProportions.outerRadius+")")),this.__elementNeedlePointer.setAttribute("y2",(newProportions.outerRadius-newProportions.needleLength).toString()),newProportions.rangeThickness!==this.__proportions.rangeThickness&&TcHmi.StyleProvider.setSimpleElementStyle(this.__elementRangeContainer.getElementsByTagName("path"),"stroke-width",newProportions.rangeThickness+"px"),this.__proportions=newProportions,this.__processShowLabels(!1),this.__processShowTicks(!1),this.__processRange(!1),this.__updateNeedle(this.__internalValue),this.__createMarkerElements()}if(this.__needleAnimation){this.__needleAnimation.startTime||(this.__needleAnimation.startTime=timestamp);const progress=(timestamp-this.__needleAnimation.startTime)/this.__needleAnimation.duration;if(progress>=1||!this.__element[0].isConnected)this.__updateNeedle(this.__needleAnimation.toValue),this.__needleAnimation=null;else{const value=this.__needleAnimation.fromValue+(this.__needleAnimation.toValue-this.__needleAnimation.fromValue)*progress;this.__updateNeedle(value),this.__requestAsyncWork()}}}__setInternalMinMaxValue(){void 0!==this.__minValue&&void 0!==this.__maxValue?(this.__internalMinValue=this.__minValue>this.__maxValue?this.__maxValue:this.__minValue,this.__internalMaxValue=this.__maxValue<this.__minValue?this.__minValue:this.__maxValue):(this.__internalMinValue=0,this.__internalMaxValue=0)}__setInternalValues(){let internalValueBefore=this.__internalValue;if(this.__setInternalMinMaxValue(),void 0===this.__value?this.__internalValue=0:this.__value>=this.__internalMinValue&&this.__value<=this.__internalMaxValue&&(this.__internalValue=this.__value),internalValueBefore!==this.__internalValue){let currentValue=this.getValue();void 0!==currentValue&¤tValue!==this.__lastReportedValue&&(this.__lastReportedValue=currentValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Value"}),TcHmi.EventProvider.raise(this.__id+".onValueChanged"))}this.__updateInvalidNotification()}__isValid(value){return value>=this.__internalMinValue&&value<=this.__internalMaxValue}setValue(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);if(null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("Value")),convertedValue===this.__value)return;let isValid=this.__isValid(valueNew??this.getAttributeDefaultValueInternal("Value"));if(this.__ignoreInvalidValues&&!isValid)return;this.__value=convertedValue,this.__processValue();let currentValue=this.getValue();void 0!==currentValue&¤tValue!==this.__lastReportedValue&&(this.__lastReportedValue=currentValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Value"}),TcHmi.EventProvider.raise(this.__id+".onValueChanged"))}getValue(){return void 0!==this.__value?this.__internalValue:void 0}__processValue(){this.__setInternalMinMaxValue(),this.__setInternalValues();const valueToDisplay=this.__ignoreInvalidValues?this.__internalValue:this.__value??this.__internalValue;if(void 0!==this.__valueFormat&&null!==this.__valueFormat?this.__elementValueText.textContent=this.__executeValueFormatFunction(valueToDisplay):this.__elementValueText.textContent=this.__numberFormatter.format(valueToDisplay),this.__internalMaxValue!==this.__internalMinValue&&this.__isAttached){this.__needleAnimation=null;let needleValue=this.__value??this.__internalValue;if(needleValue=needleValue<this.__internalMinValue?this.__internalMinValue:needleValue,needleValue=needleValue>this.__internalMaxValue?this.__internalMaxValue:needleValue,this.__baseAnimationTime&&null!==this.__oldNeedleValue){let duration=this.__baseAnimationTime*(Math.abs(this.__oldNeedleValue-needleValue)/(this.__internalMaxValue-this.__internalMinValue));if(0===duration)return this.__updateNeedle(needleValue),void(this.__oldNeedleValue=needleValue);this.__needleAnimation={fromValue:this.__oldNeedleValue,toValue:needleValue,duration},this.__requestAsyncWork()}else this.__updateNeedle(needleValue);this.__oldNeedleValue=needleValue}}setMinValue(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("MinValue")),convertedValue!==this.__minValue&&(this.__minValue=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"MinValue"}),this.__processMinValue(),this.__processMarkers())}getMinValue(){return this.__minValue}__processMinValue(){void 0!==this.__maxValue&&void 0!==this.__minValue&&(this.__setInternalMinMaxValue(),void 0!==this.__value&&(this.__setInternalValues(),this.__isAttached&&(this.__updateLayout(),this.__processValue())))}setMaxValue(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("MaxValue")),convertedValue!==this.__maxValue&&(this.__maxValue=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"MaxValue"}),this.__processMaxValue(),this.__processMarkers())}getMaxValue(){return this.__maxValue}__processMaxValue(){void 0!==this.__maxValue&&void 0!==this.__minValue&&(this.__setInternalMinMaxValue(),this.__setInternalValues(),this.__isAttached&&(this.__updateLayout(),this.__processValue()))}setIgnoreInvalidValues(valueNew){let convertedValue=TcHmi.ValueConverter.toBoolean(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("IgnoreInvalidValues")),convertedValue!==this.__ignoreInvalidValues&&(this.__ignoreInvalidValues=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"IgnoreInvalidValues"}),this.__processIgnoreInvalidValues())}getIgnoreInvalidValues(){return this.__ignoreInvalidValues}__processIgnoreInvalidValues(){this.__isAttached&&this.__processValue()}setValueFormat(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("ValueFormat"));let resolverInfo=this.__objectResolvers.get("valueFormat");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("ValueFormat")?.type});this.__objectResolvers.set("valueFormat",{resolver,watchCallback:this.__onResolverForValueFormatWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForValueFormatWatchCallback)})}__onResolverForValueFormatWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("valueFormat"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__valueFormat)||(this.__valueFormat=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"ValueFormat"}),this.__processValueFormat()):TcHmi.Log.Controls.error(this,TcHmiTachometer.#tchmiFQN,{Attribute:"ValueFormat"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getValueFormat(){return this.__valueFormat}__processValueFormat(){this.__processValue()}__executeValueFormatFunction(value){if(void 0!==this.__valueFormat&&null!==this.__valueFormat&&!1!==this.__valueFormat.active){const args=[value];let res=null,f=new TcHmi.Function(this.__valueFormat);return f.executeEx(args,data=>{data.error===TcHmi.Errors.NONE&&void 0!==data.result?res=data.result:TcHmi.Log.Controls.error(this,TcHmiTachometer.#tchmiFQN,`Execution of function=${this.__valueFormat?.fn} failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}),f.destroy(),res}return value.toString()}setRange(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("Range"));let resolverInfo=this.__objectResolvers.get("range");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("Range")?.type});this.__objectResolvers.set("range",{resolver,watchCallback:this.__onResolverForRangeWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForRangeWatchCallback)})}__onResolverForRangeWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("range"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__range)||(this.__range=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Range"}),this.__processRange()):TcHmi.Log.Controls.error(this,TcHmiTachometer.#tchmiFQN,{Attribute:"Range"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getRange(){return this.__range}__processRange(layout=!0){if(void 0!==this.__range){if(0===this.__range.length)return this.__elementRangeContainer.textContent="",void(this.__isAttached&&layout&&this.__updateLayout());for(let i=0,ii=this.__range.length;i<ii;i++){let startValue=this.__range[i].start;startValue=startValue>=this.__internalMinValue?startValue:this.__internalMinValue,startValue=startValue<=this.__internalMaxValue?startValue:this.__internalMaxValue;let endValue=this.__range[i].end;endValue=endValue>=this.__internalMinValue?endValue:this.__internalMinValue,endValue=endValue<=this.__internalMaxValue?endValue:this.__internalMaxValue;let path,startAngle=(360-(this.__calcAngleFromValue(startValue)-90))%360*(Math.PI/180),endAngle=(360-(this.__calcAngleFromValue(endValue)-90))%360*(Math.PI/180),startPoint={x:this.__proportions.outerRadius+Math.cos(startAngle)*this.__proportions.rangeRadius,y:this.__proportions.outerRadius-Math.sin(startAngle)*this.__proportions.rangeRadius},endPoint={x:this.__proportions.outerRadius+Math.cos(endAngle)*this.__proportions.rangeRadius,y:this.__proportions.outerRadius-Math.sin(endAngle)*this.__proportions.rangeRadius};startAngle<endAngle&&(startAngle+=2*Math.PI),i>=this.__elementRangeContainer.childElementCount?(path=document.createElementNS("http://www.w3.org/2000/svg","path"),this.__elementRangeContainer.appendChild(path)):path=this.__elementRangeContainer.children[i],TcHmi.StyleProvider.processStrokeColor(path,this.__range[i].color),TcHmi.StyleProvider.setSimpleElementStyle(path,"stroke-width",this.__proportions.rangeThickness+"px");let pathData=`M ${startPoint.x} ${startPoint.y} A ${this.__proportions.rangeRadius} ${this.__proportions.rangeRadius}, 0, ${startAngle-endAngle>Math.PI?1:0}, 1, ${endPoint.x} ${endPoint.y}`;path.setAttribute("d",pathData)}for(;this.__elementRangeContainer.childElementCount>this.__range.length;)this.__elementRangeContainer.removeChild(this.__elementRangeContainer.lastElementChild);this.__isAttached&&layout&&this.__updateLayout()}}setTickDefinition(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("TickDefinition"));let resolverInfo=this.__objectResolvers.get("tickDefinition");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("TickDefinition")?.type});this.__objectResolvers.set("tickDefinition",{resolver,watchCallback:this.__onResolverForTickDefinitionWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForTickDefinitionWatchCallback)})}__onResolverForTickDefinitionWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("tickDefinition"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__tickDefinition)||(this.__tickDefinition=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"TickDefinition"}),this.__processTickDefinition()):TcHmi.Log.Controls.error(this,TcHmiTachometer.#tchmiFQN,{Attribute:"TickDefinition"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getTickDefinition(){return this.__tickDefinition}__processTickDefinition(layout=!0){this.__processShowTicks()}setDecimalDigits(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("DecimalDigits")),convertedValue!==this.__decimalDigits&&(this.__decimalDigits=convertedValue,this.__decimalDigits&&this.__decimalDigits<0&&(this.__decimalDigits=0),TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"DecimalDigits"}),this.__processDecimalDigits())}getDecimalDigits(){return this.__decimalDigits}__processDecimalDigits(){this.__updateFormatter(),this.__processValue()}__updateFormatter(){let numberFormatOptions={maximumFractionDigits:this.__decimalDigits??15,minimumFractionDigits:this.__decimalDigits??0,useGrouping:!1};this.__numberFormatter=Intl.NumberFormat("en-US",numberFormatOptions)}setStartPosition(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("StartPosition")),convertedValue!==this.__startPosition&&(this.__startPosition=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"StartPosition"}),this.__processStartPosition())}getStartPosition(){return this.__startPosition}__processStartPosition(){this.__isAttached&&this.__updateLayout()}setEndPosition(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("EndPosition")),convertedValue!==this.__endPosition&&(this.__endPosition=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"EndPosition"}),this.__processEndPosition())}getEndPosition(){return this.__endPosition}__processEndPosition(){this.__isAttached&&this.__updateLayout()}setShowLabels(valueNew){let convertedValue=TcHmi.ValueConverter.toBoolean(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("ShowLabels")),convertedValue!==this.__showLabels&&(this.__showLabels=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"ShowLabels"}),this.__processShowLabels())}getShowLabels(){return this.__showLabels}__processShowLabels(layout=!0){if(!this.__isAttached)return;if(void 0===this.__showLabels||void 0===this.__labelRange)return;if(!this.__showLabels||null===this.__labelRange||this.__labelRange<=0)return this.__elementLabelContainer.textContent="",this.__labels=[],void(layout&&this.__updateLayout());let labelRadius=this.__proportions.labelRadius;0===labelRadius&&(labelRadius=Math.min(this.getRenderedHeight()||100,this.getRenderedWidth()||100)/5);let labelCount,labelRange=this.__labelRange;labelCount=this.__internalMaxValue===this.__internalMinValue?1:Math.floor((this.__internalMaxValue-this.__internalMinValue)/labelRange)+1;let maxLabelCount=Math.floor(2*labelRadius*Math.PI*((this.__proportions.startAngle-this.__proportions.endAngle)/360)/5)+1;maxLabelCount=maxLabelCount>1?maxLabelCount:1,labelCount>maxLabelCount&&(labelCount=maxLabelCount,labelRange=Math.floor((this.__internalMaxValue-this.__internalMinValue)/maxLabelCount/labelRange)*labelRange);for(let i=0;i<labelCount;i++){let label;i>=this.__labels.length?(label=document.createElementNS("http://www.w3.org/2000/svg","text"),label.classList.add("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-label"),TcHmi.StyleProvider.processFontSize(label,this.__labelFontSize,this.__labelFontSizeUnit),TcHmi.StyleProvider.processFontSize(label,this.__labelFontSize,this.__labelFontSizeUnit),TcHmi.StyleProvider.processFontFamily(label,this.__labelFontFamily),TcHmi.StyleProvider.processFontStyle(label,this.__labelFontStyle),TcHmi.StyleProvider.processFontWeight(label,this.__labelFontWeight),TcHmi.StyleProvider.processFillColor(label,this.__labelColor),this.__elementLabelContainer.appendChild(label)):label=this.__labels[i].element;let labelValue=labelRange*i+this.__internalMinValue;labelValue=parseFloat(labelValue.toPrecision(12));const labelAngle=this.__calcAngleFromValue(labelValue);label.textContent=this.__executeLabelFormatFunction(labelValue),label.setAttribute("x",this.__proportions.outerRadius.toString()),label.setAttribute("y",this.__proportions.outerRadius.toString()),label.setAttribute("transform","rotate("+labelAngle+", "+this.__proportions.outerRadius+", "+this.__proportions.outerRadius+") translate(0, "+-labelRadius+") rotate("+-labelAngle+", "+this.__proportions.outerRadius+", "+this.__proportions.outerRadius+")"),this.__labels[i]={element:label,angle:labelAngle}}for(;this.__labels.length>labelCount;){let removedLabel=this.__labels.pop();removedLabel&&removedLabel.element.parentElement&&removedLabel.element.parentElement.removeChild(removedLabel.element)}layout&&this.__updateLayout()}setLabelFormat(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("LabelFormat"));let resolverInfo=this.__objectResolvers.get("labelFormat");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("LabelFormat")?.type});this.__objectResolvers.set("labelFormat",{resolver,watchCallback:this.__onResolverForLabelFormatWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForLabelFormatWatchCallback)})}__onResolverForLabelFormatWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("labelFormat"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__labelFormat)||(this.__labelFormat=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"LabelFormat"}),this.__processLabelFormat()):TcHmi.Log.Controls.error(this,TcHmiTachometer.#tchmiFQN,{Attribute:"LabelFormat"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getLabelFormat(){return this.__labelFormat}__processLabelFormat(){this.__processShowLabels()}__executeLabelFormatFunction(value){if(void 0!==this.__labelFormat&&null!==this.__labelFormat&&!1!==this.__labelFormat.active){const args=[value];let res=null,f=new TcHmi.Function(this.__labelFormat);return f.executeEx(args,data=>{data.error===TcHmi.Errors.NONE&&void 0!==data.result?res=data.result:TcHmi.Log.Controls.error(this,TcHmiTachometer.#tchmiFQN,`Execution of function=${this.__labelFormat?.fn} failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}),f.destroy(),res}return value.toString()}setShowValueText(valueNew){let convertedValue=TcHmi.ValueConverter.toBoolean(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("ShowValueText")),convertedValue!==this.__showValueText&&(this.__showValueText=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"ShowValueText"}),this.__processShowValueText())}getShowValueText(){return this.__showValueText}__processShowValueText(){this.__showValueText?(TcHmi.StyleProvider.processVisibility(this.__elementValueText,"Visible"),this.__elementUnitText.setAttribute("transform","translate(0, 5)"),this.__elementUnitText.setAttribute("dy","0.3em")):(TcHmi.StyleProvider.processVisibility(this.__elementValueText,"Collapsed"),this.__elementUnitText.setAttribute("transform",""),this.__elementUnitText.setAttribute("dy","0.25em"))}setShowTicks(valueNew){let convertedValue=TcHmi.ValueConverter.toBoolean(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("ShowTicks")),convertedValue!==this.__showTicks&&(this.__showTicks=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"ShowTicks"}),this.__processShowTicks())}getShowTicks(){return this.__showTicks}__processShowTicks(layout=!0){if(void 0===this.__showTicks||void 0===this.__tickDefinition)return;if(!this.__showTicks||null===this.__tickDefinition)return this.__elementMainTickContainer.textContent="",this.__elementSubTickContainer.textContent="",void(this.__isAttached&&layout&&this.__updateLayout());let maxTickCount=Math.floor(2*this.__proportions.tickRadius*Math.PI*((this.__proportions.startAngle-this.__proportions.endAngle)/360)/2)+1;maxTickCount=maxTickCount>1?maxTickCount:1;const ticks=new Map;if(this.__tickDefinition.subTickRange>0){let minorTickCount=Math.floor((this.__internalMaxValue-this.__internalMinValue)/this.__tickDefinition.subTickRange)+1,minorTickRange=this.__tickDefinition.subTickRange;minorTickCount>maxTickCount&&(minorTickCount=maxTickCount,minorTickRange=(this.__internalMaxValue-this.__internalMinValue)/maxTickCount);for(let i=0;i<minorTickCount;i++){const rawTickValue=minorTickRange*i;let tickValue=this.__internalMinValue+rawTickValue;if(tickValue>this.__internalMaxValue)break;ticks.set(tickValue,"sub")}}if(this.__tickDefinition.mainTickRange>0){let majorTickCount=Math.floor((this.__internalMaxValue-this.__internalMinValue)/this.__tickDefinition.mainTickRange)+1,majorTickRange=this.__tickDefinition.mainTickRange;majorTickCount>maxTickCount&&(majorTickCount=maxTickCount,majorTickRange=(this.__internalMaxValue-this.__internalMinValue)/maxTickCount);for(let i=0;i<majorTickCount;i++){const rawTickValue=majorTickRange*i;let tickValue=this.__internalMinValue+rawTickValue;if(tickValue>this.__internalMaxValue)break;ticks.set(tickValue,"main")}}let subTickCounter=0,mainTickCounter=0;for(const[tickValue,tickClass]of ticks){let tick,tickLength,isNew=!1;switch(tickClass){case"sub":subTickCounter>=this.__elementSubTickContainer.childElementCount?(tick=document.createElementNS("http://www.w3.org/2000/svg","line"),this.__elementSubTickContainer.appendChild(tick),isNew=!0):tick=this.__elementSubTickContainer.children[subTickCounter],tickLength=this.__proportions.subTickLength,subTickCounter++;break;case"main":mainTickCounter>=this.__elementMainTickContainer.childElementCount?(tick=document.createElementNS("http://www.w3.org/2000/svg","line"),this.__elementMainTickContainer.appendChild(tick),isNew=!0):tick=this.__elementMainTickContainer.children[mainTickCounter],tickLength=this.__proportions.mainTickLength,mainTickCounter++}isNew&&(tick.classList.add(`TcHmi_Controls_Beckhoff_TcHmiTachometer-template-${tickClass}-tick`),tick.setAttribute("x1","0"),tick.setAttribute("y1","0"),tick.setAttribute("x2","0"),TcHmi.StyleProvider.processStrokeColor(tick,this.__tickColor)),tick.setAttribute("y2","Inside"===this.__subTickPosition?`-${tickLength.toString()}`:tickLength.toString());let transform=`rotate(${this.__calcAngleFromValue(tickValue)}) translate(0, ${-this.__proportions.tickRadius})`;tick.setAttribute("transform",transform)}for(;this.__elementSubTickContainer.childElementCount>subTickCounter;)this.__elementSubTickContainer.removeChild(this.__elementSubTickContainer.lastElementChild);for(;this.__elementMainTickContainer.childElementCount>mainTickCounter;)this.__elementMainTickContainer.removeChild(this.__elementMainTickContainer.lastElementChild);this.__isAttached&&layout&&this.__updateLayout()}setLabelPosition(valueNew){let convertedValue=TcHmi.ValueConverter.toString(valueNew);if(null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("LabelPosition")),convertedValue!==this.__labelPosition){if("Outside"===convertedValue)this.__labelPosition=convertedValue;else this.__labelPosition="Inside";TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"LabelPosition"}),this.__processLabelPosition()}}getLabelPosition(){return this.__labelPosition}__processLabelPosition(){this.__processShowLabels()}setSubTickPosition(valueNew){let convertedValue=TcHmi.ValueConverter.toString(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("SubTickPosition")),convertedValue!==this.__subTickPosition&&(this.__subTickPosition="Outside"===convertedValue?convertedValue:"Inside",TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"SubTickPosition"}),this.__processSubTickPosition())}getSubTickPosition(){return this.__subTickPosition}__processSubTickPosition(){this.__isAttached&&this.__updateLayout()}setLabelRange(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("LabelRange")),convertedValue!==this.__labelRange&&(this.__labelRange=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"LabelRange"}),this.__processLabelRange())}getLabelRange(){return this.__labelRange}__processLabelRange(){this.__processShowLabels()}setValueColor(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("ValueColor"));let resolverInfo=this.__objectResolvers.get("valueColor");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("ValueColor")?.type});this.__objectResolvers.set("valueColor",{resolver,watchCallback:this.__onResolverForValueColorWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForValueColorWatchCallback)})}__onResolverForValueColorWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("valueColor"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__valueColor)||(this.__valueColor=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"ValueColor"}),this.__processValueColor()):TcHmi.Log.Controls.error(this,TcHmiTachometer.#tchmiFQN,{Attribute:"ValueColor"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getValueColor(){return this.__valueColor}__processValueColor(){TcHmi.StyleProvider.processFillColor(this.__elementValueText,this.__valueColor)}setLabelColor(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("LabelColor"));let resolverInfo=this.__objectResolvers.get("labelColor");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("LabelColor")?.type});this.__objectResolvers.set("labelColor",{resolver,watchCallback:this.__onResolverForLabelColorWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForLabelColorWatchCallback)})}__onResolverForLabelColorWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("labelColor"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__labelColor)||(this.__labelColor=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"LabelColor"}),this.__processLabelColor()):TcHmi.Log.Controls.error(this,TcHmiTachometer.#tchmiFQN,{Attribute:"LabelColor"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getLabelColor(){return this.__labelColor}__processLabelColor(){TcHmi.StyleProvider.processFillColor(this.__labels.map(label=>label.element),this.__labelColor)}setUnitColor(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("UnitColor"));let resolverInfo=this.__objectResolvers.get("unitColor");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("UnitColor")?.type});this.__objectResolvers.set("unitColor",{resolver,watchCallback:this.__onResolverForUnitColorWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForUnitColorWatchCallback)})}__onResolverForUnitColorWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("unitColor"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__unitColor)||(this.__unitColor=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"UnitColor"}),this.__processUnitColor()):TcHmi.Log.Controls.error(this,TcHmiTachometer.#tchmiFQN,{Attribute:"UnitColor"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getUnitColor(){return this.__unitColor}__processUnitColor(){TcHmi.StyleProvider.processFillColor(this.__elementUnitText,this.__unitColor)}setTickColor(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("TickColor"));let resolverInfo=this.__objectResolvers.get("tickColor");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("TickColor")?.type});this.__objectResolvers.set("tickColor",{resolver,watchCallback:this.__onResolverForTickColorWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForTickColorWatchCallback)})}__onResolverForTickColorWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("tickColor"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__tickColor)||(this.__tickColor=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"TickColor"}),this.__processTickColor()):TcHmi.Log.Controls.error(this,TcHmiTachometer.#tchmiFQN,{Attribute:"TickColor"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getTickColor(){return this.__tickColor}__processTickColor(){let ticks=this.__elementMainTickContainer.getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-main-tick"),subTicks=this.__elementSubTickContainer.getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-sub-tick");TcHmi.StyleProvider.processStrokeColor(ticks,this.__tickColor),TcHmi.StyleProvider.processStrokeColor(subTicks,this.__tickColor)}setGaugeBackgroundColor(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("GaugeBackgroundColor"));let resolverInfo=this.__objectResolvers.get("gaugeBackgroundColor");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("GaugeBackgroundColor")?.type});this.__objectResolvers.set("gaugeBackgroundColor",{resolver,watchCallback:this.__onResolverForGaugeBackgroundColorWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForGaugeBackgroundColorWatchCallback)})}__onResolverForGaugeBackgroundColorWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("gaugeBackgroundColor"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__gaugeBackgroundColor)||(this.__gaugeBackgroundColor=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"GaugeBackgroundColor"}),this.__processGaugeBackgroundColor()):TcHmi.Log.Controls.error(this,TcHmiTachometer.#tchmiFQN,{Attribute:"GaugeBackgroundColor"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getGaugeBackgroundColor(){return this.__gaugeBackgroundColor}__processGaugeBackgroundColor(){TcHmi.StyleProvider.processFillColor(this.__elementBackgroundCircle,this.__gaugeBackgroundColor)}setNeedleColor(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("NeedleColor"));let resolverInfo=this.__objectResolvers.get("needleColor");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("NeedleColor")?.type});this.__objectResolvers.set("needleColor",{resolver,watchCallback:this.__onResolverForNeedleColorWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForNeedleColorWatchCallback)})}__onResolverForNeedleColorWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("needleColor"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__needleColor)||(this.__needleColor=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"NeedleColor"}),this.__processNeedleColor()):TcHmi.Log.Controls.error(this,TcHmiTachometer.#tchmiFQN,{Attribute:"NeedleColor"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getNeedleColor(){return this.__needleColor}__processNeedleColor(){this.__needleColor?(this.__elementNeedlePointer.style.stroke=TcHmi.StyleProvider.resolveSolidColorAsCssValue(this.__needleColor),this.__elementNeedleBase.style.fill=TcHmi.StyleProvider.resolveSolidColorAsCssValue(this.__needleColor)):(this.__elementNeedlePointer.style.stroke="",this.__elementNeedleBase.style.fill="")}setUnit(valueNew){let convertedValue=TcHmi.ValueConverter.toString(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("Unit")),convertedValue!==this.__unit&&(this.__unit=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Unit"}),this.__processUnit())}getUnit(){return this.__unit}__processUnit(){this.__unit?(this.__elementUnitText.textContent=this.__unit,this.__elementValueText.setAttribute("transform","translate(0, -5)"),this.__elementValueText.setAttribute("dy","")):(this.__elementUnitText.textContent="",this.__elementValueText.setAttribute("transform",""),this.__elementValueText.setAttribute("dy","0.25em"))}setLabelFontSize(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("LabelFontSize")),convertedValue!==this.__labelFontSize&&(this.__labelFontSize=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"LabelFontSize"}),this.__processLabelFontSize())}getLabelFontSize(){return this.__labelFontSize}__processLabelFontSize(){TcHmi.StyleProvider.processFontSize(this.__labels.map(label=>label.element),this.__labelFontSize,this.__labelFontSizeUnit),this.__isAttached&&"Outside"===this.__labelPosition&&this.__updateLayout()}setLabelFontSizeUnit(valueNew){let convertedValue=TcHmi.ValueConverter.toFontSizeUnit(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("LabelFontSizeUnit")),convertedValue!==this.__labelFontSizeUnit&&(this.__labelFontSizeUnit=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"LabelFontSizeUnit"}),this.__processLabelFontSizeUnit())}getLabelFontSizeUnit(){return this.__labelFontSizeUnit}__processLabelFontSizeUnit(){TcHmi.StyleProvider.processFontSize(this.__labels.map(label=>label.element),this.__labelFontSize,this.__labelFontSizeUnit),this.__isAttached&&"Outside"===this.__labelPosition&&this.__updateLayout()}setLabelFontFamily(valueNew){let convertedValue=TcHmi.ValueConverter.toFontFamily(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("LabelFontFamily")),convertedValue!==this.__labelFontFamily&&(this.__labelFontFamily=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"LabelFontFamily"}),this.__processLabelFontFamily())}getLabelFontFamily(){return this.__labelFontFamily}__processLabelFontFamily(){TcHmi.StyleProvider.processFontFamily(this.__labels.map(label=>label.element),this.__labelFontFamily),this.__isAttached&&"Outside"===this.__labelPosition&&this.__updateLayout()}setLabelFontStyle(valueNew){let convertedValue=TcHmi.ValueConverter.toFontStyle(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("LabelFontStyle")),convertedValue!==this.__labelFontStyle&&(this.__labelFontStyle=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"LabelFontStyle"}),this.__processLabelFontStyle())}getLabelFontStyle(){return this.__labelFontStyle}__processLabelFontStyle(){TcHmi.StyleProvider.processFontStyle(this.__labels.map(label=>label.element),this.__labelFontStyle),this.__isAttached&&"Outside"===this.__labelPosition&&this.__updateLayout()}setLabelFontWeight(valueNew){let convertedValue=TcHmi.ValueConverter.toFontWeight(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("LabelFontWeight")),convertedValue!==this.__labelFontWeight&&(this.__labelFontWeight=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"LabelFontWeight"}),this.__processLabelFontWeight())}getLabelFontWeight(){return this.__labelFontWeight}__processLabelFontWeight(){TcHmi.StyleProvider.processFontWeight(this.__labels.map(label=>label.element),this.__labelFontWeight),this.__isAttached&&"Outside"===this.__labelPosition&&this.__updateLayout()}setValueFontSize(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("ValueFontSize")),convertedValue!==this.__valueFontSize&&(this.__valueFontSize=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"ValueFontSize"}),this.__processValueFontSize())}getValueFontSize(){return this.__valueFontSize}__processValueFontSize(){TcHmi.StyleProvider.processFontSize(this.__elementValueText,this.__valueFontSize,this.__valueFontSizeUnit)}setValueFontSizeUnit(valueNew){let convertedValue=TcHmi.ValueConverter.toFontSizeUnit(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("ValueFontSizeUnit")),convertedValue!==this.__valueFontSizeUnit&&(this.__valueFontSizeUnit=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"ValueFontSizeUnit"}),this.__processValueFontSizeUnit())}getValueFontSizeUnit(){return this.__valueFontSizeUnit}__processValueFontSizeUnit(){TcHmi.StyleProvider.processFontSize(this.__elementValueText,this.__valueFontSize,this.__valueFontSizeUnit)}setValueFontFamily(valueNew){let convertedValue=TcHmi.ValueConverter.toFontFamily(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("ValueFontFamily")),convertedValue!==this.__valueFontFamily&&(this.__valueFontFamily=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"ValueFontFamily"}),this.__processValueFontFamily())}getValueFontFamily(){return this.__valueFontFamily}__processValueFontFamily(){TcHmi.StyleProvider.processFontFamily(this.__elementValueText,this.__valueFontFamily)}setValueFontStyle(valueNew){let convertedValue=TcHmi.ValueConverter.toFontStyle(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("ValueFontStyle")),convertedValue!==this.__valueFontStyle&&(this.__valueFontStyle=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"ValueFontStyle"}),this.__processValueFontStyle())}getValueFontStyle(){return this.__valueFontStyle}__processValueFontStyle(){TcHmi.StyleProvider.processFontStyle(this.__elementValueText,this.__valueFontStyle)}setValueFontWeight(valueNew){let convertedValue=TcHmi.ValueConverter.toFontWeight(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("ValueFontWeight")),convertedValue!==this.__valueFontWeight&&(this.__valueFontWeight=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"ValueFontWeight"}),this.__processValueFontWeight())}getValueFontWeight(){return this.__valueFontWeight}__processValueFontWeight(){TcHmi.StyleProvider.processFontWeight(this.__elementValueText,this.__valueFontWeight)}setUnitFontSize(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("UnitFontSize")),convertedValue!==this.__unitFontSize&&(this.__unitFontSize=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"UnitFontSize"}),this.__processUnitFontSize())}getUnitFontSize(){return this.__unitFontSize}__processUnitFontSize(){TcHmi.StyleProvider.processFontSize(this.__elementUnitText,this.__unitFontSize,this.__unitFontSizeUnit)}setUnitFontSizeUnit(valueNew){let convertedValue=TcHmi.ValueConverter.toFontSizeUnit(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("UnitFontSizeUnit")),convertedValue!==this.__unitFontSizeUnit&&(this.__unitFontSizeUnit=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"UnitFontSizeUnit"}),this.__processUnitFontSizeUnit())}getUnitFontSizeUnit(){return this.__unitFontSizeUnit}__processUnitFontSizeUnit(){TcHmi.StyleProvider.processFontSize(this.__elementUnitText,this.__unitFontSize,this.__unitFontSizeUnit)}setUnitFontFamily(valueNew){let convertedValue=TcHmi.ValueConverter.toFontFamily(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("UnitFontFamily")),convertedValue!==this.__unitFontFamily&&(this.__unitFontFamily=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"UnitFontFamily"}),this.__processUnitFontFamily())}getUnitFontFamily(){return this.__unitFontFamily}__processUnitFontFamily(){TcHmi.StyleProvider.processFontFamily(this.__elementUnitText,this.__unitFontFamily)}setUnitFontStyle(valueNew){let convertedValue=TcHmi.ValueConverter.toFontStyle(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("UnitFontStyle")),convertedValue!==this.__unitFontStyle&&(this.__unitFontStyle=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"UnitFontStyle"}),this.__processUnitFontStyle())}getUnitFontStyle(){return this.__unitFontStyle}__processUnitFontStyle(){TcHmi.StyleProvider.processFontStyle(this.__elementUnitText,this.__unitFontStyle)}setUnitFontWeight(valueNew){let convertedValue=TcHmi.ValueConverter.toFontWeight(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("UnitFontWeight")),convertedValue!==this.__unitFontWeight&&(this.__unitFontWeight=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"UnitFontWeight"}),this.__processUnitFontWeight())}getUnitFontWeight(){return this.__unitFontWeight}__processUnitFontWeight(){TcHmi.StyleProvider.processFontWeight(this.__elementUnitText,this.__unitFontWeight)}setBaseAnimationTime(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("BaseAnimationTime")),convertedValue!==this.__baseAnimationTime&&(this.__baseAnimationTime=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"BaseAnimationTime"}))}getBaseAnimationTime(){return this.__baseAnimationTime}setNeedleLength(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("NeedleLength")),convertedValue!==this.__needleLength&&(this.__needleLength=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"NeedleLength"}),this.__processMinValue())}getNeedleLength(){return this.__needleLength}__processNeedleLength(){this.__updateLayout()}setGaugeAlignment(valueNew){const convertedValue=TcHmi.ValueConverter.toEnum(valueNew,{Start:"Start",Center:"Center",End:"End"})??this.getAttributeDefaultValueInternal("GaugeAlignment");convertedValue!==this.__gaugeAlignment&&(this.__gaugeAlignment=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"GaugeAlignment"}),this.__processGaugeAlignment())}getGaugeAlignment(){return this.__gaugeAlignment}__processGaugeAlignment(){this.__updateLayout()}setMarkers(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("Markers"));let resolverInfo=this.__objectResolvers.get("markers");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("Markers")?.type});this.__objectResolvers.set("markers",{resolver,watchCallback:this.__onResolverForMarkersWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForMarkersWatchCallback)})}__onResolverForMarkersWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("markers"),data.error===TcHmi.Errors.NONE?this.__markers===data.value||this.__markers&&tchmi_equal(data.value,Array.from(this.__markers.keys()))||(null===data.value||void 0===data.value?this.__markers=data.value:this.__markers=new Map(data.value.map(marker=>[marker,null])),TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Markers"}),this.__processMarkers()):TcHmi.Log.Controls.error(this,TcHmiTachometer.#tchmiFQN,{Attribute:"Markers"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getMarkers(){return this.__markers?Array.from(this.__markers.keys()):void 0}__processMarkers(){const domLegend=this.__elementTemplateRoot.querySelector(".TcHmi_Controls_Beckhoff_TcHmiTachometer-template-legend");if(domLegend?.remove(),this.__elementLegend=void 0,!this.__markers||0===this.__markers.size)return this.__elementSvg.style.alignSelf="",this.__removeMarkerElements(),void this.__updateLayout();const legend=document.createElement("div");this.__elementLegend=legend,legend.classList.add("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-legend");for(const marker of this.__markers.keys()){if(void 0!==this.__maxValue&&marker.value>this.__maxValue||void 0!==this.__minValue&&marker.value<this.__minValue)continue;const item=document.createElement("div");item.classList.add("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-legend-item");const itemColor=document.createElement("div");itemColor.classList.add("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-legend-item-color"),itemColor.style.backgroundColor=TcHmi.StyleProvider.resolveSolidColorAsCssValue(marker.color);const itemLabel=document.createElement("span");itemLabel.classList.add("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-legend-item-label"),itemLabel.textContent=marker.label,item.append(itemColor,itemLabel),legend.appendChild(item)}this.__elementTemplateRoot.appendChild(legend),this.__elementSvg.style.alignSelf="end",this.__processLegendFontWeight(),this.__processLegendFontSize(),this.__processLegendFontFamily(),this.__processLegendFontStyle(),this.__createMarkerElements(),this.__updateLayout()}__createMarkerElements(){if(this.__removeMarkerElements(),this.__markers&&0!==this.__markers.size){this.__elementMarkersContainer||(this.__elementMarkersContainer=document.createElementNS("http://www.w3.org/2000/svg","g"),this.__elementMarkersContainer.classList.add("TcHmi_Controls_Beckhoff_TcHmiTachometer-template-marker-container"),this.__proportions&&this.__elementMarkersContainer.setAttribute("transform","translate("+this.__proportions.outerRadius+", "+this.__proportions.outerRadius+")"),this.__elementValueText.before(this.__elementMarkersContainer));for(const marker of this.__markers.keys()){if(void 0!==this.__maxValue&&marker.value>this.__maxValue||void 0!==this.__minValue&&marker.value<this.__minValue)continue;const elementMarkerTriangleSvg=document.createElementNS("http://www.w3.org/2000/svg","polygon");"Inside"===this.__labelPosition?elementMarkerTriangleSvg.setAttribute("points","0,0 10,0 5,10"):elementMarkerTriangleSvg.setAttribute("points","0,10 10,10 5,0"),TcHmi.StyleProvider.processStrokeColor(elementMarkerTriangleSvg,marker.color),TcHmi.StyleProvider.processFillColor(elementMarkerTriangleSvg,marker.color),this.__elementMarkersContainer.append(elementMarkerTriangleSvg);const value={svgElementTriangle:elementMarkerTriangleSvg};this.__markers.set(marker,value)}this.__updateMarkers()}}__removeMarkerElements(){if(this.__elementMarkersContainer)for(;this.__elementMarkersContainer.firstChild;)this.__elementMarkersContainer.removeChild(this.__elementMarkersContainer.firstChild)}__updateMarkers(){if(this.__markers)for(const[marker,svg]of this.__markers){if(void 0!==this.__maxValue&&marker.value>this.__maxValue||void 0!==this.__minValue&&marker.value<this.__minValue)continue;let transformTriangle;transformTriangle="Inside"===this.__labelPosition?" rotate("+this.__calcAngleFromValue(marker.value)+" ) translate(-5, "+(5-this.__proportions.outerRadius)+")":" rotate("+this.__calcAngleFromValue(marker.value)+" ) translate(-5, "+-this.__proportions.markerRadius+")",svg?.svgElementTriangle?.setAttribute("transform",transformTriangle)}}setLegendFontFamily(valueNew){let convertedValue=TcHmi.ValueConverter.toFontFamily(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("LegendFontFamily")),convertedValue!==this.__legendFontFamily&&(this.__legendFontFamily=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"LegendFontFamily"}),this.__processLegendFontFamily())}getLegendFontFamily(){return this.__legendFontFamily}__processLegendFontFamily(){const legend=this.__elementTemplateRoot.querySelector(".TcHmi_Controls_Beckhoff_TcHmiTachometer-template-legend");if(!legend)return;const labels=legend.querySelectorAll(".TcHmi_Controls_Beckhoff_TcHmiTachometer-template-legend-item-label");TcHmi.StyleProvider.processFontFamily(labels,this.__legendFontFamily),this.__updateLayout()}setLegendFontSize(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("LegendFontSize")),convertedValue!==this.__legendFontSize&&(this.__legendFontSize=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"LegendFontSize"}),this.__processLegendFontSize())}getLegendFontSize(){return this.__legendFontSize}__processLegendFontSize(){const legend=this.__elementTemplateRoot.querySelector(".TcHmi_Controls_Beckhoff_TcHmiTachometer-template-legend");if(!legend)return;const labels=legend.querySelectorAll(".TcHmi_Controls_Beckhoff_TcHmiTachometer-template-legend-item-label");TcHmi.StyleProvider.processFontSize(labels,this.__legendFontSize,"px"),this.__updateLayout()}getLegendFontSizeUnit(){return"px"}setLegendFontStyle(valueNew){let convertedValue=TcHmi.ValueConverter.toFontStyle(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("LegendFontStyle")),convertedValue!==this.__legendFontStyle&&(this.__legendFontStyle=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"LegendFontStyle"}),this.__processLegendFontStyle())}getLegendFontStyle(){return this.__legendFontStyle}__processLegendFontStyle(){const legend=this.__elementTemplateRoot.querySelector(".TcHmi_Controls_Beckhoff_TcHmiTachometer-template-legend");if(!legend)return;const labels=legend.querySelectorAll(".TcHmi_Controls_Beckhoff_TcHmiTachometer-template-legend-item-label");TcHmi.StyleProvider.processFontStyle(labels,this.__legendFontStyle),this.__updateLayout()}setLegendFontWeight(valueNew){let convertedValue=TcHmi.ValueConverter.toFontWeight(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("LegendFontWeight")),convertedValue!==this.__legendFontWeight&&(this.__legendFontWeight=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"LegendFontWeight"}),this.__processLegendFontWeight())}getLegendFontWeight(){return this.__legendFontWeight}__processLegendFontWeight(){const legend=this.__elementTemplateRoot.querySelector(".TcHmi_Controls_Beckhoff_TcHmiTachometer-template-legend");if(!legend)return;const labels=legend.querySelectorAll(".TcHmi_Controls_Beckhoff_TcHmiTachometer-template-legend-item-label");TcHmi.StyleProvider.processFontWeight(labels,this.__legendFontWeight),this.__updateLayout()}setLegendLabelColor(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("LegendLabelColor"));let resolverInfo=this.__objectResolvers.get("legendLabelColor");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("LegendLabelColor")?.type});this.__objectResolvers.set("legendLabelColor",{resolver,watchCallback:this.__onResolverForLegendLabelColorWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForLegendLabelColorWatchCallback)})}__onResolverForLegendLabelColorWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("legendLabelColor"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__legendLabelColor)||(this.__legendLabelColor=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"LegendLabelColor"}),this.__processLegendLabelColor()):TcHmi.Log.Controls.error(this,TcHmiTachometer.#tchmiFQN,{Attribute:"LegendLabelColor"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getLegendLabelColor(){return this.__legendLabelColor}__processLegendLabelColor(){const legendItems=this.__elementLegend?.querySelectorAll(".TcHmi_Controls_Beckhoff_TcHmiTachometer-template-legend-item");if(!legendItems)return;const elementLabels=Array.from(legendItems).map(item=>item.querySelector(".TcHmi_Controls_Beckhoff_TcHmiTachometer-template-legend-item-label"));elementLabels&&TcHmi.StyleProvider.processTextColor(elementLabels,this.__legendLabelColor)}}})();TcHmi.Controls.registerEx("TcHmiTachometer","TcHmi.Controls.Beckhoff",TcHmiTachometer,{injectInGlobalObject:!0});export{TcHmiTachometer as Control}; |