Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce draw calls #6707

Merged
merged 94 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
af06fea
label
kazcw May 3, 2023
8869104
listview
kazcw May 3, 2023
0464891
action bar
kazcw May 4, 2023
c6c4041
node
kazcw May 4, 2023
2972753
edge
kazcw May 8, 2023
11a9846
support inserting before the first partition
kazcw May 10, 2023
7882396
edge: hover extensions
kazcw May 10, 2023
d304d0a
wip edge
kazcw May 11, 2023
6e30730
edge mouse events
kazcw May 11, 2023
9335a35
wip edge
kazcw May 12, 2023
9990e8f
SplitArc
kazcw May 15, 2023
6193053
Ignore points too far from the edge
kazcw May 16, 2023
db1dfb2
Set node/edge partitions
kazcw May 16, 2023
a3785a2
Refactor.
kazcw May 16, 2023
18981b1
Edge target attachments.
kazcw May 16, 2023
023f3a8
Review.
kazcw May 16, 2023
52eb4b9
Rectangle backwards-edge arrows.
kazcw May 16, 2023
d4135c7
Fix edge case
kazcw May 16, 2023
077ef6e
Fix target attachment coloring
kazcw May 16, 2023
1cfbf23
Tweak distance computation
kazcw May 16, 2023
eee5427
List view appearance
kazcw May 16, 2023
bdd384f
List view event delivery
kazcw May 16, 2023
1486ccf
Clean up list view mouse events
kazcw May 16, 2023
38b9551
Fix render latency
kazcw May 17, 2023
ec94767
Support Sprite without ShapeSystem with SpriteObject
kazcw May 18, 2023
664b2aa
Fix profiling for microtasks
kazcw May 16, 2023
3cfac1d
fmt
kazcw May 18, 2023
a750ac8
Merge remote-tracking branch 'origin/develop' into fast-edges
kazcw May 18, 2023
e04940c
WASM size limit
kazcw May 18, 2023
64ad0ec
rm extra file
kazcw May 18, 2023
7a28c1d
Merge remote-tracking branch 'origin/develop' into fast-edges
kazcw May 18, 2023
6f79af3
Clean up invalidation.
kazcw May 18, 2023
a5ec3d0
Edges demo scene.
kazcw May 18, 2023
58f6aa5
Refactor.
kazcw May 18, 2023
9eb274c
Fix source snap.
kazcw May 18, 2023
c512b06
Avoid visual glitch if internal error occurs.
kazcw May 19, 2023
2aed013
Refactor.
kazcw May 19, 2023
82d230f
Refactor.
kazcw May 19, 2023
c43b3d9
Clean up accidentally-committed files.
kazcw May 19, 2023
d3f946e
Docs.
kazcw May 19, 2023
4adb78e
Docs.
kazcw May 19, 2023
4d9d75b
Merge remote-tracking branch 'origin/develop' into fast-edges
kazcw May 19, 2023
f2e140a
Revert "Avoid visual glitch if internal error occurs."
kazcw May 23, 2023
2b2f1db
Draw detached edge above nodes, except its source.
kazcw May 23, 2023
3fcece2
MAX_RADIUS adjustments.
kazcw May 23, 2023
1ae1928
Adjust backward-edge arrow threshold.
kazcw May 25, 2023
5954174
Edge doesn't always enter target node at the top.
kazcw May 25, 2023
d6dbd2e
Docs.
kazcw May 25, 2023
d6dfd65
Adjust U-bend height.
kazcw May 25, 2023
16009e1
Adjust J0>J1 threshold.
kazcw May 25, 2023
a36a11b
Edge exits source before turning up.
kazcw May 25, 2023
e752314
Adjust max radius.
kazcw May 25, 2023
1da9b37
Downward edge originates further inside source.
kazcw May 25, 2023
96c0e5a
Refactor.
kazcw May 25, 2023
5e6634f
Add old edge to demo scene.
kazcw May 25, 2023
1b617fa
Upward corners exit before bending.
kazcw May 25, 2023
46c64d0
Exact U-bend height.
kazcw May 25, 2023
56f0f5a
Apply min-approach-height in all layouts.
kazcw May 25, 2023
392f434
Refactor.
kazcw May 25, 2023
8b4a173
Docs.
kazcw May 25, 2023
a280697
Exact J0>J1 transition point.
kazcw May 25, 2023
cf492c9
Exact approach height test.
kazcw May 25, 2023
0c5ad59
Refactor.
kazcw May 25, 2023
9866903
Source end of edge starts out horizontal.
kazcw May 25, 2023
e4fa962
Single-corner layout radius adjustment.
kazcw May 25, 2023
2c637b0
Refactor.
kazcw May 25, 2023
ff22741
Adjust radii in 1st 3-corner Layout.
kazcw May 25, 2023
1625c41
3-corner small-radius height adjustment.
kazcw May 25, 2023
222f366
Refactor.
kazcw May 26, 2023
e9ba149
Fix arc hover edge case.
kazcw May 26, 2023
b4f9992
Fix hover edge case.
kazcw May 26, 2023
35ec260
Fix 2px wiggle.
kazcw May 26, 2023
677e497
Now triangles can be Rectangles too
kazcw May 30, 2023
b0f170c
Rectangle arrows.
kazcw May 30, 2023
c3b07f1
Cleanup.
kazcw May 30, 2023
8126d83
Deviate from old behavior in "shark fin" case.
kazcw May 30, 2023
de58f0e
Source end exits node normal to the curve.
kazcw May 31, 2023
4e833ca
Adjust a threshold.
kazcw Jun 1, 2023
8dc38a0
Fix threshold.
kazcw Jun 1, 2023
29f82dc
Use 3-corner when target on top of node.
kazcw Jun 1, 2023
3287e4c
Make very short edges less sharp.
kazcw Jun 1, 2023
22a7317
Merge remote-tracking branch 'origin/develop' into fast-edges
kazcw Jun 2, 2023
ac0a14e
Fix merge conflict.
kazcw Jun 2, 2023
41a6515
Lint.
kazcw Jun 2, 2023
050ebeb
Merge branch 'develop' into wip/kw/fix-render-latency
kazcw Jun 2, 2023
c82509a
Improve terminology.
kazcw Jun 2, 2023
463a9f6
Merge remote-tracking branch 'origin/wip/kw/fix-render-latency' into …
kazcw Jun 2, 2023
ddf8fb6
Fix missed usage in rename.
kazcw Jun 2, 2023
23b8d42
Tweak layering.
kazcw Jun 5, 2023
3ba29a2
Remove old edges from example scene.
kazcw Jun 5, 2023
ecce741
Merge branch 'develop' into wip/kw/fast-edges
kazcw Jun 5, 2023
c091ff4
Escape diagrams so they don't scare the lexer.
kazcw Jun 5, 2023
6902368
Bump wasm limit.
kazcw Jun 6, 2023
a11db99
Bump wasm limit.
kazcw Jun 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/gui/view/examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
debug-scene-component-list-panel-view = { path = "component-list-panel-view" }
debug-scene-documentation = { path = "documentation" }
debug-scene-graph-editor-edges = { path = "graph-editor-edges" }
debug-scene-icons = { path = "icons" }
debug-scene-interface = { path = "interface" }
debug-scene-text-grid-visualization = { path = "text-grid-visualization" }
Expand Down
20 changes: 20 additions & 0 deletions app/gui/view/examples/graph-editor-edges/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "debug-scene-graph-editor-edges"
version = "0.1.0"
authors = ["Enso Team <[email protected]>"]
edition = "2021"

[lib]
crate-type = ["cdylib", "rlib"]

[dependencies]
enso-frp = { path = "../../../../../lib/rust/frp" }
ensogl = { path = "../../../../../lib/rust/ensogl" }
ensogl-hardcoded-theme = { path = "../../../../../lib/rust/ensogl/app/theme/hardcoded" }
ide-view-graph-editor = { path = "../../graph-editor" }
nalgebra = { workspace = true }
wasm-bindgen = { workspace = true }

# Stop wasm-pack from running wasm-opt, because we run it from our build scripts in order to customize options.
[package.metadata.wasm-pack.profile.release]
wasm-opt = false
139 changes: 139 additions & 0 deletions app/gui/view/examples/graph-editor-edges/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
//! Example scene showing a graph editor edge.
//! - Click-and-drag the source and target node-like objects to see the computed edge shape.
//! - Hover over the edge to see the focused portion.

#![recursion_limit = "256"]
// === Standard Linter Configuration ===
#![deny(non_ascii_idents)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
#![warn(missing_docs)]
#![warn(trivial_casts)]
#![warn(trivial_numeric_casts)]
#![warn(unsafe_code)]
#![warn(unused_import_braces)]
#![warn(unused_qualifications)]

use ensogl::display::shape::*;
use ensogl::display::traits::*;
use ensogl::prelude::*;

use ensogl::application::Application;
use ensogl::control::io::mouse;
use ensogl::data::color;
use ensogl::display;
use ensogl::display::navigation::navigator::Navigator;
use ensogl::display::Scene;
use ensogl::frp;
use ensogl::system::web;
use ide_view_graph_editor::component::edge::Edge;
use ide_view_graph_editor::component::node;



// =================
// === Constants ===
// =================

/// Location of the center of the source node-like object, in screen coordinates.
const SOURCE_CENTER: Vector2 = Vector2(0.0, 0.0);
/// Width of the example source node-like object, in pixels.
const ARBITRARY_NODE_WIDTH: f32 = 100.0;
/// The initial value, in pixels, of the offset between the center of the source and center of the
/// target.
const INITIAL_TARGET_OFFSET: Vector2 = Vector2(150.0, -200.0);



// ===================
// === Entry Point ===
// ===================

/// The example entry point.
#[entry_point(graph_editor_edges)]
pub fn main() {
let app = Application::new("root");

let world = &app.display;
let scene = &world.default_scene;
let navigator = Navigator::new(scene, &scene.layers.node_searcher.camera());
let greenish = color::Lcha(0.5, 0.5, 0.5, 1.0);
let lowest_layer = &scene.layers.viz;

let source = Rectangle::new();
let source_center = SOURCE_CENTER;
let source_size = Vector2(ARBITRARY_NODE_WIDTH, node::HEIGHT);
source.set_size(source_size);
source.set_color(color::Rgba(0.75, 0.75, 0.75, 1.0));
source.set_border_color(color::Rgba::transparent());
source.set_corner_radius_max();
source.set_xy(source_center - source_size / 2.0);
lowest_layer.add(&source);
world.add_child(&source);
let source_moved = make_draggable(scene, &source);

let target = Rectangle::new();
let target_center = source_center + INITIAL_TARGET_OFFSET;
let target_size = Vector2(node::HEIGHT, node::HEIGHT);
target.set_size(target_size);
target.set_color(color::Rgba(0.75, 0.75, 0.75, 1.0));
target.set_border_color(color::Rgba::transparent());
target.set_corner_radius_max();
target.set_xy(target_center - target_size / 2.0);
lowest_layer.add(&target);
world.add_child(&target);
let target_moved = make_draggable(scene, &target);

let edge = Edge::new(&app);
edge.set_disabled(false);
edge.set_color(greenish);
edge.source_size(source_size);
edge.target_attached(true);
edge.source_attached(true);
world.add_child(&edge);

let network = edge.network();
let target_ = target.display_object().clone_ref();
let source_ = source.display_object().clone_ref();
frp::extend! { network
init <- source_();
_eval <- all_with(&target_moved, &init, f!([edge, target_] (_, _) {
edge.target_position(target_.xy() + target_size / 2.0)
}));
_eval <- all_with(&source_moved, &init, f!([edge, source_] (_, _) {
edge.set_xy(source_.xy() + source_size / 2.0)
}));
}
init.emit(());

web::document
.get_element_by_id("loader")
.map(|t| t.parent_node().map(|p| p.remove_child(&t).unwrap()));

mem::forget(app);
mem::forget(source);
mem::forget(target);
mem::forget(edge);
mem::forget(navigator);
}

fn make_draggable(scene: &Scene, object: impl display::Object) -> frp::Stream<()> {
let object = object.display_object();
let mouse_down = object.on_event::<mouse::Down>();
let mouse_move = object.on_event::<mouse::Move>();
let mouse_up = scene.on_event::<mouse::Up>();
let network = &object.network;
frp::extend! { network
on_drag <- source::<()>();
drag_offset <- any(...);
drag_offset <+ mouse_down.map(f!([object] (e) Some(object.xy() - e.client_centered())));
drag_offset <+ mouse_up.constant(None);
_eval <- mouse_move.map2(&drag_offset, f!([object, on_drag] (e, offset) {
if let Some(offset) = offset {
object.set_xy(e.client_centered() + offset);
on_drag.emit(());
}
}));
}
on_drag.into()
}
1 change: 1 addition & 0 deletions app/gui/view/examples/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
pub use debug_scene_component_list_panel_view as new_component_list_panel_view;
pub use debug_scene_documentation as documentation;
pub use debug_scene_execution_environment_dropdown as execution_environment_dropdown;
pub use debug_scene_graph_editor_edges as graph_editor_edges;
pub use debug_scene_icons as icons;
pub use debug_scene_interface as interface;
pub use debug_scene_text_grid_visualization as text_grid_visualization;
Expand Down
Loading