Skip to content

DM-7275: fixed expanded modes display issues #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/firefly/html/demo/ffapi-highlevel-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
var req= {
plotId: 'xxq',
Type : 'SERVICE',
// plotGroupId : 'myGroup',
plotGroupId : 'myGroup',
Service : 'TWOMASS',
Title : '2mass from service',
GridOn : true,
Expand All @@ -121,7 +121,7 @@

var req2= {
Type : 'SERVICE',
// plotGroupId : 'myGroup',
plotGroupId : 'myGroup',
Service : 'WISE',
Title : 'Wise',
GridOn : true,
Expand Down Expand Up @@ -179,7 +179,8 @@

var v1= firefly.makeImageViewer('old1');
var v2= firefly.makeImageViewer('old2');
v1.plot(req);

v1.plot(Object.assign({},req, {title:'old1 example'}));
v2.plotURL('http://web.ipac.caltech.edu/staff/roby/demo/wise-m51-band2.fits');


Expand Down
2 changes: 1 addition & 1 deletion src/firefly/js/visualize/MultiViewCntlr.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export function getExpandedViewerPlotIds(multiViewRoot) {
* @return {*}
*/
export function getViewerPlotIds(multiViewRoot,viewerId) {
if (!multiViewRoot || !viewerId) return null;
if (!multiViewRoot || !viewerId) return [];
var viewerObj= multiViewRoot.find( (entry) => entry.viewerId===viewerId);
return (viewerObj) ? viewerObj.plotIdAry : [];
}
Expand Down
89 changes: 49 additions & 40 deletions src/firefly/js/visualize/iv/ExpandedTools.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {CloseButton} from '../../ui/CloseButton.jsx';
import {showExpandedOptionsPopup} from '../ui/ExpandedOptionsPopup.jsx';
import { dispatchChangeActivePlotView} from '../ImagePlotCntlr.js';
import {VisToolbar} from '../ui/VisToolbar.jsx';
import {VIS_TOOLBAR_HEIGHT} from '../ui/VisToolbarView.jsx';
import {getMultiViewRoot, getExpandedViewerPlotIds} from '../MultiViewCntlr.js';

import './ExpandedTools.css';
Expand All @@ -33,12 +32,11 @@ const tStyle= {
};


export const EXPANDED_TOOL_HEIGHT= 60 +VIS_TOOLBAR_HEIGHT;


function createOptions(expandedMode,singleAutoPlay) {
function createOptions(expandedMode,singleAutoPlay, plotIdAry) {
var autoPlay= false;
if (expandedMode===ExpandType.SINGLE) {
var wcsSTMatch= false;
var wcsMatch= false;
if (expandedMode===ExpandType.SINGLE && plotIdAry.length>1) {
autoPlay= (
<div>
<div style={{display:'inline-block'}}>
Expand All @@ -53,8 +51,8 @@ function createOptions(expandedMode,singleAutoPlay) {
);
}

return (
<div style={{display:'inline-block', paddingLeft:15}}>
if (plotIdAry.length>1) {
wcsSTMatch= (
<div>
<div style={{display:'inline-block'}}>
<input style={{margin: 0}}
Expand All @@ -65,6 +63,8 @@ function createOptions(expandedMode,singleAutoPlay) {
</div>
<div style={tStyle}>TODO: WCS Search Target Match</div>
</div>
);
wcsMatch= (
<div>
<div style={{display:'inline-block'}}>
<input style={{margin: 0}}
Expand All @@ -75,6 +75,13 @@ function createOptions(expandedMode,singleAutoPlay) {
</div>
<div style={tStyle}>TODO: WCS Match</div>
</div>
);
}

return (
<div style={{display:'inline-block', paddingLeft:15}}>
{wcsSTMatch}
{wcsMatch}
{autoPlay}
</div>
);
Expand All @@ -88,27 +95,23 @@ const closeButtonStyle= {
};

const singlePlotTitleStyle= {
display: 'inline-block',
paddingLeft: 10,
position: 'relative',
top: 12
paddingLeft: 2,
alignSelf : 'center'
};

const gridPlotTitleStyle= {
display: 'inline-block',
paddingLeft: 10,
position: 'relative',
top: 12,
paddingLeft: 3,
lineHeight: '2em',
fontSize: '10pt',
fontWeight: 'bold',
verticalAlign: 'middle'
alignSelf : 'center'
};


export function ExpandedTools({visRoot,closeFunc}) {
var {expandedMode,plotViewAry,activePlotId, singleAutoPlay}= visRoot;
var single= expandedMode===ExpandType.SINGLE;
var {expandedMode,activePlotId, singleAutoPlay}= visRoot;
const plotIdAry= getExpandedViewerPlotIds(getMultiViewRoot());
var single= expandedMode===ExpandType.SINGLE || plotIdAry.length===1;
var plot= primePlot(visRoot);

var plotTitle;
Expand Down Expand Up @@ -137,14 +140,13 @@ export function ExpandedTools({visRoot,closeFunc}) {
<VisToolbar messageUnder={Boolean(closeFunc)}/>
</div>
</div>
<div style={{width:'100%', height:70, marginTop: 7}} className='disable-select'>
<div style={{width:'100%', minHeight:25, margin: '7px 0 5px 0',
display: 'flex', justifyContent:'space-between'}} className='disable-select'>
{plotTitle}
<div style={{ display: 'inline-block', paddingLeft: 10}}></div>
<div style={{display: 'inline-block', float:'right'}}>
<div style={{paddingBottom:5, alignSelf:'flex-end'}}>
<WhichView visRoot={visRoot}/>
{createOptions(expandedMode,singleAutoPlay)}
<PagingControl plotViewAry={plotViewAry}
activePlotId={activePlotId}
{createOptions(expandedMode,singleAutoPlay, plotIdAry)}
<PagingControl activePlotId={activePlotId}
visRoot={visRoot}
expandedMode={expandedMode} />
</div>
Expand All @@ -153,6 +155,7 @@ export function ExpandedTools({visRoot,closeFunc}) {
);
}

//<div style={{ display: 'inline-block', paddingLeft: 10}}></div>
//<div style={s}>checkboxes: wcs target match, wcs match, auto play (single only)</div>
//{makeInlineTitle(visRoot,pv)}

Expand All @@ -165,21 +168,28 @@ ExpandedTools.propTypes= {


function WhichView({visRoot}) {
var {plotViewAry}= visRoot;
const showViewButtons= getExpandedViewerPlotIds(getMultiViewRoot()).length>1;
return (
<div style={{display: 'inline-block', verticalAlign:'top'}}>
<ToolbarButton icon={ONE} tip={'Show single image at full size'}
imageStyle={{width:24,height:24}}
enabled={true} visible={true}
horizontal={true}
onClick={() => dispatchChangeExpandedMode(ExpandType.SINGLE)}/>
<ToolbarButton icon={GRID} tip={'Show all as tiles'}
enabled={true} visible={true} horizontal={true}
imageStyle={{width:24,height:24}}
onClick={() => dispatchChangeExpandedMode(ExpandType.GRID)}/>
<ToolbarButton icon={LIST} tip={'Choose which plots to show'}
imageStyle={{width:24,height:24}}
enabled={true} visible={true} horizontal={true}
onClick={() =>showExpandedOptionsPopup(visRoot.plotViewAry) }/>
{showViewButtons &&
<ToolbarButton icon={ONE} tip={'Show single image at full size'}
imageStyle={{width:24,height:24}}
enabled={true} visible={true}
horizontal={true}
onClick={() => dispatchChangeExpandedMode(ExpandType.SINGLE)}/>}
{showViewButtons &&
<ToolbarButton icon={GRID} tip={'Show all as tiles'}
enabled={true} visible={true} horizontal={true}
imageStyle={{width:24,height:24}}
onClick={() => dispatchChangeExpandedMode(ExpandType.GRID)}/>
}
{plotViewAry.length>1 &&
<ToolbarButton icon={LIST} tip={'Choose which plots to show'}
imageStyle={{width:24,height:24}}
enabled={true} visible={true} horizontal={true}
onClick={() =>showExpandedOptionsPopup(visRoot.plotViewAry) }/>
}
</div>
);
}
Expand Down Expand Up @@ -211,7 +221,7 @@ function pTitle(begin,visRoot,plotId) {



function PagingControl({plotViewAry, visRoot,activePlotId, expandedMode}) {
function PagingControl({visRoot,activePlotId, expandedMode}) {

const plotIdAry= getExpandedViewerPlotIds(getMultiViewRoot());

Expand Down Expand Up @@ -283,7 +293,6 @@ function PagingControl({plotViewAry, visRoot,activePlotId, expandedMode}) {
}

PagingControl.propTypes= {
plotViewAry : PropTypes.array.isRequired,
activePlotId: PropTypes.string,
expandedMode: PropTypes.object.isRequired,
visRoot : PropTypes.object.isRequired
Expand Down
14 changes: 8 additions & 6 deletions src/firefly/js/visualize/reducer/HandlePlotChange.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {primePlot,
getPlotViewById} from '../PlotViewUtil.js';
import {makeImagePt, makeWorldPt} from '../Point.js';
import {UserZoomTypes} from '../ZoomUtil.js';
import CsysConverter from '../CsysConverter.js'
import Point from '../Point.js';


//============ EXPORTS ===========
Expand Down Expand Up @@ -178,10 +178,12 @@ function installTiles(state, action) {
var centerImagePt= PlotView.findCurrentCenterPoint(pv,pv.scrollX,pv.scrollY);
pv= replacePrimaryPlot(pv,WebPlot.setPlotState(plot,primaryStateJson,primaryTiles));
pv.serverCall='success';
pv.overlayPlotViews= pv.overlayPlotViews.map( (oPv,idx) => {
var p= WebPlot.setPlotState(oPv.plot,overlayStateJsonAry[idx],overlayTilesAry[idx]);
return clone(oPv, {plot:p});
});
if (!isEmpty(overlayStateJsonAry) && overlayStateJsonAry.length===pv.overlayPlotViews.length) {
pv.overlayPlotViews= pv.overlayPlotViews.map( (oPv,idx) => {
var p= WebPlot.setPlotState(oPv.plot,overlayStateJsonAry[idx],overlayTilesAry[idx]);
return clone(oPv, {plot:p});
});
}
pv= PlotView.updatePlotViewScrollXY(pv, PlotView.findScrollPtForImagePt(pv,centerImagePt));

plot= primePlot(pv); // get the updated on
Expand Down Expand Up @@ -249,7 +251,7 @@ function recenterPv(centerPt) {
if (centerPt.type === Point.IM_PT) {
centerImagePt = makeImagePt(centerPt.x, centerPt.y);
} else {
centerImagePt = makeWorldPt(centetPt.x, centerPt.y);
centerImagePt = makeWorldPt(centerPt.x, centerPt.y);
}
} else {
var wp = plot.attributes[PlotAttribute.FIXED_TARGET];
Expand Down
17 changes: 15 additions & 2 deletions src/firefly/js/visualize/saga/ImagePlotter.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ export function* imagePlotter(params, dispatch, getState) {
const {requestKey}= waitAction.payload;
if (canContinue(waitAction)) {
continuePlotting(makeContinueAction(waitAction),dispatch);
waitingPlotActions= waitingPlotActions.filter( (a) => a.payload.requestKey!==requestKey);
waitingPlotActions= waitingPlotActions
.filter( (a) => a.payload.requestKey!==requestKey) // filter out this request
.filter( (a) => !actionMatches(a,plotId)); // filter out any duplicates
}
}
break;
Expand All @@ -60,7 +62,7 @@ function actionMatches(a,plotId) {
return wpRequestAry.some( (req) => req.getPlotId()===plotId);
}
else {
return a.payload.plotId= plotId;
return a.payload.plotId===plotId;
}
}

Expand All @@ -72,13 +74,24 @@ function getRequestAry(payload) {
}


/**
* The action can continue if the width and height for every plot id has been set in the store
* @param {Action} rawAction
* @return {boolean}
*/
function canContinue(rawAction) {
return getRequestAry(rawAction.payload).every( (req) => {
return canContinueRequest(req,getPlotViewById(visRoot(),req.getPlotId()));
});
}


/**
* Check one PlotView and determine if the width and height has been set
* @param {WebPlotRequest} req
* @param {PlotView} pv
* @return {boolean}
*/
function canContinueRequest(req, pv) {
if (!pv) return false;
var requiresWH= requiresWidthHeight(req.getZoomType());
Expand Down