Collab ui2 (#3357)

* Clickable context menus & movable panels – what will they think of
next?!

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2023-11-17 13:33:18 -07:00 committed by GitHub
commit 624bd0a05a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 302 additions and 150 deletions

View file

@ -71,11 +71,12 @@ impl EntityMap {
#[track_caller]
pub fn lease<'a, T>(&mut self, model: &'a Model<T>) -> Lease<'a, T> {
self.assert_valid_context(model);
let entity = Some(
self.entities
.remove(model.entity_id)
.expect("Circular entity lease. Is the entity already being updated?"),
);
let entity = Some(self.entities.remove(model.entity_id).unwrap_or_else(|| {
panic!(
"Circular entity lease of {}. Is it already being updated?",
std::any::type_name::<T>()
)
}));
Lease {
model,
entity,

View file

@ -1124,9 +1124,14 @@ where
}
}
}
// if self.hover_style.is_some() {
if bounds.contains_point(&mouse_position) {
// eprintln!("div hovered {bounds:?} {mouse_position:?}");
style.refine(&self.hover_style);
} else {
// eprintln!("div NOT hovered {bounds:?} {mouse_position:?}");
}
// }
if let Some(drag) = cx.active_drag.take() {
for (state_type, group_drag_style) in &self.group_drag_over_styles {

View file

@ -1205,10 +1205,7 @@ extern "C" fn handle_view_event(this: &Object, _: Sel, native_event: id) {
InputEvent::MouseMove(_) if !(is_active || lock.kind == WindowKind::PopUp) => return,
InputEvent::MouseUp(MouseUpEvent {
button: MouseButton::Left,
..
}) => {
InputEvent::MouseUp(MouseUpEvent { .. }) => {
lock.synthetic_drag_counter += 1;
}

View file

@ -191,6 +191,10 @@ impl AnyView {
self.model.entity_type
}
pub fn entity_id(&self) -> EntityId {
self.model.entity_id()
}
pub(crate) fn draw(
&self,
origin: Point<Pixels>,