Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup dead feature #2416

Merged
merged 9 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions packages/ag-charts-community/src/scene/scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { downloadUrl } from '../util/dom';
import { createId } from '../util/id';
import type { BBox } from './bbox';
import { type CanvasOptions, HdpiCanvas } from './canvas/hdpiCanvas';
import { Group } from './group';
import { LayersManager } from './layersManager';
import type { Node, RenderContext } from './node';
import { RedrawType } from './node';
Expand Down Expand Up @@ -69,17 +68,9 @@ export class Scene {
return this;
}

attachNode<T extends Node>(node: T, rootGroupName?: string) {
if (!rootGroupName) {
this.appendChild(node);
return () => this.removeChild(node);
}

const parentGroup = this.root?.children.find((g) => g instanceof Group && g.name === rootGroupName);
if (!parentGroup) throw new Error('AG Charts - Unrecognized root group name: ' + rootGroupName);

parentGroup.appendChild(node);
return () => parentGroup.removeChild(node);
attachNode<T extends Node>(node: T) {
this.appendChild(node);
return () => this.removeChild(node);
}

appendChild<T extends Node>(node: T) {
Expand Down
15 changes: 5 additions & 10 deletions packages/ag-charts-community/src/scene/sceneDebug.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { toArray } from '../util/array';
import { Debug } from '../util/debug';
import { getWindow } from '../util/dom';
import { Logger } from '../util/logger';
Expand Down Expand Up @@ -69,21 +70,15 @@ export function debugStats(
}

export function prepareSceneNodeHighlight(ctx: RenderContext) {
let config: string | string[] = getWindow('agChartsSceneDebug') ?? [];

if (typeof config === 'string') {
config = [config];
}

const result: (string | RegExp)[] = [];
config.forEach((name: string) => {
const config: string[] = toArray(getWindow('agChartsSceneDebug'));
const result: RenderContext['debugNodeSearch'] = [];
for (const name of config) {
if (name === 'layout') {
result.push('seriesRoot', 'legend', 'root', /.*Axis-\d+-axis.*/);
} else {
result.push(name);
}
});

}
ctx.debugNodeSearch = result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { type AgFinancialChartOptions, type AgPriceVolumeChartType, _ModuleSuppo

const {
CachedTextMeasurerPool,
Layers,
LayoutElement,
Validate,
BaseProperties,
Expand Down Expand Up @@ -116,7 +117,11 @@ export class StatusBar
data?: any[] = undefined;

private readonly highlightManager: _ModuleSupport.HighlightManager;
private readonly labelGroup = new _Scene.TranslatableGroup({ name: 'StatusBar' });
private readonly labelGroup = new _Scene.TranslatableGroup({
name: 'StatusBar',
zIndex: Layers.AXIS_FOREGROUND_ZINDEX,
layer: true,
});
private readonly backgroundNode = this.labelGroup.appendChild(new Rect());
private readonly labels = [
{
Expand Down Expand Up @@ -252,7 +257,7 @@ export class StatusBar
this.labelGroup.visible = false;

this.destroyFns.push(
ctx.scene.attachNode(this.labelGroup, 'titles'),
ctx.scene.attachNode(this.labelGroup),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was hacked in to fix https://ag-grid.atlassian.net/browse/CRT-394 - can you verify that this case still works after this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified and works as expected

ctx.layoutManager.registerElement(LayoutElement.Overlay, (e) => this.startPerformLayout(e)),
ctx.layoutManager.addListener('layout:complete', (e) => this.onLayoutComplete(e)),
ctx.highlightManager.addListener('highlight-change', () => this.updateHighlight())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ export const StatusBarModule: _ModuleSupport.RootModule = {
themeTemplate: {
statusBar: {
enabled: false,
openKey: undefined,
highKey: undefined,
lowKey: undefined,
closeKey: undefined,
volumeKey: undefined,
layoutStyle: _Theme.DEFAULT_CAPTION_LAYOUT_STYLE,
title: {
color: _Theme.DEFAULT_LABEL_COLOUR,
Expand Down
Loading