Skip to content

Commit c1ead04

Browse files
authored
Merge pull request #132 from Caltech-IPAC/dm-7068-bugs2
DM-7068: bug list
2 parents e6f7210 + b0ce8e9 commit c1ead04

File tree

13 files changed

+72
-33
lines changed

13 files changed

+72
-33
lines changed

src/firefly/js/drawingLayers/Catalog.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,17 @@ function makeHighlightDeferred(drawLayer,plotId,screenPt) {
114114
var done= false;
115115
var idx= 0;
116116
const maxChunk= 1000;
117-
var minDist = Number.MAX_SAFE_INTEGER;
117+
var minDist = 20;
118118
const {data}= drawLayer.drawData;
119119
const {tableRequest}= drawLayer;
120-
var closestIdx;
120+
var closestIdx= -1;
121121
const plot= primePlot(visRoot(),plotId);
122122
const id= window.setInterval( () => {
123123
if (done) {
124124
window.clearInterval(id);
125-
dispatchTableHighlight(drawLayer.drawLayerId,closestIdx,tableRequest);
125+
if (closestIdx > -1) {
126+
dispatchTableHighlight(drawLayer.drawLayerId,closestIdx,tableRequest);
127+
}
126128
}
127129

128130
var dist;

src/firefly/js/ui/DropDownMenu.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ import './DropDownMenu.css';
1010
const computePosition= (tgtX,tgtY) => ({x:tgtX,y:tgtY+18});
1111

1212
function placeDropDown(e,x,y) {
13-
var {scrollX,scrollY}= window;
1413
var pos= computePosition(x,y);
1514

16-
var left= pos.x - 10 - scrollX;
15+
var left= pos.x - 10;
1716
if (left<5) {
1817
left= 5;
1918
}
2019
e.style.left= left +'px';
21-
e.style.top= (pos.y + 10 - scrollY)+'px';
20+
e.style.top= (pos.y + 10)+'px';
2221
e.style.visibility='visible';
2322
}
2423

src/firefly/js/ui/PopupPanelHelper.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ const inRangeCheck = function(x, y, xIncrease, yIncrease) {
3333

3434
var getAbsoluteX= function(ev) {
3535
if (ev.type===MOUSE_EV) {
36-
return ev.clientX+document.scrollLeft;
36+
return ev.clientX+window.scrollX;
3737
}
3838
if (ev.type===TOUCH_EV) {
39-
return ev.targetTouches[0].clientX+document.scrollLeft;
39+
return ev.targetTouches[0].clientX+window.scrollX;
4040
}
4141
return 0;
4242
};
4343

4444

4545
var getAbsoluteY= function(ev) {
4646
if (ev.type===MOUSE_EV) {
47-
return ev.clientY+document.scrollLeft;
47+
return ev.clientY+window.scrollY;
4848
}
4949
if (ev.type===TOUCH_EV) {
50-
return ev.targetTouches[0].clientY+window.scrollLeft;
50+
return ev.targetTouches[0].clientY+window.scrollY;
5151
}
5252
return 0;
5353
};
@@ -74,12 +74,12 @@ const doMove= function(ctx, x, y) {
7474
var yDiff= y-ctx.originalMouseY;
7575
var newX=ctx.originalX+xDiff;
7676
var newY=ctx.originalY+yDiff;
77-
if (newX+ctx.popup.offsetWidth>window.innerWidth ) {
78-
newX= window.innerWidth-ctx.popup.offsetWidth;
77+
if (newX+ctx.popup.offsetWidth>window.innerWidth+ window.scrollX ) {
78+
newX= window.innerWidth+window.scrollX-ctx.popup.offsetWidth;
7979
}
8080
if (newX<2) newX=2;
81-
if (newY+ctx.popup.offsetHeight>window.innerHeight ) {
82-
newY= window.innerHeight-ctx.popup.offsetHeight;
81+
if (newY+ctx.popup.offsetHeight>window.innerHeight + window.scrollY ) {
82+
newY= window.innerHeight+window.scrollY-ctx.popup.offsetHeight;
8383
}
8484
if (newY<2) newY=2;
8585

@@ -117,7 +117,7 @@ export const getPopupPosition= function(e,layoutType) {
117117
break;
118118
case 'TOP_LEFT' :
119119
left= 2 + window.scrollX;
120-
top= document.scrollY+ 3;
120+
top= window.scrollY+ 3;
121121
break;
122122

123123
case 'TOP_EDGE_CENTER' :
@@ -340,6 +340,8 @@ function findRegion(popup,titleBar,mx, my) {
340340

341341
var retval= PopupRegion.NONE;
342342

343+
mx+= window.scrollX;
344+
my+= window.scrollY;
343345
var x= getAbsoluteLeft(popup);
344346
var y= getAbsoluteTop(popup);
345347
var w= popup.offsetWidth;

src/firefly/js/visualize/ImagePlotCntlr.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ export function dispatchRestoreDefaults({plotId, dispatcher= flux.process}) {
409409
* @param {boolean} useContextModifications it true the request will be modified to use preferences, rotation, etc
410410
* should only be false when it is doing a 'restore to defaults' type plot
411411
* @param {boolean} attributes the are added to the plot
412+
* @param {object} pvOptions parameter specific to the plotView, only read the first time per plot id
412413
* @param {function} dispatcher only for special dispatching uses such as remote
413414
* @param viewerId
414415
*/
@@ -417,10 +418,11 @@ export function dispatchPlotImage({plotId,wpRequest, threeColor=isArray(wpReques
417418
useContextModifications= true,
418419
dispatcher= flux.process,
419420
attributes={},
421+
pvOptions= {},
420422
viewerId} ) {
421423

422424
dispatcher({ type: PLOT_IMAGE,
423-
payload: {plotId,wpRequest, threeColor, addToHistory,
425+
payload: {plotId,wpRequest, threeColor, addToHistory, pvOptions,
424426
attributes, useContextModifications,viewerId}});
425427
}
426428

@@ -430,7 +432,7 @@ export function dispatchPlotImage({plotId,wpRequest, threeColor=isArray(wpReques
430432
* @param wpRequestAry
431433
* @param {function} dispatcher only for special dispatching uses such as remote
432434
*/
433-
export function dispatchPlotGroup({wpRequestAry, dispatcher= flux.process}) {
435+
export function dispatchPlotGroup({wpRequestAry, pvOptions= {}, dispatcher= flux.process}) {
434436
dispatcher( { type: PLOT_IMAGE, payload: { wpRequestAry} });
435437
}
436438

src/firefly/js/visualize/PlotImageTask.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function ensureWPR(inVal) {
4949
const getFirstReq= (wpRAry) => isArray(wpRAry) ? wpRAry.find( (r) => r?true:false) : wpRAry;
5050

5151

52-
function makeSinglePlotPayload({wpRequest,plotId, threeColor, viewerId, attributes,
52+
function makeSinglePlotPayload({wpRequest,plotId, threeColor, viewerId, attributes, pvOptions= {},
5353
addToHistory= false,useContextModifications= true} ) {
5454
wpRequest= ensureWPR(wpRequest);
5555

@@ -68,7 +68,7 @@ function makeSinglePlotPayload({wpRequest,plotId, threeColor, viewerId, attribut
6868
const payload= { plotId:req.getPlotId(),
6969
plotGroupId:req.getPlotGroupId(),
7070
groupLocked:req.isGroupLocked(),
71-
attributes, viewerId, addToHistory, useContextModifications, threeColor};
71+
attributes, viewerId, pvOptions, addToHistory, useContextModifications, threeColor};
7272

7373
if (threeColor) {
7474
if (isArray(wpRequest)) {
@@ -107,6 +107,7 @@ function makePlotImageAction(rawAction) {
107107
wpRequestAry:ensureWPR(wpRequestAry),
108108
viewerId:rawAction.payload.viewerId,
109109
attributes:rawAction.payload.attributes,
110+
pvOptions: rawAction.pvOptions,
110111
threeColor:false,
111112
addToHistory:false,
112113
useContextModifications:true,

src/firefly/js/visualize/draw/DrawOp.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
import PointDataObj, {POINT_DATA_OBJ} from './PointDataObj.js';
77
import SelectBox from './SelectBox.js';
88
import ShapeDataObj from './ShapeDataObj.js';
9+
import FootprintObj from './FootprintObj.js';
910
import DirectionArrowDrawObj from './DirectionArrowDrawObj.js';
1011
import MarkerFootprintObj from './MarkerFootprintObj.js';
1112

1213
export var drawTypes= {
1314
[POINT_DATA_OBJ] : PointDataObj.draw,
1415
[SelectBox.SELECT_BOX] : SelectBox.draw,
16+
[FootprintObj.FOOTPRINT_OBJ] : FootprintObj.draw,
1517
[DirectionArrowDrawObj.DIR_ARROW_DRAW_OBJ] : DirectionArrowDrawObj.draw,
1618
[ShapeDataObj.SHAPE_DATA_OBJ] : ShapeDataObj.draw,
1719
[MarkerFootprintObj.MARKER_DATA_OBJ] : MarkerFootprintObj.draw

src/firefly/js/visualize/iv/ImageViewerLayout.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export class ImageViewerLayout extends Component {
9292
const ownerCandidate= findMouseOwner(list,primePlot(plotView),screenPt); // see if anyone can own that mouse
9393
this.mouseOwnerLayerId = DOWN.is(mouseState) && ownerCandidate ? ownerCandidate.drawLayerId : null; // can only happen on mouseDown
9494
if (this.mouseOwnerLayerId) {
95+
if (DOWN.is(mouseState)) dispatchChangeActivePlotView(plotId);
9596
const dl= getLayer(drawLayersAry,this.mouseOwnerLayerId);
9697
fireMouseEvent(dl,mouseState,mouseStatePayload);
9798
}

src/firefly/js/visualize/projection/Projection.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,13 @@ const projTypes= {
121121
}
122122
};
123123

124+
const getProjTypeInfo= (header) => projTypes[get(header,'maptype', UNRECOGNIZED)];
125+
126+
127+
const translateProjectionName= (header) => getProjTypeInfo(header).name;
128+
const isImplemented= (header) => getProjTypeInfo(header).implemented;
129+
const isWrappingProjection= (header) => getProjTypeInfo(header).wrapping;
124130

125-
const translateProjectionName= (maptype) => get(projTypes, [maptype,'name'],'UNRECOGNIZED');
126-
const isImplemented= (header) => get(header, ['maptype.implemented'],false);
127-
const isWrappingProjection= (header) => get(header, ['maptype.wrapping'],false);
128131

129132

130133

src/firefly/js/visualize/reducer/HandlePlotCreation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function preNewPlotPrep(plotViewAry,action) {
143143
return pv ? clone(pv, { plottingStatus:'Plotting...',
144144
plots:[],
145145
primeIdx:-1
146-
}) : makePlotView(plotId, req,null);
146+
}) : makePlotView(plotId, req,action.payload.pvOptions);
147147
});
148148

149149
return unionBy(pvChangeAry,plotViewAry, 'plotId');

src/firefly/js/visualize/reducer/PlotView.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export default {replacePlots,
8484
* @param {object} pvOptions options for this plot view todo- define what pvOptions is, somewhere
8585
* @return {PlotView}
8686
*/
87-
export function makePlotView(plotId, req, pvOptions) {
87+
export function makePlotView(plotId, req, pvOptions= {}) {
8888
var pv= {
8989
plotId, // should never change
9090
plotGroupId: req.getPlotGroupId(), //should never change
@@ -155,7 +155,7 @@ function createPlotViewContextData(req) {
155155
//todo - this function should determine which menuItem are visible and which are hidden
156156
// for now just return the default
157157
function makeMenuItemKeys(req,pvOptions,defMenuItemKeys) {
158-
return defMenuItemKeys;
158+
return Object.assign({},defMenuItemKeys, pvOptions.menuItemKeys);
159159
}
160160

161161
export const initScrollCenterPoint= (pv) => updatePlotViewScrollXY(pv,findScrollPtForCenter(pv));

src/firefly/js/visualize/saga/CoverageWatcher.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,13 @@ function updateCoverageWithData(table, options, tbl_id, allRowsTable, decimatedT
236236
}
237237
else {
238238
dispatchPlotImage({
239-
wpRequest,
240-
attributes:{
241-
[COVERAGE_TARGET]: centralPoint,
242-
[COVERAGE_RADIUS]: maxRadius,
243-
[COVERAGE_TABLE]: tbl_id
244-
}}
239+
wpRequest,
240+
attributes: {
241+
[COVERAGE_TARGET]: centralPoint,
242+
[COVERAGE_RADIUS]: maxRadius,
243+
[COVERAGE_TABLE]: tbl_id
244+
}
245+
}
245246
);
246247
}
247248
}

src/firefly/js/visualize/saga/ImageMetaDataWatcher.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,19 @@ function replot(reqAry, threeReqAry, activeId, viewerId, dataId) {
207207

208208
// prepare stand plot
209209
const wpRequestAry= makePlottingList(reqAry);
210-
if (!isEmpty(wpRequestAry)) dispatchPlotGroup({wpRequestAry});
210+
if (!isEmpty(wpRequestAry)) dispatchPlotGroup({wpRequestAry, pvOptions: {menuItemKeys:{imageSelect : false}}});
211211
if (activeId) dispatchChangeActivePlotView(activeId);
212212

213213

214214
// prepare three color Plot
215215
if (plottingThree) {
216216
const plotThreeReqAry= make3ColorPlottingList(threeReqAry);
217217
if (!isEmpty(plotThreeReqAry)) {
218-
dispatchPlotImage({plotId:threeCPlotId, wpRequest:plotThreeReqAry, threeColor:true});
218+
dispatchPlotImage(
219+
{
220+
plotId:threeCPlotId, wpRequest:plotThreeReqAry, threeColor:true,
221+
pvOptions: {menuItemKeys:{imageSelect : false}}
222+
});
219223
}
220224
}
221225

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import { getDlAry } from '../DrawLayerCntlr.js';
3232
import WebGrid from '../../drawingLayers/WebGrid.js';
3333
import {showRegionFileUploadPanel} from '../region/RegionFileUploadView.jsx';
3434
import {MarkerDropDownView} from './MarkerDropDownView.jsx';
35+
import {dispatchShowDropDown} from '../../core/LayoutCntlr.js';
36+
import {showImageSelPanel} from './ImageSelectPanel.jsx';
3537

3638

3739
//===================================================
@@ -61,6 +63,7 @@ import FLIP_Y from 'html/images/icons-2014/Mirror.png';
6163
import RECENTER from 'html/images/icons-2014/RecenterImage.png';
6264
import LOCKED from 'html/images/icons-2014/BkgLocked.png';
6365
import UNLOCKED from 'html/images/icons-2014/BkgUnlocked.png';
66+
import NEW_IMAGE from 'html/images/icons-2014/28x28_FITS_NewImage.png';
6467

6568
import COLOR from 'html/images/icons-2014/28x28_ColorPalette.png';
6669
import STRETCH from 'html/images/icons-2014/28x28_Log.png';
@@ -121,6 +124,10 @@ export function VisToolbarViewWrapper({visRoot,toolTip,dlCount, messageUnder}) {
121124

122125
}
123126

127+
128+
129+
//onClick={dispatchShowDropDown.bind(null, {view: 'ImageSelectDropDownCmd'})}/>}
130+
124131
VisToolbarViewWrapper.propTypes= {
125132
visRoot : PropTypes.object.isRequired,
126133
toolTip : PropTypes.string,
@@ -154,6 +161,7 @@ export class VisToolbarView extends Component {
154161
verticalAlign: 'top',
155162
whiteSpace: 'nowrap'
156163
};
164+
const {apiToolsView}= visRoot;
157165

158166
var pv= getActivePlotView(visRoot);
159167
var plot= primePlot(pv);
@@ -172,6 +180,16 @@ export class VisToolbarView extends Component {
172180
visible={mi.fitsDownload}
173181
onClick={showFitsDownloadDialog.bind(null, 'Load Region')}/>
174182

183+
184+
{apiToolsView && <ToolbarButton icon={NEW_IMAGE}
185+
tip='Select a new image'
186+
enabled={enabled}
187+
horizontal={true}
188+
visible={mi.imageSelect}
189+
onClick={showImagePopup}/>}
190+
191+
192+
175193
<ToolbarHorizontalSeparator/>
176194

177195
<ZoomButton plotView={pv} zoomType={ZoomType.UP} visible={mi.zoomUp}/>
@@ -363,6 +381,10 @@ function toggleLockRelated(pv,plotGroupAry){
363381
dispatchGroupLocking(pv.plotId,!hasGroupLock(pv,plotGroup));
364382
}
365383

384+
function showImagePopup() {
385+
showImageSelPanel('Images');
386+
}
387+
366388
//==================================================================================
367389
//==================================================================================
368390
//==================================================================================

0 commit comments

Comments
 (0)