dont show edit mode overlay while resizing

This commit is contained in:
galister 2026-07-05 22:56:01 +09:00
parent 5dd7339b61
commit ab578b8e35
3 changed files with 16 additions and 24 deletions

View File

@ -35,13 +35,13 @@ static LINE_AUTO_INCREMENT: AtomicUsize = AtomicUsize::new(1);
pub(super) const LINE_WIDTH: f32 = 0.002;
// TODO customizable colors
static COLORS: [[f32; 6]; 5] = {
static COLORS: [[f32; 4]; 5] = {
[
[1., 1., 1., 1., 0., 0.],
[0., 0.375, 0.5, 1., 0., 0.],
[0.69, 0.188, 0., 1., 0., 0.],
[0.375, 0., 0.5, 1., 0., 0.],
[1., 0., 0., 1., 0., 0.],
[1., 1., 1., 1.],
[0., 0.375, 0.5, 1.],
[0.69, 0.188, 0., 1.],
[0.375, 0., 0.5, 1.],
[1., 0., 0., 1.],
]
};
@ -69,7 +69,7 @@ impl LinePool {
let buf_color = app
.gfx
.empty_buffer(BufferUsage::TRANSFER_DST | BufferUsage::UNIFORM_BUFFER, 6)?;
.empty_buffer(BufferUsage::TRANSFER_DST | BufferUsage::UNIFORM_BUFFER, 4)?;
let set0 = self.pipeline.buffer(0, buf_color.clone())?;
@ -173,7 +173,7 @@ impl LinePool {
.next()
.unwrap();
line.buf_color.write()?[0..6].copy_from_slice(&COLORS[inner.color]);
line.buf_color.write()?[0..4].copy_from_slice(&COLORS[inner.color]);
let mut cmd_buffer = app
.gfx

View File

@ -238,12 +238,15 @@ impl OverlayBackend for EditModeBackendWrapper {
self.inner.render(app, rdr)?;
}
self.panel.render(app, rdr)?;
// `GuiPanel` is not stereo-aware, so just render the same pass twice
if rdr.cmd_bufs.len() > 1 {
rdr.cmd_bufs.reverse();
// during resize, just fade the color
if matches!(self.panel.state.resize, ResizeState::None) {
self.panel.render(app, rdr)?;
rdr.cmd_bufs.reverse();
// `GuiPanel` is not stereo-aware, so just render the same pass twice
if rdr.cmd_bufs.len() > 1 {
rdr.cmd_bufs.reverse();
self.panel.render(app, rdr)?;
rdr.cmd_bufs.reverse();
}
}
self.extent = rdr.extent;

View File

@ -1,24 +1,13 @@
#version 310 es
precision highp float;
layout (location = 0) in vec2 in_uv;
layout (location = 0) out vec4 out_color;
layout (set = 0, binding = 0) uniform ColorBlock {
uniform vec4 in_color;
uniform vec2 corner_radius;
};
void main()
{
out_color.r = corner_radius.r;
out_color = in_color;
vec2 uv_circ = ((1. - corner_radius) - (abs(in_uv + vec2(-0.5)) * 2.))/corner_radius;
float dist = length(uv_circ);
out_color.a = mix(out_color.a, 0.,
float(dist > 1.)
* float(uv_circ.x < 0.)
* float(uv_circ.y < 0.));
}