timeline_width/viewport_width/viewport_x
This commit is contained in:
parent
48dad951a5
commit
7107f77c82
11 changed files with 188 additions and 37 deletions
|
@ -52,12 +52,14 @@ impl PixiCanvas {
|
|||
let task_with_controller = Mutable::new(None);
|
||||
// -- FastWave-specific --
|
||||
let timeline_getter = Rc::new(Closure::new(
|
||||
|signal_ref_index, screen_width, row_height, var_format| {
|
||||
|signal_ref_index, timeline_width, timeline_viewport_width, timeline_viewport_x, row_height, var_format| {
|
||||
future_to_promise(async move {
|
||||
let signal_ref = wellen::SignalRef::from_index(signal_ref_index).unwrap_throw();
|
||||
let timeline = platform::load_signal_and_get_timeline(
|
||||
signal_ref,
|
||||
screen_width,
|
||||
timeline_width,
|
||||
timeline_viewport_width,
|
||||
timeline_viewport_x,
|
||||
row_height,
|
||||
serde_wasm_bindgen::from_value(var_format).unwrap_throw(),
|
||||
)
|
||||
|
@ -81,7 +83,14 @@ impl PixiCanvas {
|
|||
}))
|
||||
.after_insert(clone!((controller, timeline_getter) move |element| {
|
||||
Task::start(async move {
|
||||
let pixi_controller = js_bridge::PixiController::new(row_height, row_gap, &timeline_getter);
|
||||
let pixi_controller = js_bridge::PixiController::new(
|
||||
width.get(),
|
||||
width.get(),
|
||||
0,
|
||||
row_height,
|
||||
row_gap,
|
||||
&timeline_getter
|
||||
);
|
||||
pixi_controller.init(&element).await;
|
||||
controller.set(Some(pixi_controller));
|
||||
});
|
||||
|
@ -113,11 +122,13 @@ mod js_bridge {
|
|||
|
||||
type TimelinePromise = js_sys::Promise;
|
||||
type SignalRefIndex = usize;
|
||||
type ScreenWidth = u32;
|
||||
type TimelineWidth = u32;
|
||||
type TimelineViewportWidth = u32;
|
||||
type TimelineViewportX = u32;
|
||||
type RowHeight = u32;
|
||||
type VarFormatJs = JsValue;
|
||||
type TimelineGetter =
|
||||
Closure<dyn FnMut(SignalRefIndex, ScreenWidth, RowHeight, VarFormatJs) -> TimelinePromise>;
|
||||
Closure<dyn FnMut(SignalRefIndex, TimelineWidth, TimelineViewportWidth, TimelineViewportX, RowHeight, VarFormatJs) -> TimelinePromise>;
|
||||
|
||||
// Note: Add all corresponding methods to `frontend/typescript/pixi_canvas/pixi_canvas.ts`
|
||||
#[wasm_bindgen(module = "/typescript/bundles/pixi_canvas.js")]
|
||||
|
@ -128,6 +139,9 @@ mod js_bridge {
|
|||
// @TODO `row_height` and `row_gap` is FastWave-specific
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new(
|
||||
timeline_width: u32,
|
||||
timeline_viewport_width: u32,
|
||||
timeline_viewport_x: u32,
|
||||
row_height: u32,
|
||||
row_gap: u32,
|
||||
timeline_getter: &TimelineGetter,
|
||||
|
@ -143,7 +157,13 @@ mod js_bridge {
|
|||
pub fn destroy(this: &PixiController);
|
||||
|
||||
#[wasm_bindgen(method)]
|
||||
pub fn screen_width(this: &PixiController) -> u32;
|
||||
pub fn get_timeline_width(this: &PixiController) -> u32;
|
||||
|
||||
#[wasm_bindgen(method)]
|
||||
pub fn get_timeline_viewport_width(this: &PixiController) -> u32;
|
||||
|
||||
#[wasm_bindgen(method)]
|
||||
pub fn get_timeline_viewport_x(this: &PixiController) -> u32;
|
||||
|
||||
// -- FastWave-specific --
|
||||
|
||||
|
|
Reference in a new issue