<commit_before>package org.ucombinator.jaam.visualizer.gui;

import javafx.animation.ScaleTransition;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Bounds;
import javafx.geometry.Point2D;

import javafx.scene.Node;
import javafx.scene.input.MouseEvent;
import javafx.scene.input.ScrollEvent;
import javafx.scene.layout.Pane;
import javafx.util.Duration;
import javafx.scene.control.ScrollPane;
import javafx.scene.Group;
import javafx.scene.paint.Color;

import java.util.HashSet;
import java.util.Iterator;

import org.ucombinator.jaam.visualizer.layout.*;
import org.ucombinator.jaam.visualizer.graph.Graph;
import org.ucombinator.jaam.visualizer.main.Main;
import org.ucombinator.jaam.visualizer.main.Parameters;

public class VizPanel extends ScrollPane
{
	private Group contentGroup;
	public HashSet<AbstractLayoutVertex> highlighted;

	public static float hues[]; //Used for shading nodes from green to red
	private LayoutRootVertex panelRoot;
	private Color[] colors = {Color.GREEN, Color.AZURE, Color.AQUAMARINE, Color.BLUEVIOLET, Color.DARKTURQUOISE};
	public static int maxLoopHeight;

	// The dimensions of the background for our graph
	public final double rootWidth = 500.0, rootHeight = 500.0;

	// Store the count for vertex width and height when everything is expanded
	public double maxVertexWidth, maxVertexHeight;

	public LayoutRootVertex getPanelRoot()
	{
		return this.panelRoot;
	}

	public VizPanel()
	{
		super();
		contentGroup = new Group();
		contentGroup.setVisible(true);
		this.setContent(contentGroup);

		createZoomPane();
		highlighted = new HashSet<AbstractLayoutVertex>();
	}

	public void initFX(LayoutRootVertex root)
	{
		if(root == null)
		{
			//System.out.println("Running layout...");
			Graph g = Main.graph;
			this.panelRoot = LayerFactory.getLayeredGraph(g);
			LayoutAlgorithm.layout(this.panelRoot);
			resetPanelSize();
		}
		else
		{
			this.panelRoot = root;
		}

		drawNodes(null, this.panelRoot);
		drawEdges(this.panelRoot);
	}

	public void resetContent() {
		contentGroup = new Group();
	}

	public void resetPanelSize() {
		this.maxVertexWidth = this.panelRoot.getWidth();
		this.maxVertexHeight = this.panelRoot.getHeight();		
	}

	double factorX = 1;
	double factorY = 1;
	double factorMultiple = 1.1;
	double maxFactorMultiple = 3;

	public double scaleX(double coordinate)
	{
		return factorX * (coordinate * rootWidth / this.maxVertexWidth);
	}
<commit_msg>Fixed resetting content on collapse/expand<commit_after>package org.ucombinator.jaam.visualizer.gui;

import javafx.animation.ScaleTransition;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Bounds;
import javafx.geometry.Point2D;

import javafx.scene.Node;
import javafx.scene.input.MouseEvent;
import javafx.scene.input.ScrollEvent;
import javafx.scene.layout.Pane;
import javafx.util.Duration;
import javafx.scene.control.ScrollPane;
import javafx.scene.Group;
import javafx.scene.paint.Color;

import java.util.HashSet;
import java.util.Iterator;

import org.ucombinator.jaam.visualizer.layout.*;
import org.ucombinator.jaam.visualizer.graph.Graph;
import org.ucombinator.jaam.visualizer.main.Main;
import org.ucombinator.jaam.visualizer.main.Parameters;

public class VizPanel extends ScrollPane
{
	private Group contentGroup;
	public HashSet<AbstractLayoutVertex> highlighted;

	public static float hues[]; //Used for shading nodes from green to red
	private LayoutRootVertex panelRoot;
	private Color[] colors = {Color.GREEN, Color.AZURE, Color.AQUAMARINE, Color.BLUEVIOLET, Color.DARKTURQUOISE};
	public static int maxLoopHeight;

	// The dimensions of the background for our graph
	public final double rootWidth = 500.0, rootHeight = 500.0;

	// Store the count for vertex width and height when everything is expanded
	public double maxVertexWidth, maxVertexHeight;

	public LayoutRootVertex getPanelRoot()
	{
		return this.panelRoot;
	}

	public VizPanel()
	{
		super();
		contentGroup = new Group();
		contentGroup.setVisible(true);
		this.setContent(contentGroup);

		createZoomPane();
		highlighted = new HashSet<AbstractLayoutVertex>();
	}

	public void initFX(LayoutRootVertex root)
	{
		if(root == null)
		{
			//System.out.println("Running layout...");
			Graph g = Main.graph;
			this.panelRoot = LayerFactory.getLayeredGraph(g);
			LayoutAlgorithm.layout(this.panelRoot);
			resetPanelSize();
		}
		else
		{
			this.panelRoot = root;
		}

		drawNodes(null, this.panelRoot);
		drawEdges(this.panelRoot);
	}

	public void resetContent() {
		contentGroup = new Group();
		contentGroup.setVisible(true);
		this.setContent(contentGroup);
	}

	public void resetPanelSize() {
		this.maxVertexWidth = this.panelRoot.getWidth();
		this.maxVertexHeight = this.panelRoot.getHeight();		
	}

	double factorX = 1;
	double factorY = 1;
	double factorMultiple = 1.1;
	double maxFactorMultiple = 3;

	public double scaleX(double coordinate)
	{
		return factorX * (coordinate * rootWidth / this.maxVertexWidth);
	}

{'fraction_non_alphanumeric': 0.10235927921233513, 'fraction_numerical': 0.005201560468140442, 'mean_word_length': 4.982222222222222, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2895942', 'n_tokens_mistral': 1810, 'n_tokens_neox': 1671, 'n_words': 384}