Skip to content

Fix 'Shallow Select' mode behavior for selection context transference #2604

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

Merged
merged 25 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,10 @@ impl OverlayContext {
}

pub fn draw_angle(&mut self, pivot: DVec2, radius: f64, arc_radius: f64, offset_angle: f64, angle: f64) {
let color_line = COLOR_OVERLAY_BLUE;

let end_point1 = pivot + radius * DVec2::from_angle(angle + offset_angle);
let end_point2 = pivot + radius * DVec2::from_angle(offset_angle);
self.line(pivot, end_point1, Some(color_line), None);
self.line(pivot, end_point2, Some(color_line), None);

self.line(pivot, end_point1, None, None);
self.dashed_line(pivot, end_point2, None, None, Some(2.), Some(2.), Some(0.5));
self.draw_arc(pivot, arc_radius, offset_angle, (angle) % TAU + offset_angle);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,21 @@ impl LayerNodeIdentifier {
metadata.get_relations(self).and_then(|relations| relations.last_child)
}

/// Does the layer have children? If so, then it is a folder
/// Does the layer have children? If so, then it is a folder.
pub fn has_children(self, metadata: &DocumentMetadata) -> bool {
self.first_child(metadata).is_some()
}

/// Is the layer a child of the given layer?
pub fn is_child_of(self, metadata: &DocumentMetadata, parent: &LayerNodeIdentifier) -> bool {
parent.children(metadata).any(|child| child == self)
}

/// Is the layer an ancestor of the given layer?
pub fn is_ancestor_of(self, metadata: &DocumentMetadata, child: &LayerNodeIdentifier) -> bool {
child.ancestors(metadata).any(|ancestor| ancestor == self)
}

/// Iterator over all direct children (excluding self and recursive children)
pub fn children(self, metadata: &DocumentMetadata) -> AxisIter {
AxisIter {
Expand Down
1 change: 1 addition & 0 deletions editor/src/messages/tool/common_functionality/measure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fn draw_dashed_line(line_start: DVec2, line_end: DVec2, transform: DAffine2, ove

overlay_context.dashed_line(min_viewport, max_viewport, None, None, Some(2.), Some(2.), Some(0.5));
}

/// Draws a solid line with a length annotation between two points transformed by the given affine transformations.
fn draw_line_with_length(line_start: DVec2, line_end: DVec2, transform: DAffine2, document_to_viewport: DAffine2, overlay_context: &mut OverlayContext, label_alignment: LabelAlignment) {
let transform_to_document = document_to_viewport.inverse() * transform;
Expand Down
14 changes: 7 additions & 7 deletions editor/src/messages/tool/tool_messages/artboard_tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ impl Fsm for ArtboardToolFsmState {
let constrain_square = input.keyboard.get(constrain_axis_or_aspect as usize);
tool_data.resize_artboard(responses, document, input, from_center, constrain_square);

// AutoPanning
// Auto-panning
let messages = [
ArtboardToolMessage::PointerOutsideViewport { constrain_axis_or_aspect, center }.into(),
ArtboardToolMessage::PointerMove { constrain_axis_or_aspect, center }.into(),
Expand Down Expand Up @@ -306,7 +306,7 @@ impl Fsm for ArtboardToolFsmState {
bounds.bounds[0] = position.round();
bounds.bounds[1] = position.round() + size.round();

// AutoPanning
// Auto-panning
let messages = [
ArtboardToolMessage::PointerOutsideViewport { constrain_axis_or_aspect, center }.into(),
ArtboardToolMessage::PointerMove { constrain_axis_or_aspect, center }.into(),
Expand Down Expand Up @@ -345,7 +345,7 @@ impl Fsm for ArtboardToolFsmState {
})
}

// AutoPanning
// Auto-panning
let messages = [
ArtboardToolMessage::PointerOutsideViewport { constrain_axis_or_aspect, center }.into(),
ArtboardToolMessage::PointerMove { constrain_axis_or_aspect, center }.into(),
Expand Down Expand Up @@ -377,25 +377,25 @@ impl Fsm for ArtboardToolFsmState {
ArtboardToolFsmState::Ready { hovered }
}
(ArtboardToolFsmState::ResizingBounds, ArtboardToolMessage::PointerOutsideViewport { .. }) => {
// AutoPanning
// Auto-panning
let _ = tool_data.auto_panning.shift_viewport(input, responses);

ArtboardToolFsmState::ResizingBounds
}
(ArtboardToolFsmState::Dragging, ArtboardToolMessage::PointerOutsideViewport { .. }) => {
// AutoPanning
// Auto-panning
tool_data.auto_panning.shift_viewport(input, responses);

ArtboardToolFsmState::Dragging
}
(ArtboardToolFsmState::Drawing, ArtboardToolMessage::PointerOutsideViewport { .. }) => {
// AutoPanning
// Auto-panning
tool_data.auto_panning.shift_viewport(input, responses);

ArtboardToolFsmState::Drawing
}
(state, ArtboardToolMessage::PointerOutsideViewport { constrain_axis_or_aspect, center }) => {
// AutoPanning
// Auto-panning
let messages = [
ArtboardToolMessage::PointerOutsideViewport { constrain_axis_or_aspect, center }.into(),
ArtboardToolMessage::PointerMove { constrain_axis_or_aspect, center }.into(),
Expand Down
Loading
Loading