From ccc01ab5dc69e8df4ae07a2d6d37ef87a07fe825 Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Mon, 14 Jul 2014 09:50:27 -0400 Subject: [PATCH] Fixed issue #14 (tooltip is cut off at bottom) --- CookieMonster.js | 19 ++++++++++--------- src/Disp.js | 15 ++++++++------- src/Main.js | 4 ++-- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index fa0b0c1..9269984 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1351,6 +1351,14 @@ CM.Disp.RefreshMenu = function() { if (CM.Config.UpStats && Game.onMenu == 'stats' && Game.drawT % (Game.fps * 3) != 0 && Game.drawT % Game.fps == 0) Game.UpdateMenu(); } +CM.Disp.UpdateTooltipLocation = function() { + Game.tooltip.tta.style.top = Math.max(0, Math.min((l('game').clientHeight + l('topBar').clientHeight) - Game.tooltip.tt.clientHeight - CM.Disp.TooltipWarnCaut.clientHeight - 64, Game.mouseY - 48)) + 'px'; + if (Game.tooltip.origin == 'wrink') { + Game.tooltip.tta.style.left = (Game.mouseX + l('tooltip').offsetWidth + 25) + 'px'; + Game.tooltip.tta.style.right = 'auto'; + } +} + CM.Disp.CreateTooltipWarnCaut = function() { CM.Disp.TooltipWarnCaut = document.createElement('div'); CM.Disp.TooltipWarnCaut.style.position = 'absolute'; @@ -1667,13 +1675,6 @@ CM.Disp.UpdateWrinklerTooltip = function() { } } -CM.Disp.UpdateTooltipWrinklerLocation = function() { - if (Game.tooltip.origin == 'wrink') { - Game.tooltip.tta.style.left = (Game.mouseX + l('tooltip').offsetWidth + 25) + 'px'; - Game.tooltip.tta.style.right = 'auto'; - } -} - CM.Disp.ToggleSayTime = function() { if (CM.Config.SayTime == 1) { Game.sayTime = CM.Disp.sayTime; @@ -1752,8 +1753,8 @@ CM.ReplaceNative = function() { eval('CM.Backup.tooltip.updateMod = ' + Game.tooltip.update.toString().split('this').join('Game.tooltip')); Game.tooltip.update = function() { CM.Backup.tooltip.updateMod(); - CM.Disp.UpdateTooltipWrinklerLocation(); CM.Disp.UpdateTooltipWarnCaut(); + CM.Disp.UpdateTooltipLocation(); } CM.Backup.RebuildUpgrades = Game.RebuildUpgrades; @@ -1844,7 +1845,7 @@ CM.Init = function() { } } -CM.ConfigDefault = {BotBar: 1, TimerBar: 1, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCTimer: 1, Title: 1, Tooltip: 1, ToolWarnCaut: 1, ToolWarnCautPos: 0, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}}; +CM.ConfigDefault = {BotBar: 1, TimerBar: 1, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCTimer: 1, Title: 1, Tooltip: 1, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}}; CM.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '1.0465'; diff --git a/src/Disp.js b/src/Disp.js index 2c4a304..f737189 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1044,6 +1044,14 @@ CM.Disp.RefreshMenu = function() { if (CM.Config.UpStats && Game.onMenu == 'stats' && Game.drawT % (Game.fps * 3) != 0 && Game.drawT % Game.fps == 0) Game.UpdateMenu(); } +CM.Disp.UpdateTooltipLocation = function() { + Game.tooltip.tta.style.top = Math.max(0, Math.min((l('game').clientHeight + l('topBar').clientHeight) - Game.tooltip.tt.clientHeight - CM.Disp.TooltipWarnCaut.clientHeight - 64, Game.mouseY - 48)) + 'px'; + if (Game.tooltip.origin == 'wrink') { + Game.tooltip.tta.style.left = (Game.mouseX + l('tooltip').offsetWidth + 25) + 'px'; + Game.tooltip.tta.style.right = 'auto'; + } +} + CM.Disp.CreateTooltipWarnCaut = function() { CM.Disp.TooltipWarnCaut = document.createElement('div'); CM.Disp.TooltipWarnCaut.style.position = 'absolute'; @@ -1360,13 +1368,6 @@ CM.Disp.UpdateWrinklerTooltip = function() { } } -CM.Disp.UpdateTooltipWrinklerLocation = function() { - if (Game.tooltip.origin == 'wrink') { - Game.tooltip.tta.style.left = (Game.mouseX + l('tooltip').offsetWidth + 25) + 'px'; - Game.tooltip.tta.style.right = 'auto'; - } -} - CM.Disp.ToggleSayTime = function() { if (CM.Config.SayTime == 1) { Game.sayTime = CM.Disp.sayTime; diff --git a/src/Main.js b/src/Main.js index 30eaddd..0eba298 100644 --- a/src/Main.js +++ b/src/Main.js @@ -33,8 +33,8 @@ CM.ReplaceNative = function() { eval('CM.Backup.tooltip.updateMod = ' + Game.tooltip.update.toString().split('this').join('Game.tooltip')); Game.tooltip.update = function() { CM.Backup.tooltip.updateMod(); - CM.Disp.UpdateTooltipWrinklerLocation(); CM.Disp.UpdateTooltipWarnCaut(); + CM.Disp.UpdateTooltipLocation(); } CM.Backup.RebuildUpgrades = Game.RebuildUpgrades; @@ -125,7 +125,7 @@ CM.Init = function() { } } -CM.ConfigDefault = {BotBar: 1, TimerBar: 1, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCTimer: 1, Title: 1, Tooltip: 1, ToolWarnCaut: 1, ToolWarnCautPos: 0, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}}; +CM.ConfigDefault = {BotBar: 1, TimerBar: 1, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCTimer: 1, Title: 1, Tooltip: 1, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}}; CM.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '1.0465';