From 271946de30bc5b81079fe77f0accdcfc4bf76d47 Mon Sep 17 00:00:00 2001 From: Deadly Artist Date: Fri, 12 Jul 2024 07:12:12 +0200 Subject: [PATCH] added break size --- js/flow.js | 6 ++++-- js/worker.js | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/js/flow.js b/js/flow.js index f2b4944..a253305 100644 --- a/js/flow.js +++ b/js/flow.js @@ -510,6 +510,8 @@ class Flow { settings.useTooltipInstead = options.useTooltipInstead ?? true; } else if (type === Flow.emptyType) { // Do nothing + } else if (type === Flow.breakType) { + settings.size = Math.min(8, Math.max(0, options.size)); } else if (type === Flow.rulerType) { settings.vertical = options.vertical; } else if (type === Flow.codeType) { @@ -800,8 +802,8 @@ class Flow { settings.contentElement = element; if (type == Flow.breakType) { - if (containered) element.classList.add('vb-1'); - else element.classList.add('hb-1'); + if (containered) element.classList.add('vb-' + settings.size); + else element.classList.add('hb-' + settings.size); } else if (type == Flow.rulerType) { const ruler = element.vertical ? vr() : hr(); element.appendChild(ruler); diff --git a/js/worker.js b/js/worker.js index 829dba9..32cfea1 100644 --- a/js/worker.js +++ b/js/worker.js @@ -211,10 +211,13 @@ onmessage = async function(e){ /** * Creates a break. + * + * - **size** (number) [optional]: How large the break is. Must be between 1 and 8. */ -function createBreak(options = null) { +function createBreak(size, options = null) { const content = { type: breakType, + size, options, }; return content;