-
Notifications
You must be signed in to change notification settings - Fork 323
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
Implementation of elements adding to List Editor and a lot of internal API #6390
Conversation
f!([model] (gap, gaps, pos, size, is_dragging, enable_all, enable_last) { | ||
let is_close_x = pos.x > -gap && pos.x < size.x + gap; | ||
let is_close_y = pos.y > -gap && pos.y < size.y + gap; | ||
let is_close = is_close_x && is_close_y; | ||
let opt_gap = gaps.find(pos.x); | ||
opt_gap.and_then(|gap| { | ||
let last_gap = *gap == gaps.len() - 1; | ||
let enabled = is_close && !is_dragging; | ||
let enabled = enabled && (*enable_all || (*enable_last && last_gap)); | ||
enabled.and_option_from(|| model.item_or_placeholder_index_to_index(gap)) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make it a method? Also, the FRP node name is unclear: of what element is the index?
eval frp.remove([model, on_item_removed] (index) { | ||
if let Some(item) = model.borrow_mut().trash_item_at(*index) { | ||
on_item_removed.emit(Response::api((*index, Rc::new(item).downgrade()))); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it impossible to express this node as on_item_removed <+ frp.remove.filter_map(...)
? It would keep the FRP traces.
eval target_on_start([model, on_item_removed] (t) { | ||
if let Some((index, item)) = model.borrow_mut().start_item_drag(t) { | ||
on_item_removed.emit(Response::gui((index, Rc::new(item).downgrade()))); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
} | ||
(is_dragging, drag_diff) | ||
(status, drag_diff) | ||
} | ||
|
||
/// Implementation of item trashing logic. See docs of this crate to learn more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This docs should explain return values. Also, the terms in docs should be consistent - here we say about "trashing", but the crates docs (where the user is sent) says about "removing".
To make life easier you may make a link like See [docs of this crate](crate) ...
} | ||
|
||
impl<T: display::Object + 'static> Model<T> { | ||
impl<T: display::Object + CloneRef + 'static> Model<T> { | ||
// FIXME: refactor and generalize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When it would be fixed? Is there a task when we plan to do this?
self.init_precision_popup(); | ||
self.init_information_tooltip(); | ||
self.init_component_layout(); | ||
self.init_component_colors(); | ||
// self.init_component_colors(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented code.
@@ -264,33 +263,30 @@ impl Model { | |||
} | |||
|
|||
/// Set whether the lower overfow marker is visible. | |||
pub fn set_value_indicator(&self, indicator: &ValueIndicator) { | |||
pub fn kind(&self, indicator: &Kind) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update docs, and perhaps var name too.
// slider.frp.set_background_color(color::Lcha(0.8, 0.0, 0.0, 1.0)); | ||
// slider.frp.set_max_value(5.0); | ||
// slider.frp.set_default_value(1.0); | ||
// slider.frp.set_value(1.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented code
// comp_size <- all2(&input.set_width, &input.set_height).map(|(w, h)| Vector2(*w,*h)); | ||
eval obj.on_resized((size) model.update_size(*size)); | ||
eval input.kind((i) model.kind(i)); | ||
// output.width <+ input.set_width; | ||
// output.height <+ input.set_height; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented code.
// overflow_marker_position <- all3( | ||
// &input.set_width, | ||
// &input.set_height, | ||
// &input.orientation, | ||
// ); | ||
// eval overflow_marker_position((p) model.set_overflow_marker_position(p)); | ||
// overflow_marker_shape <- all2(&model.value_text_left.height, &input.orientation); | ||
// eval overflow_marker_shape((s) model.set_overflow_marker_shape(s)); | ||
// | ||
// eval input.set_label_hidden((v) model.set_label_hidden(*v)); | ||
// model.label.set_content <+ input.set_label; | ||
// label_position <- all6( | ||
// &input.set_width, | ||
// &input.set_height, | ||
// &model.label.width, | ||
// &model.label.height, | ||
// &input.set_label_position, | ||
// &input.orientation, | ||
// ); | ||
// eval label_position((p) model.set_label_position(p)); | ||
|
||
// output.orientation <+ input.orientation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented code.
All the comments from Adam will be addressed in the next PR (I will open it tonight) as we need this merged fast. |
* develop: Passing events to sub-widgets in List Editor and refactoring of the slider component. (#6433) Revert "Cloud/desktop mode switcher (#6308)" (#6444) Widgets integrated with graph nodes (#6347) Table Visualization and display text changes. (#6382) Skip redundant compilations (#6436) Add parse extensions to Text type. #6330 (#6404) Cloud/desktop mode switcher (#6308) Replace Table should_equal with should_equal_verbose (#6405) Rollback event handling changes for the mouse (#6396) Dashboard directory interactivity (#6279) Ability to change the execution environment between design and live. (#6341) Implementation of elements adding to List Editor and a lot of internal API (#6390) Drop method exported from WASM + removing leaks. (#6365) Turn null into UnexpectedExpression when Union type is incomplete (#6415)
Pull Request Description
This PR makes it possible to add elements to List Editor and extends internal API to notify about the operations performed:
Screen.Recording.2023-04-24.at.13.36.51.mov
Important Notes
This PR also changes the implementation of slider. The old implementation had a few bugs and did not use modern EnsoGL stuff, such as display-object-based sizing. The implementation is not finished, but will be in the next day or two. As we want to merge it fast, it is here in a not-finished state. But as no one uses the slider yet, we might accept it.
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.