diff options
Diffstat (limited to 'src_js')
| -rw-r--r-- | src_js/common.js | 5 | ||||
| -rw-r--r-- | src_js/dragger.js | 2 | ||||
| -rw-r--r-- | src_js/states.js | 1 | ||||
| -rw-r--r-- | src_js/vt.js | 15 |
4 files changed, 14 insertions, 9 deletions
diff --git a/src_js/common.js b/src_js/common.js index a5edfbf..7d4213c 100644 --- a/src_js/common.js +++ b/src_js/common.js @@ -20,8 +20,9 @@ export async function calculate() { r.set('calculating', true); try { const method = r.get('form', 'method'); + const native = r.get('form', 'native'); const params = createCalculateParams(); - const res = await fetch(`${calculateUrl}?method=${method}`, { + const res = await fetch(`${calculateUrl}?method=${method}&native=${native}`, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(params) @@ -159,7 +160,7 @@ function createCalculateParams() { } items[name] = { width: item.width, - height: item.width, + height: item.height, can_rotate: item.can_rotate }; } diff --git a/src_js/dragger.js b/src_js/dragger.js index e591be6..78a59d5 100644 --- a/src_js/dragger.js +++ b/src_js/dragger.js @@ -23,6 +23,6 @@ document.addEventListener('mousemove', evt => { }); -document.addEventListener('mouseup', evt => { +document.addEventListener('mouseup', _ => { draggers.splice(0); }); diff --git a/src_js/states.js b/src_js/states.js index bf3584e..efc31b9 100644 --- a/src_js/states.js +++ b/src_js/states.js @@ -4,6 +4,7 @@ export const main = { method: 'forward_greedy', cut_width: 0.3, min_initial_usage: false, + native: false, panels: [], items: [] }, diff --git a/src_js/vt.js b/src_js/vt.js index ce16d3d..878280f 100644 --- a/src_js/vt.js +++ b/src_js/vt.js @@ -3,7 +3,6 @@ import * as u from '@hat-open/util'; import * as common from './common'; import * as dragger from './dragger'; -import * as states from './states'; export function main() { @@ -23,7 +22,7 @@ function leftPanelResizer() { mousedown: dragger.mouseDownHandler(evt => { const panel = evt.target.parentNode.querySelector('.left-panel'); const width = panel.clientWidth; - return (_, dx, __) => { + return (_, dx) => { panel.style.width = `${width + dx}px`; }; }) @@ -38,7 +37,7 @@ function rightPanelResizer() { mousedown: dragger.mouseDownHandler(evt => { const panel = evt.target.parentNode.querySelector('.right-panel'); const width = panel.clientWidth; - return (_, dx, __) => { + return (_, dx) => { panel.style.width = `${width - dx}px`; }; }) @@ -72,7 +71,11 @@ function leftPanel() { ['label'], checkboxInput('Minimize initial panel usage', r.get('form', 'min_initial_usage'), - val => r.set(['form', 'min_initial_usage'], val)) + val => r.set(['form', 'min_initial_usage'], val)), + ['label'], + checkboxInput('Use native implementation', + r.get('form', 'native'), + val => r.set(['form', 'native'], val)) ], ['div.content', leftPanelPanels(), @@ -99,7 +102,7 @@ function leftPanelPanels() { const valid = !panelNames.has(name); panelNames.add(name); return valid; - } + }; return ['div', ['table', @@ -198,7 +201,7 @@ function leftPanelItems() { const valid = !itemNames.has(name); itemNames.add(name); return valid; - } + }; return ['div', ['table', |
