diff --git a/resources/todomvc/big-dom-generator/params.js b/resources/todomvc/big-dom-generator/params.js index 78b313099..2939e47c8 100644 --- a/resources/todomvc/big-dom-generator/params.js +++ b/resources/todomvc/big-dom-generator/params.js @@ -16,3 +16,4 @@ export const TARGET_SIZE = 6000; // at least MIN_NUMBER_OF_MAX_DEPTH_BRANCHES of depth MAX_GENERATED_DOM_DEPTH. export const MIN_NUMBER_OF_MAX_DEPTH_BRANCHES = 2; export const MAX_VISIBLE_TREE_VIEW_ITEM_DEPTH = 8; +export const PERCENTAGE_OF_DISPLAY_NONE_TREEVIEW_ELEMENTS = 0.5; diff --git a/resources/todomvc/big-dom-generator/src/tree-generator.js b/resources/todomvc/big-dom-generator/src/tree-generator.js index 647ed4ae3..01ce34996 100644 --- a/resources/todomvc/big-dom-generator/src/tree-generator.js +++ b/resources/todomvc/big-dom-generator/src/tree-generator.js @@ -1,5 +1,5 @@ import { LCG } from "random-seedable"; -import { DEFAULT_SEED_FOR_RANDOM_NUMBER_GENERATOR, MAX_GENERATED_DOM_DEPTH, MAX_NUMBER_OF_CHILDREN, PROBABILITY_OF_HAVING_CHILDREN, TARGET_SIZE, MIN_NUMBER_OF_MAX_DEPTH_BRANCHES } from "./../params"; +import { DEFAULT_SEED_FOR_RANDOM_NUMBER_GENERATOR, MAX_GENERATED_DOM_DEPTH, MAX_NUMBER_OF_CHILDREN, PROBABILITY_OF_HAVING_CHILDREN, TARGET_SIZE, MIN_NUMBER_OF_MAX_DEPTH_BRANCHES, PERCENTAGE_OF_DISPLAY_NONE_TREEVIEW_ELEMENTS } from "./../params"; const random = new LCG(DEFAULT_SEED_FOR_RANDOM_NUMBER_GENERATOR); @@ -16,7 +16,7 @@ const markDisplayNoneNodes = (node, expandableItemWeight, nonExpandableItemWeigh let currentSubTreesWeights = node.subTreeWeight; let currentIndex = 0; let nodeQueue = [node]; - while (currentSubTreesWeights >= TARGET_SIZE / 2) { + while (currentSubTreesWeights >= TARGET_SIZE * PERCENTAGE_OF_DISPLAY_NONE_TREEVIEW_ELEMENTS) { const currentNode = nodeQueue[currentIndex]; nodeQueue[currentIndex] = null; const expandableChildren = currentNode.children.filter((child) => child.type === "expandableItem");