From 0466d36f4d9097ca81e3078beff43830e818979d Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Fri, 14 Jan 2022 23:30:06 -0500 Subject: [PATCH] fix hover/drop highlight. more left menu tweaks --- src/main/mesh.js | 5 +++-- src/mesh/api.js | 8 ++++++-- src/mesh/build.js | 9 +++++---- web/mesh/index.css | 16 ++++++++++++++-- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/main/mesh.js b/src/main/mesh.js index 9f75d1c2..4d2edd41 100644 --- a/src/main/mesh.js +++ b/src/main/mesh.js @@ -140,7 +140,7 @@ function space_init(data) { space.event.addHandlers(self, [ 'drop', (evt) => { estop(evt); - platform.setColor(platcolor); + platform.set({ opacity: 0, color: platcolor }); call.load_files([...evt.dataTransfer.files]); }, 'dragover', evt => { @@ -148,9 +148,10 @@ function space_init(data) { evt.dataTransfer.dropEffect = 'copy'; let color = platform.setColor(0x00ff00); if (color !== 0x00ff00) platcolor = color; + platform.set({ opacity: 0.1 }); }, 'dragleave', evt => { - platform.setColor(platcolor); + platform.set({ opacity: 0, color: platcolor }); }, 'keypress', evt => { if (api.modal.showing) { diff --git a/src/mesh/api.js b/src/mesh/api.js index 2b98e36f..71008ab9 100644 --- a/src/mesh/api.js +++ b/src/mesh/api.js @@ -286,8 +286,8 @@ let file = { // return selection if models are invalid. can happen when called from // even bound to a button which delivers a PointEvent argument -function fallback(models) { - return Array.isArray(models) ? models : selection.models(); +function fallback(models, strict) { + return Array.isArray(models) ? models : selection.models(strict); } let tool = { @@ -307,6 +307,10 @@ let tool = { }); }, + split(models) { + models = fallback(models); + }, + duplicate() { for (let m of selection.models()) { m.duplicate(); diff --git a/src/mesh/build.js b/src/mesh/build.js index 990935c1..fd6ec96b 100644 --- a/src/mesh/build.js +++ b/src/mesh/build.js @@ -227,7 +227,7 @@ function ui_build() { h.div([ // create and bind file loading elements h.div({ _: "file", class: "head" }), - h.div({ class: "vsep" }), + // h.div({ class: "vsep" }), h.button({ _: 'import', onclick: file.import }, [ h.input({ id: "import", type: "file", class: ["hide"], multiple: true, @@ -238,7 +238,7 @@ function ui_build() { ]), h.div([ h.div({ _: "view", class: "head" }), - h.div({ class: "vsep" }), + // h.div({ class: "vsep" }), h.button({ _: 'visible', onclick() { selection.visible({ toggle: true }) } }), h.button({ _: 'bounds', onclick() { selection.boundsBox({ toggle: true }) } }), h.button({ _: 'gridlines', onclick() { api.grid() } }), @@ -247,14 +247,15 @@ function ui_build() { ]), h.div([ h.div({ _: "edit", class: "head" }), - h.div({ class: "vsep" }), + // h.div({ class: "vsep" }), h.button({ _: 'duplicate', onclick: tool.duplicate }), h.button({ _: 'merge', onclick: tool.merge }), + h.button({ _: 'split', onclick: tool.split }), h.button({ _: 'invert', onclick: tool.invert }), ]), h.div([ h.div({ _: "fix", class: "head" }), - h.div({ class: "vsep" }), + // h.div({ class: "vsep" }), h.button({ _: 'analyze', onclick: tool.analyze }), h.button({ _: 'repair', onclick: tool.repair }), h.button({ _: 'clean', onclick: tool.clean }), diff --git a/web/mesh/index.css b/web/mesh/index.css index 2ef15c2a..a63324cd 100644 --- a/web/mesh/index.css +++ b/web/mesh/index.css @@ -153,6 +153,16 @@ button:hover { display: none; } +.pad3 { + width: 3px; + height: 3px; +} + +.pad5 { + width: 5px; + height: 5px; +} + #top-right { position: absolute; padding: 3px; @@ -216,6 +226,7 @@ button:hover { } #modal_frame > div { + flex-direction: column; padding: 5px; /* compensate for removing padding above */ } @@ -362,10 +373,11 @@ button:hover { } #actions .head { + color: #444; align-items: center; justify-content: center; - font-family: monospace; - font-weight: bold; + font-family: 'Russo One', monospace; + font-weight: lighter; font-size: smaller; border-radius: 3px; background-color: rgba(150,150,150,0.05);