Files
ai/web/public/charting_library/bundles/line-tool-disjoint-channel.1029215755374bd9b1bf.js

2 lines
3.2 KiB
JavaScript

"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[9581],{56348:(e,t,i)=>{i.r(t),i.d(t,{LineToolDisjointChannel:()=>h});var s=i(50151),n=i(41414),r=i(65045),p=i(78176),o=i(87465),l=i(43337),a=i(22613);class h extends n.LineDataSource{constructor(e,t,s,n){super(e,t??h.createProperties(e.backgroundTheme().spawnOwnership()),s,n),this.version=1,this._hasEditableCoordinates=new a.WatchedValue(!1),Promise.all([i.e(6290),i.e(986),i.e(6668),i.e(1583)]).then(i.bind(i,50936)).then((e=>{this._setPaneViews([new e.DisjointChannelPaneView(this,this._model)])}))}pointsCount(){return 3}name(){return"Disjoint Channel"}snapTo45DegreesAvailable(){return!0}addPoint(e,t,i){return this._snapTo45DegreesApplicable(t)&&2===this.points().length&&this.snapPoint45Degree(e,this.points()[this.points().length-2]),super.addPoint(e)}setLastPoint(e,t){return this._snapTo45DegreesApplicable(t)&&2===this.points().length&&this.snapPoint45Degree(e,this.points()[this.points().length-2]),super.setLastPoint(e)}setPoint(e,t,i,s){const n=.5*(this._points[1].price+this._points[2].price);if(this._snapTo45DegreesApplicable(i)&&1===e){const e=0;this.snapPoint45Degree(t,this.points()[e])}if(e<3&&super.setPoint(e,t),0!==e&&2!==e){if(1===e){const e=this._points[1].price-n;this._points[2].price=this._points[1].price-2*e}else if(3===e){const e=t.price-this._points[2].price;this._points[0].price=this._points[1].price-e,this._points[0].index=t.index,this._points[0].interval=this._model.mainSeries().interval()}this._normalizePoints()}}getPoint(e){if(e<3)return super.getPoint(e);const t=this._points[0].price-this._points[2].price;return{index:this._points[0].index,price:this._points[1].price-t}}canHasAlert(){return!0}template(){const e=super.template();return e.labelText=this.properties().childs().labelText.value(),e}static createProperties(e,t){const i=new p.DefaultProperty({defaultName:"linetooldisjointangle",state:t,theme:e});return this._configureProperties(i),i}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().labelText.setValue(e.labelText??"")}_getAlertPlots(){const e=this._points[0],t=this._points[1],i=[];e.index<=t.index?(i.push(e),i.push(t)):(i.push(t),i.push(e));const s=this._points[2];s.time=t.time,s.index=t.index;const n={price:s.price+(t.price-e.price),time:e.time,index:e.index},r=[];let p,l,a,h;s.index<=n.index?(r.push(s),r.push(n)):(r.push(n),r.push(s)),i[0].price>r[0].price?(p=i,l=r):r[0].price>i[0].price||r[1].price>i[1].price?(p=r,l=i):(p=i,l=r);const c=this.properties().childs().extendLeft.value(),d=this.properties().childs().extendRight.value();return e.index<=t.index?(a=c,h=d):(a=d,h=c),[this._linePointsToAlertPlot(p,"Upper",a,h),this._linePointsToAlertPlot(l,"Lower",a,h)].filter(o.notNull)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,96662))).GeneralTrendFiguresDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),
e.hasChild("labelText")||e.addChild("labelText",new l.Property("")),e.addExcludedKey("labelText",1),e.addChild("textsColors",new r.LineToolColorsProperty([(0,s.ensureDefined)(e.child("labelTextColor"))]))}}}}]);