hide invisible blocks
This commit is contained in:
parent
e934ac031d
commit
257b83b582
|
@ -35219,14 +35219,14 @@ var PixiController = class {
|
|||
}
|
||||
async zoom_or_pan(wheel_delta_y, shift_key, offset_x) {
|
||||
if (shift_key) {
|
||||
this.timeline_viewport_x -= Math.sign(wheel_delta_y) * 20;
|
||||
this.timeline_viewport_x += Math.sign(wheel_delta_y) * 20;
|
||||
} else {
|
||||
const offset_x_ratio = offset_x / this.timeline_viewport_width;
|
||||
const old_timeline_width = this.timeline_viewport_width * this.timeline_zoom;
|
||||
this.timeline_zoom -= Math.sign(wheel_delta_y) * 0.1;
|
||||
this.timeline_zoom -= Math.sign(wheel_delta_y) * this.timeline_zoom * 0.5;
|
||||
const new_timeline_width = this.timeline_viewport_width * this.timeline_zoom;
|
||||
const timeline_width_difference = new_timeline_width - old_timeline_width;
|
||||
this.timeline_viewport_x -= timeline_width_difference * offset_x_ratio;
|
||||
this.timeline_viewport_x += timeline_width_difference * offset_x_ratio;
|
||||
}
|
||||
this.redraw_all_rows();
|
||||
}
|
||||
|
@ -35304,7 +35304,7 @@ var VarSignalRow = class {
|
|||
this.draw();
|
||||
}
|
||||
draw() {
|
||||
if (this.app.screen === null) {
|
||||
if (this.app === null || this.app.screen === null) {
|
||||
return;
|
||||
}
|
||||
this.row_container_background.width = this.app.screen.width;
|
||||
|
|
|
@ -149,15 +149,15 @@ export class PixiController {
|
|||
|
||||
async zoom_or_pan(wheel_delta_y: number, shift_key: boolean, offset_x: number) {
|
||||
if (shift_key) {
|
||||
this.timeline_viewport_x -= Math.sign(wheel_delta_y) * 20;
|
||||
this.timeline_viewport_x += Math.sign(wheel_delta_y) * 20;
|
||||
} else {
|
||||
// @TODO fix, bounds
|
||||
// @TODO bounds
|
||||
const offset_x_ratio = offset_x / this.timeline_viewport_width;
|
||||
const old_timeline_width = this.timeline_viewport_width * this.timeline_zoom;
|
||||
this.timeline_zoom -= Math.sign(wheel_delta_y) * 0.1;
|
||||
this.timeline_zoom -= Math.sign(wheel_delta_y) * this.timeline_zoom * 0.5;
|
||||
const new_timeline_width = this.timeline_viewport_width * this.timeline_zoom;
|
||||
const timeline_width_difference = new_timeline_width - old_timeline_width;
|
||||
this.timeline_viewport_x -= timeline_width_difference * offset_x_ratio;
|
||||
this.timeline_viewport_x += timeline_width_difference * offset_x_ratio;
|
||||
}
|
||||
this.redraw_all_rows();
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ class VarSignalRow {
|
|||
draw() {
|
||||
// Screen can be null when we are, for instance, switching between miller columns and tree layout
|
||||
// and then the canvas has to be recreated
|
||||
if (this.app.screen === null) {
|
||||
if (this.app === null || this.app.screen === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,14 +23,12 @@ pub fn signal_to_timeline(
|
|||
let timeline_viewport_x = timeline_viewport_x as f64;
|
||||
let timeline_width = timeline_viewport_width as f64 * timeline_zoom;
|
||||
|
||||
// @TODO hide blocks not visible in the viewport
|
||||
|
||||
let mut x_value_pairs = signal
|
||||
.iter_changes()
|
||||
.map(|(index, value)| {
|
||||
let index = index as usize;
|
||||
let time = time_table[index] as f64;
|
||||
let x = time / last_time * timeline_width + timeline_viewport_x;
|
||||
let x = time / last_time * timeline_width - timeline_viewport_x;
|
||||
(x, value)
|
||||
})
|
||||
.peekable();
|
||||
|
@ -38,16 +36,23 @@ pub fn signal_to_timeline(
|
|||
// @TODO parallelize?
|
||||
let mut blocks = Vec::new();
|
||||
while let Some((block_x, value)) = x_value_pairs.next() {
|
||||
if block_x >= (timeline_viewport_width as f64) {
|
||||
break;
|
||||
}
|
||||
|
||||
let next_block_x = if let Some((next_block_x, _)) = x_value_pairs.peek() {
|
||||
*next_block_x
|
||||
} else {
|
||||
timeline_width + timeline_viewport_x
|
||||
timeline_width - timeline_viewport_x
|
||||
};
|
||||
|
||||
let block_width = (next_block_x - block_x) as u32;
|
||||
if block_width < MIN_BLOCK_WIDTH {
|
||||
continue;
|
||||
}
|
||||
if block_x + (block_width as f64) <= 0. {
|
||||
continue;
|
||||
}
|
||||
|
||||
// @TODO cache?
|
||||
let value = var_format.format(value);
|
||||
|
|
Loading…
Reference in a new issue