File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
client/src/components/geoJS/layers Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -202,8 +202,16 @@ export default class MeasureToolLayer extends BaseTextLayer<TextData> {
202202 }
203203 }
204204
205- setScaledDimensions ( width : number , height : number ) {
206- super . setScaledDimensions ( width , height ) ;
205+ setScaledDimensions ( scaledWidth : number , scaledHeight : number ) {
206+ // Get the frequency represented by the current ruler
207+ const height = Math . max ( this . scaledHeight , this . spectroInfo . height ) ;
208+ const frequency = height - this . yValue >= 0
209+ ? ( ( height - this . yValue ) * ( this . spectroInfo . high_freq - this . spectroInfo . low_freq ) ) / height / 1000 + this . spectroInfo . low_freq / 1000
210+ : - 1 ;
211+ // Get the new yValue needed based on the updated scaled height
212+ const newY = scaledHeight - ( ( frequency - ( this . spectroInfo . low_freq / 1000 ) ) * scaledHeight * 1000 ) / ( this . spectroInfo . high_freq - this . spectroInfo . low_freq ) ;
213+ this . yValue = newY ;
214+ super . setScaledDimensions ( scaledWidth , scaledHeight ) ;
207215 this . clearRulerLayer ( ) ;
208216 if ( this . rulerOn ) {
209217 this . enableDrawing ( ) ;
You can’t perform that action at this time.
0 commit comments