"use strict";(self.webpackChunkfirebird=self.webpackChunkfirebird||[]).push([[5393],{5393:(L,z,P)=>{P.r(z),P.d(z,{TRatioPlotPainter:()=>w});var T=P(467),c=P(6998),F=P(675),O=P(9025),G=P(2695);const E="upper_pad",m="lower_pad",x="top_pad";class w extends F.JW{setGridsRange(r,i,n,e,s){const t=this.getObject();if(r===i){const a=this.getPadPainter()?.findPainterFor(t.fLowerPad,m,c.clTPad)?.getFramePainter()?.x_handle;if(!a)return;0===r?(r=a.full_min,i=a.full_max):(r=a.scale_min,i=a.scale_max)}t.fGridlines.forEach(a=>{a.fX1=r,a.fX2=i});const o=Math.min(t.fGridlines.length,t.fGridlinePositions.length);for(let a=0;a<o;++a){const _=t.fGridlinePositions[a],f=t.fGridlines[a];"ignorey"!==n&&(f.$do_not_draw=n!==e&&(_<n||_>e),f.fY1=f.fY2=_),s?.findPainterFor(f)?.redraw()}}configureInteractive(){const r=this.getObject(),i=this.getPadPainter(),n=i.findPainterFor(r.fUpperPad,E,c.clTPad),e=n?.getFramePainter(),s=i.findPainterFor(r.fLowerPad,m,c.clTPad),t=s?.getFramePainter();!n||!s||(s.forEachPainterInPad(o=>{(0,c.isFunc)(o?.testEditable)&&o.testEditable(!1)}),this.setGridsRange(t.scale_xmin,t.scale_xmax,t.scale_ymin,t.scale_ymax,s),(!n._ratio_interactive||!s._ratio_interactive)&&(n._ratio_interactive=!0,s._ratio_interactive=!0,e.o_zoom=e.zoom,e._ratio_low_fp=t,e._ratio_painter=this,e.zoom=function(o,a,_,f,p,d){return this.o_zoom(o,a,_,f,p,d).then(h=>(this._ratio_painter.setGridsRange(e.scale_xmin,e.scale_xmax,"ignory"),this._ratio_low_fp.o_zoom(e.scale_xmin,e.scale_xmax).then(()=>h)))},e.o_sizeChanged=e.sizeChanged,e.sizeChanged=function(){this.o_sizeChanged(),this._ratio_low_fp.fX1NDC=this.fX1NDC,this._ratio_low_fp.fX2NDC=this.fX2NDC,this._ratio_low_fp.o_sizeChanged()},t.o_zoom=t.zoom,t._ratio_up_fp=e,t._ratio_painter=this,t.zoom=function(o,a,_,f,p,d){return o===a?(o=e.xmin,a=e.xmax):(o<e.xmin&&(o=e.xmin),a>e.xmax&&(a=e.xmax)),this._ratio_painter.setGridsRange(o,a,_,f),this._ratio_up_fp.o_zoom(o,a).then(()=>this.o_zoom(o,a,_,f,p,d))},t.o_sizeChanged=t.sizeChanged,t.sizeChanged=function(){this.o_sizeChanged(),this._ratio_up_fp.fX1NDC=this.fX1NDC,this._ratio_up_fp.fX2NDC=this.fX2NDC,this._ratio_up_fp.o_sizeChanged()}))}redrawOld(){var r=this;return(0,T.A)(function*(){const i=r.getObject(),n=r.getPadPainter(),e=n.findPainterFor(i.fTopPad,x,c.clTPad),s=n.getRootPad(),t=0===s.fFrameFillStyle?1:0,o=s.fTickx||t,a=s.fTicky||t;e?.disablePadDrawing();const _=n.findPainterFor(i.fUpperPad,E,c.clTPad),f=_?.getMainPainter(),p=_?.getFramePainter(),d=n.findPainterFor(i.fLowerPad,m,c.clTPad),h=d?.getMainPainter(),C=d?.getFramePainter();let D=Promise.resolve(!0);if(_&&f&&p&&C&&!_._ratio_configured){_._ratio_configured=!0,f.options.Axis=0;const u=f.getHisto();u.fYaxis.$use_top_pad=!0,u.fXaxis.fLabelSize=0,u.fXaxis.fTitle="",_.getRootPad().fTickx=o,_.getRootPad().fTicky=a,D=_.redrawPad()}return D.then(()=>{if(!d||!h||!C||!p||d._ratio_configured)return r;d._ratio_configured=!0,h.options.Axis=0;const u=h.getHisto();u.fXaxis.fTitle="x",u.fXaxis.$use_top_pad=!0,u.fYaxis.$use_top_pad=!0,d.getRootPad().fTickx=o,d.getRootPad().fTicky=a;const k=[];return i.fGridlinePositions.length>0&&i.fGridlines.length<i.fGridlinePositions.length&&i.fGridlinePositions.forEach(g=>{let v=!1;if(i.fGridlines.forEach(l=>{l.fY1===l.fY2&&Math.abs(l.fY1-g)<1e-6&&(v=!0)}),!v){const l=(0,c.create)(c.clTLine);l.fX1=p.scale_xmin,l.fX2=p.scale_xmax,l.fY1=l.fY2=g,l.fLineStyle=2,i.fGridlines.push(l),k.push(G.TLinePainter.draw(d,l))}}),Promise.all(k).then(()=>C.zoomSingle("x",p.scale_xmin,p.scale_xmax)).then(g=>!!g||d.redrawPad()).then(()=>r)})})()}redraw(){var r=this;return(0,T.A)(function*(){const i=r.getObject(),n=r.getPadPainter();if(void 0===r.$oldratio&&(r.$oldratio=!!n.findPainterFor(i.fTopPad,x,c.clTPad)),n.$userInteractive=()=>r.configureInteractive(),r.$oldratio)return r.redrawOld();const e=n.getRootPad(),s=0===e.fFrameFillStyle?1:0,t=e.fTickx||s,o=e.fTicky||s;return i.fTopPad.$disable_drawing=!0,i.fUpperPad.$ratio_pad="up",i.fUpperPad.fTickx=t,i.fUpperPad.fTicky=o,i.fLowerPad.$ratio_pad="low",i.fLowerPad.fTickx=t,i.fLowerPad.fTicky=o,r})()}static draw(r,i,n){return(0,T.A)(function*(){const e=new w(r,i,n);return(0,O.ensureTCanvas)(e,!1).then(()=>e.redraw())})()}}}}]);