Skip to content

Commit

Permalink
Center Earth Scale & Fix Timeline pop-up issue Helioviewer-Project#238
Browse files Browse the repository at this point in the history
  • Loading branch information
Helioviewer-Kirill committed Jun 26, 2018
1 parent 0b0d3f1 commit 56e5035
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions resources/js/UI/ImageScale.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ var ImageScale = Class.extend(
) {

if ( $('#earth-button').length ) {
this.containerX = $('#earth-button').position().left + $('#scale').position().left - this.container.width()/2;
this.containerX = this.container.parent().width()/2 - this.container.width()/2; //center the earth container
this.containerY = $('#earth-button').position().top + $('#scale').position().top + this.container.height();
}else{
this.containerX = this.container.parent().width() - 150;
Expand Down Expand Up @@ -300,7 +300,7 @@ var ImageScale = Class.extend(

if ( $('#earth-button').length ) {

this.containerX = $('#earth-button').position().left + $('#scale').position().left - this.container.width()/2;
this.containerX = this.container.parent().width()/2 - this.container.width()/2; //center the earth container
this.containerY = $('#earth-button').position().top + $('#scale').position().top + this.container.height();
this.scale = false;

Expand Down
21 changes: 12 additions & 9 deletions resources/js/UI/TimelineEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,21 +592,24 @@ var TimelineEvents = Class.extend({
){
return {x: 0, y: 0}
}

var x = this.chart.mouseCoords.x;
var y = this.chart.mouseCoords.y;
var xOffset = 18;
var yOffset = -130;

if (x + 350 > this.chart.plotWidth) {
tooltipX = x - 350 - xOffset;
var xOffset = 32;
var eventPopUpWidth = 350;
var eventPopUpHeight = 150;
var timelineRectHeight = 20;

if (x + xOffset + eventPopUpWidth > this.chart.plotWidth) {
tooltipX = x - eventPopUpWidth - xOffset;
} else {
tooltipX = x;
tooltipX = x + (xOffset/2);
}

if(y < 150){
tooltipY = y - 75;
if(y < eventPopUpHeight){
tooltipY = y - (eventPopUpHeight/2);
}else{
tooltipY = y - 130;
tooltipY = y - (eventPopUpHeight - timelineRectHeight);
}

if(isShared){
Expand Down

0 comments on commit 56e5035

Please sign in to comment.