Fix simple tooltips #687

This commit is contained in:
Daniël van Noord
2021-03-16 23:10:33 +01:00
parent f6b2e70f9b
commit af508ceee5
6 changed files with 15 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -2,7 +2,7 @@
import { ToggleHeader } from '../../Config/ToggleSetting'; import { ToggleHeader } from '../../Config/ToggleSetting';
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import { TooltipText } from '../VariablesAndData'; import { SimpleTooltipElements } from '../VariablesAndData';
/** /**
* This function creates a header-object for the stats page * This function creates a header-object for the stats page
@@ -64,7 +64,10 @@ export function StatsListing(type, name, text, placeholder) {
Game.tooltip.hide(); Game.tooltip.hide();
}; };
tooltip.onmouseover = function () { tooltip.onmouseover = function () {
Game.tooltip.draw(this, escape(TooltipText[placeholder].innerHTML)); Game.tooltip.draw(
this,
escape(SimpleTooltipElements[placeholder].innerHTML),
);
}; };
tooltip.style.cursor = 'default'; tooltip.style.cursor = 'default';
tooltip.style.display = 'inline-block'; tooltip.style.display = 'inline-block';

View File

@@ -6,7 +6,11 @@ import {
GetTimeColor, GetTimeColor,
} from '../BeautifyAndFormatting/BeautifyFormatting'; } from '../BeautifyAndFormatting/BeautifyFormatting';
import CopyData from '../../Sim/SimulationData/CopyData'; import CopyData from '../../Sim/SimulationData/CopyData';
import { TooltipName, TooltipType } from '../VariablesAndData'; import {
SimpleTooltipElements,
TooltipName,
TooltipType,
} from '../VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding'; import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
@@ -30,6 +34,7 @@ export function CreateSimpleTooltip(placeholder, text, minWidth) {
div.textContent = text; div.textContent = text;
desc.appendChild(div); desc.appendChild(div);
Tooltip.appendChild(desc); Tooltip.appendChild(desc);
SimpleTooltipElements[placeholder] = Tooltip;
} }
/** /**

View File

@@ -80,6 +80,7 @@ export const TooltipText = [
'250px', '250px',
], ],
]; ];
export const SimpleTooltipElements = {};
/** /**
* These are variables used by the functions that create tooltips for wrinklers * These are variables used by the functions that create tooltips for wrinklers