#egui #expression #rhai #ui #math

egui_drag_value_expr

An egui DragValue widget modified to accept a math expression as input

2 releases

0.1.1 Jun 2, 2024
0.1.0 Jun 2, 2024

#465 in GUI

MIT/Apache

30KB

egui_drag_value_expr

Crates.io

An egui DragValue widget that accepts expression-based values.

Usage

A rhai::Scope can be passed to the DragValueExpr widget to allow the user to enter expressions that reference variables in the scope.

With a scope:

let mut scope = rhai::Scope::new();
scope.push("ten", 10.);
ui.add(DragValueExpr::new(&mut self.value, Some(&scope)));

Without a scope:

ui.add(DragValueExpr::new(&mut self.value, None));

Contributing

PRs, feature requests, and issues are welcome!


lib.rs:

egui_drag_value_expr

An egui DragValue widget that accepts expression-based values.

Usage

A rhai::Scope can be passed to the DragValueExpr widget to allow the user to enter expressions that reference variables in the scope.

With a scope:

let mut scope = rhai::Scope::new();
scope.push("ten", 10.);
ui.add(DragValueExpr::new(&mut self.value, Some(&scope)));

Without a scope:

ui.add(DragValueExpr::new(&mut self.value, None));

Dependencies

~7–13MB
~146K SLoC