mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-02 12:48:11 +08:00
Fix fill tool on raster image temporarily breaking the graph (#2398)
* Fix fill tool on raster image temporarily breaks the graph * Avoid vector filling raster layer via checking node category * check raster image using input type instead * Add additional check for TextureFrameTable * Enable the ignore raster test --------- Co-authored-by: hypercube <0hypercube@gmail.com>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
use super::tool_prelude::*;
|
||||
|
||||
use crate::messages::tool::common_functionality::graph_modification_utils::NodeGraphLayer;
|
||||
use graphene_core::vector::style::Fill;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FillTool {
|
||||
fsm_state: FillToolFsmState,
|
||||
@@ -87,6 +86,10 @@ impl Fsm for FillToolFsmState {
|
||||
let Some(layer_identifier) = document.click(input) else {
|
||||
return self;
|
||||
};
|
||||
// If the layer is a raster layer, don't fill it, wait till the flood fill tool is implemented
|
||||
if NodeGraphLayer::is_raster_layer(layer_identifier, &mut document.network_interface) {
|
||||
return self;
|
||||
}
|
||||
let fill = match color_event {
|
||||
FillToolMessage::FillPrimaryColor => Fill::Solid(global_tool_data.primary_color),
|
||||
FillToolMessage::FillSecondaryColor => Fill::Solid(global_tool_data.secondary_color),
|
||||
@@ -147,8 +150,6 @@ mod test_fill {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
// TODO: fix https://github.com/GraphiteEditor/Graphite/issues/2270
|
||||
#[should_panic]
|
||||
async fn ignore_raster() {
|
||||
let mut editor = EditorTestUtils::create();
|
||||
editor.new_document().await;
|
||||
|
||||
@@ -311,7 +311,7 @@ impl Fsm for FreehandToolFsmState {
|
||||
}
|
||||
|
||||
fn extend_path_with_next_segment(tool_data: &mut FreehandToolData, position: DVec2, extend: bool, responses: &mut VecDeque<Message>) {
|
||||
if !tool_data.end_point.map_or(true, |(last_pos, _)| position != last_pos) || !position.is_finite() {
|
||||
if !tool_data.end_point.is_none_or(|(last_pos, _)| position != last_pos) || !position.is_finite() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ impl Fsm for SplineToolFsmState {
|
||||
return SplineToolFsmState::Ready;
|
||||
};
|
||||
tool_data.next_point = tool_data.snapped_point(document, input).snapped_point_document;
|
||||
if tool_data.points.last().map_or(true, |last_pos| last_pos.1.distance(tool_data.next_point) > DRAG_THRESHOLD) {
|
||||
if tool_data.points.last().is_none_or(|last_pos| last_pos.1.distance(tool_data.next_point) > DRAG_THRESHOLD) {
|
||||
let preview_point = tool_data.preview_point;
|
||||
extend_spline(tool_data, false, responses);
|
||||
tool_data.preview_point = preview_point;
|
||||
|
||||
Reference in New Issue
Block a user