mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 06:38:03 +08:00
Fix brush layers growing hugely when resizing transforms with Select tool (#1201)
* Fix brush tool resize * Fix typo * Fix image transforms * Remove input from image network * Fix merge error --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
parent
d7c5658852
commit
ab2de96640
@@ -243,6 +243,13 @@ where
|
||||
|
||||
impl<P: Copy + Pixel> ImageFrame<P> {
|
||||
pub const fn empty() -> Self {
|
||||
Self {
|
||||
image: Image::empty(),
|
||||
transform: DAffine2::ZERO,
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn identity() -> Self {
|
||||
Self {
|
||||
image: Image::empty(),
|
||||
transform: DAffine2::IDENTITY,
|
||||
@@ -307,7 +314,7 @@ pub struct ExtractImageFrame;
|
||||
impl<'a: 'input, 'input> Node<'input, EditorApi<'a>> for ExtractImageFrame {
|
||||
type Output = ImageFrame<Color>;
|
||||
fn eval(&'input self, mut editor_api: EditorApi<'a>) -> Self::Output {
|
||||
editor_api.image_frame.take().unwrap_or(ImageFrame::empty())
|
||||
editor_api.image_frame.take().unwrap_or(ImageFrame::identity())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -330,8 +330,10 @@ impl NodeNetwork {
|
||||
pub fn push_node(&mut self, mut node: DocumentNode, connect_to_previous: bool) -> NodeId {
|
||||
let id = self.nodes.len().try_into().expect("Too many nodes in network");
|
||||
// Set the correct position for the new node
|
||||
if let Some(pos) = self.original_outputs().first().and_then(|first| self.nodes.get(&first.node_id)).map(|n| n.metadata.position) {
|
||||
node.metadata.position = pos + IVec2::new(8, 0);
|
||||
if node.metadata.position == IVec2::default() {
|
||||
if let Some(pos) = self.original_outputs().first().and_then(|first| self.nodes.get(&first.node_id)).map(|n| n.metadata.position) {
|
||||
node.metadata.position = pos + IVec2::new(8, 0);
|
||||
}
|
||||
}
|
||||
if connect_to_previous && !self.outputs.is_empty() {
|
||||
let input = NodeInput::node(self.outputs[0].node_id, self.outputs[0].node_output_index);
|
||||
|
||||
Reference in New Issue
Block a user