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

Scrolling refactoring and Bug fixes. Add Axis enum arg to Edge::Position in graph. #662

Merged
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
b7951c9
Begin simplifcation of scroll.rs module. WIP (only implemented Y axis…
mitchmindtree Jan 8, 2016
e748f56
Update graph modules to store a Position edge for relative positionin…
mitchmindtree Jan 8, 2016
0cfefb7
Add Axis enum with X and Y variants, used within the graph Position e…
mitchmindtree Jan 8, 2016
edbb8c6
Update widget modules to simplification of scroll module. Change scro…
mitchmindtree Jan 8, 2016
e740795
Update backend/graphics draw_scrolling function to latest WIP scroll …
mitchmindtree Jan 8, 2016
cd274ee
Export new Axis position type
mitchmindtree Jan 8, 2016
37350e8
Provide methods for viewing the currently updated and previously upda…
mitchmindtree Jan 8, 2016
8e4e16b
Update examples to latest scroll method name changes, i.e. scrolling …
mitchmindtree Jan 8, 2016
18fa077
Re-add support for interactive scroll handle and track. Make Scroll g…
mitchmindtree Jan 9, 2016
d78fcfd
Fix doc so that rustc doesn't try to compile scroll ascii art
mitchmindtree Jan 9, 2016
ba9f464
Remove unnecessary scroll Interaction import
mitchmindtree Jan 9, 2016
0c37be0
Vastly simplify bounding_box calculation algorithm, refining the nece…
mitchmindtree Jan 9, 2016
9c7f08d
Update to newer, simplified kids_bounding_box graph algorithm
mitchmindtree Jan 9, 2016
69d5270
Use kid_area of previous update so that the bounding box calculated f…
mitchmindtree Jan 9, 2016
64a217e
Update scrolling ascii art docs with offset_bounds example. Add docs …
mitchmindtree Jan 9, 2016
46bd030
Attempt to build all_widgets example successfully on nightly by using…
mitchmindtree Jan 9, 2016
45594c5
Increment crates.io version for breaking changes.
mitchmindtree Jan 9, 2016
9e11a0b
Have scroll offset_bounds allow for the padding specified by the KidA…
mitchmindtree Jan 9, 2016
d7dbfea
Update all_widgets example to take advantage of new scroll offset_bou…
mitchmindtree Jan 9, 2016
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
Prev Previous commit
Next Next commit
Attempt to build all_widgets example successfully on nightly by using…
… a channel to update matrix elements instead of borrowing the matrix directly in the inner closure.
mitchmindtree committed Jan 9, 2016
commit 46bd0306e05be24b1bd80789a57c62d201516cf2
19 changes: 16 additions & 3 deletions examples/all_widgets.rs
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ use conrod::{
};
use conrod::color::{self, rgb};
use piston_window::{EventLoop, Glyphs, PistonWindow, UpdateEvent, WindowSettings};
use std::sync::mpsc;


type Ui = conrod::Ui<Glyphs>;
@@ -76,12 +77,16 @@ struct DemoApp {
circle_pos: Point,
/// Envelope for demonstration of EnvelopeEditor.
envelopes: Vec<(Vec<Point>, String)>,
/// A channel for sending results from the `WidgetMatrix`.
elem_sender: mpsc::Sender<(usize, usize, bool)>,
elem_receiver: mpsc::Receiver<(usize, usize, bool)>,
}

impl DemoApp {

/// Constructor for the Demonstration Application model.
fn new() -> DemoApp {
let (elem_sender, elem_receiver) = mpsc::channel();
DemoApp {
bg_color: rgb(0.2, 0.35, 0.45),
show_button: false,
@@ -114,6 +119,8 @@ impl DemoApp {
[0.3, 0.2],
[0.6, 0.6],
[1.0, 0.0], ], "Envelope B".to_string())],
elem_sender: elem_sender,
elem_receiver: elem_receiver,
}
}

@@ -327,14 +334,20 @@ fn set_widgets(ui: &mut Ui, app: &mut DemoApp) {
// You can return any type that implements `Widget`.
// The returned widget will automatically be positioned and sized to the matrix
// element's rectangle.
let elem = &mut app.bool_matrix[col][row];
Toggle::new(*elem)
let elem = app.bool_matrix[col][row];
let elem_sender = app.elem_sender.clone();
Toggle::new(elem)
.rgba(r, g, b, a)
.frame(app.frame_width)
.react(move |new_val: bool| *elem = new_val)
.react(move |new_val: bool| elem_sender.send((col, row, new_val)).unwrap())
})
.set(TOGGLE_MATRIX, ui);

// Receive updates to the matrix from the `WidgetMatrix`.
while let Ok((col, row, value)) = app.elem_receiver.try_recv() {
app.bool_matrix[col][row] = value;
}

// A demonstration using a DropDownList to select its own color.
let mut ddl_color = app.ddl_color;
DropDownList::new(&mut app.ddl_colors, &mut app.selected_idx)