Skip to content

Commit 90fb2c3

Browse files
committed
IRSA-2894: orient N-E correctly in thumbnail view
1 parent 2fc2a29 commit 90fb2c3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/firefly/js/visualize/ui/ThumbnailView.jsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,21 @@ function makeDrawing(pv,width,height) {
223223
//const wptE2= makeWorldPt(wptC.getLon()+(Math.abs(cdelt1)/thumbZoomFact)*(arrowLength/2), wptC.getLat());
224224
const wptE1= wptC;
225225
const wpt1= wptC;
226+
const wpt3= makeWorldPt(wptC.getLon() +
227+
(Math.abs(cdelt1)/(Math.cos(wptC.getLat()*Math.PI/180.)/thumbZoomFact)*(arrowLength/1.6)),
228+
wptC.getLat());
229+
226230

227231
const sptC = cc.getScreenCoords(wptC);
228232
const sptN = cc.getScreenCoords(wpt2);
229233
if (!sptC || !sptN) return null;
230-
const [x, y] = [(sptN.y - sptC.y) + sptC.x, (-sptN.x + sptC.x)+sptC.y];
234+
const spt3= cc.getScreenCoords(wpt3);
235+
// don't use spt3 because of funny effects near the celestial poles
236+
// the sign of the cross product of compass vectors tells us if the image is mirror-reversed from the sky
237+
const cross_product= (spt3.x - sptC.x)*(sptN.y - sptC.y) -
238+
(spt3.y - sptC.y)*(sptN.x - sptC.x);
239+
const [x, y] = [Math.sign(cross_product)*(sptN.y - sptC.y) + sptC.x,
240+
Math.sign(cross_product)*(-sptN.x + sptC.x)+sptC.y];
231241
const wptE2 = cc.getWorldCoords(makeScreenPt(x, y));
232242

233243
const spt1= cc.getDeviceCoords(wpt1, thumbZoomFact, thumbnailTrans);

0 commit comments

Comments
 (0)