Skip to content

Commit

Permalink
Attempting to fix discrepancies related to fullscreen and background
Browse files Browse the repository at this point in the history
color
Related to #240
  • Loading branch information
Yomguithereal committed Oct 15, 2024
1 parent 980ec17 commit 693aa0e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ export class SigmaView extends DOMWidgetView {
graph: Graph;
emitter: EventEmitter = new EventEmitter();
edgeWeightAttribute: string | null = null;
backgroundColor: string;

syncKey: string | undefined;
syncHoveredNode: string | null = null;
Expand Down Expand Up @@ -431,6 +432,7 @@ export class SigmaView extends DOMWidgetView {
const data = this.model.get('data');

this.el.style.backgroundColor = backgroundColor;
this.backgroundColor = backgroundColor;

const graph = buildGraph(data, createRng());
this.graph = graph;
Expand Down Expand Up @@ -714,7 +716,9 @@ export class SigmaView extends DOMWidgetView {
};

// Gathering info about the graph to build reducers correctly
const maxCategoricalColors = this.model.get('max_categorical_colors') as number;
const maxCategoricalColors = this.model.get(
'max_categorical_colors'
) as number;

const scaleBuilder = new VisualVariableScalesBuilder(
visualVariables,
Expand Down Expand Up @@ -1524,16 +1528,20 @@ export class SigmaView extends DOMWidgetView {
bindFullscreenHandlers() {
const enter = () => {
this.el.style.height = '100%';
this.el.style.backgroundColor = this.backgroundColor;
this.container.style.height = '100%';
this.container.style.backgroundColor = this.backgroundColor;
this.fullscreenButton.innerHTML = fullscreenExitIcon;
this.fullscreenButton.setAttribute('title', 'exit fullscreen');
this.renderer.scheduleRefresh();
};

const exit = () => {
const targetHeight = this.model.get('height');
this.el.style.backgroundColor = this.backgroundColor;
this.el.style.height = targetHeight;
this.container.style.height = targetHeight;
this.container.style.backgroundColor = this.backgroundColor;
this.fullscreenButton.innerHTML = fullscreenEnterIcon;
this.fullscreenButton.setAttribute('title', 'enter fullscreen');
this.renderer.scheduleRefresh();
Expand Down

0 comments on commit 693aa0e

Please sign in to comment.