Reapply node output regression fix that got reverted by accident (#3928)

Reapplies a change from #3886 

### Important Notes

There is no new code here. This change got accidentally reverted in #3890 and needs to be reapplied.
This commit is contained in:
Paweł Grabarz 2022-11-30 13:35:33 +01:00 committed by GitHub
parent 0e37cb1957
commit 1285dbd809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,6 +148,7 @@ ensogl::define_endpoints! {
expression_label_visibility (bool), expression_label_visibility (bool),
tooltip (tooltip::Style), tooltip (tooltip::Style),
view_mode (view::Mode), view_mode (view::Mode),
size (Vector2),
} }
} }
@ -330,11 +331,6 @@ impl Model {
#[profile(Debug)] #[profile(Debug)]
fn set_size(&self, size: Vector2) { fn set_size(&self, size: Vector2) {
self.ports.set_x(size.x / 2.0); self.ports.set_x(size.x / 2.0);
self.traverse_borrowed_expression_mut(|is_a_port, node, _| {
if is_a_port {
node.payload_mut().set_size(size)
}
})
} }
#[profile(Debug)] #[profile(Debug)]
@ -379,10 +375,12 @@ impl Model {
port_frp.set_type_label_visibility <+ self.frp.type_label_visibility; port_frp.set_type_label_visibility <+ self.frp.type_label_visibility;
self.frp.source.tooltip <+ port_frp.tooltip; self.frp.source.tooltip <+ port_frp.tooltip;
port_frp.set_view_mode <+ self.frp.view_mode; port_frp.set_view_mode <+ self.frp.view_mode;
port_frp.set_size <+ self.frp.size;
} }
port_frp.set_type_label_visibility.emit(self.frp.type_label_visibility.value()); port_frp.set_type_label_visibility.emit(self.frp.type_label_visibility.value());
port_frp.set_view_mode.emit(self.frp.view_mode.value()); port_frp.set_view_mode.emit(self.frp.view_mode.value());
port_frp.set_size.emit(self.frp.size.value());
self.ports.add_child(&port_shape); self.ports.add_child(&port_shape);
port_index += 1; port_index += 1;
} }
@ -483,6 +481,7 @@ impl Area {
frp.source.port_size_multiplier <+ hysteretic_transition.value; frp.source.port_size_multiplier <+ hysteretic_transition.value;
eval frp.set_size ((t) model.set_size(*t)); eval frp.set_size ((t) model.set_size(*t));
frp.source.size <+ frp.set_size;
frp.source.type_label_visibility <+ frp.set_type_label_visibility; frp.source.type_label_visibility <+ frp.set_type_label_visibility;