Skip to content

Commit

Permalink
Merge pull request opencadc#2 from SharonGoliath/master
Browse files Browse the repository at this point in the history
s1960: Handling for mouse movement events on visible data view rows.
  • Loading branch information
at88mph authored Sep 7, 2016
2 parents a04dee9 + 407c105 commit 04c7871
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
// End declaration of AladinLite
//

// currently 'active' (hover/click) row
//
this.currentFootprint = null;

/**
Expand Down Expand Up @@ -122,6 +124,7 @@
if (inputs.onHover === true)
{
_self.handler.subscribe(_self.grid.onMouseEnter, handleMouseEnter)
_self.handler.subscribe(_self.grid.onMouseLeave, handleMouseLeave)
}

if (inputs.onClick === true)
Expand Down Expand Up @@ -242,8 +245,6 @@

function _handleAction(_dataRow)
{
_resetCurrent();

var raValue = _dataRow[_self.raFieldID];
var decValue = _dataRow[_self.decFieldID];

Expand All @@ -252,22 +253,29 @@
_self.aladin.gotoRaDec(raValue, decValue);
_self.currentFootprint.addFootprints(
_self.aladin.createFootprintsFromSTCS(_dataRow[_self.footprintFieldID]));
var fovValue = _dataRow[_self.fovFieldID];
if(fovValue)
{
_self.aladin.setFoV(fovValue);
}
}
}

function _resetCurrent()
{
if(_self.currentFootprint)
if (_self.currentFootprint)
{
_self.currentFootprint.removeAll();
}
// _self.currentFootprint = null;
// _self.aladin.removeLayers();
// _self.aladin.addOverlay(_self.aladinOverlay);
if (_self.aladin && _self.aladin.view)
{
_self.aladin.view.forceRedraw();
}
}

function handleClick(e, args)
{
_resetCurrent();
_handleAction(args.grid.getDataItem(args.row));
}

Expand All @@ -276,6 +284,11 @@
_handleAction(args.grid.getDataItem(args.cell.row));
}

function handleMouseLeave(e, args)
{
_resetCurrent();
}

function handleRenderComplete(e, args)
{
resetOverlay();
Expand All @@ -292,7 +305,7 @@
var defaultRA = null;
var defaultDec = null;

for (var i = renderedRange.top, ii = renderedRange.bottom; i < ii; i++)
for (var i = renderedRange.top, ii = renderedRange.bottom; i <= ii; i++)
{
var $nextRow = args.grid.getDataItem(i);
var polygonValue = $nextRow[_self.footprintFieldID];
Expand Down Expand Up @@ -359,8 +372,7 @@
// Add 20% to add some space around the footprints
var aFOV = Math.max(DEC[3], (aRA[3] * Math.cos(DEC[2]
* PI_OVER_180))) * 1.2;
console.log(aFOV);
_self.aladin.setFoV(aFOV);
_self.aladin.setFoV(Math.min(180, aFOV));
}

if ((defaultRA != null) && (defaultDec != null))
Expand Down
19 changes: 0 additions & 19 deletions cadc-votv/src/www/cadcVOTV/javascript/cadc.votv.js
Original file line number Diff line number Diff line change
Expand Up @@ -1485,25 +1485,6 @@
});
}

/*
dataView.onPagingInfoChanged.subscribe(function (e, pagingInfo)
{
var isLastPage =
(pagingInfo.pageNum ==
pagingInfo.totalPages - 1);
var enableAddRow =
(isLastPage ||
pagingInfo.pageSize == 0);
var options = grid.getOptions();
if (options.enableAddRow !=
enableAddRow)
{
grid.setOptions({enableAddRow: enableAddRow});
}
});
*/

$(window).resize(function ()
{
_self.setViewportHeight();
Expand Down

0 comments on commit 04c7871

Please sign in to comment.