ensure textboxes and searchboxes do not clash, fix legend item deletion, fix legend throwing error
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
export interface GlobalParams extends Window {
|
||||
pane: paneStyle; // TODO shouldnt need this cause of css variables
|
||||
handlerInFocus: string;
|
||||
textBoxFocused: boolean;
|
||||
callbackFunction: Function;
|
||||
containerDiv: HTMLElement;
|
||||
setCursor: Function;
|
||||
@ -41,6 +42,7 @@ export function globalParamInit() {
|
||||
document.body.style.cursor = window.cursor;
|
||||
}
|
||||
window.cursor = 'default';
|
||||
window.textBoxFocused = false;
|
||||
}
|
||||
|
||||
export const setCursor = (type: string | undefined) => {
|
||||
|
||||
@ -308,7 +308,7 @@ export class Handler {
|
||||
chart.div.appendChild(searchWindow);
|
||||
|
||||
chart.commandFunctions.push((event: KeyboardEvent) => {
|
||||
if (window.handlerInFocus !== chart.id) return false
|
||||
if (window.handlerInFocus !== chart.id || window.textBoxFocused) return false
|
||||
if (searchWindow.style.display === 'none') {
|
||||
if (/^[a-zA-Z0-9]$/.test(event.key)) {
|
||||
searchWindow.style.display = 'flex';
|
||||
|
||||
@ -209,6 +209,7 @@ export class Legend {
|
||||
else {
|
||||
data = param.seriesData.get(e.series) as LineData
|
||||
}
|
||||
if (!data?.value) return;
|
||||
let price;
|
||||
if (e.series.seriesType() == 'Histogram') {
|
||||
price = this.shorthandFormat(data.value)
|
||||
|
||||
@ -84,7 +84,11 @@ export class TopBar {
|
||||
textBox.classList.add('topbar-textbox-input');
|
||||
textBox.value = text
|
||||
textBox.style.width = `${(textBox.value.length+2)}ch`
|
||||
textBox.addEventListener('focus', () => {
|
||||
window.textBoxFocused = true;
|
||||
})
|
||||
textBox.addEventListener('input', (e) => {
|
||||
e.preventDefault();
|
||||
textBox.style.width = `${(textBox.value.length+2)}ch`;
|
||||
});
|
||||
textBox.addEventListener('keydown', (e) => {
|
||||
@ -95,6 +99,7 @@ export class TopBar {
|
||||
});
|
||||
textBox.addEventListener('blur', () => {
|
||||
window.callbackFunction(`${callbackName}_~_${textBox.value}`)
|
||||
window.textBoxFocused = false;
|
||||
});
|
||||
this.appendWidget(textBox, align, true)
|
||||
return textBox
|
||||
|
||||
Reference in New Issue
Block a user