Skip to content

Commit

Permalink
LIMS-117: Fix grid scan coordinates for snaked scans
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Williams committed Jan 4, 2024
1 parent 3284810 commit 88a7c7d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions client/src/js/modules/dc/views/gridplot.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ define(['jquery', 'marionette',
ystep = k % this.grid.get('STEPS_Y')

if (this.grid.get('SNAKED') === 1) {
if (xstep % 2 === 1) ystep = (this.grid.get('STEPS_Y')-1) - ystep
}
if (xstep % 2 === 1) ystep = (this.grid.get('STEPS_Y')-1) - ystep
}

x = xstep * sw + sw/2 + (this.offset_w*this.scale)/2
y = ystep * sh + sh/2 + (this.offset_h*this.scale)/2
Expand All @@ -453,7 +453,7 @@ define(['jquery', 'marionette',
ystep = Math.floor(k / this.grid.get('STEPS_X'))

if (this.grid.get('SNAKED') === 1) {
if (ystep % 2 === 1) xstep = (this.grid.get('STEPS_X')-1) - xstep
if (ystep % 2 === 1) xstep = (this.grid.get('STEPS_X')-1) - xstep
}

x = xstep * sw + sw/2 + (this.offset_w*this.scale)/2
Expand Down Expand Up @@ -500,9 +500,15 @@ define(['jquery', 'marionette',
if (this.vertical) {
xp = Math.floor(pos / this.grid.get('STEPS_Y'))
yp = pos % this.grid.get('STEPS_Y')
if (this.grid.get('SNAKED') === 1) {
if (xp % 2 === 1) yp = (this.grid.get('STEPS_Y')-1) - yp
}
} else {
xp = pos % this.grid.get('STEPS_X')
yp = Math.floor(pos / this.grid.get('STEPS_X'))
if (this.grid.get('SNAKED') === 1) {
if (yp % 2 === 1) xp = (this.grid.get('STEPS_X')-1) - xp
}
}

var rad = Math.PI/180
Expand Down

0 comments on commit 88a7c7d

Please sign in to comment.