Skip to content

Implement the Properties panel with a transform section for layers#527

Merged
Keavon merged 28 commits into
masterfrom
layer-properties
Feb 12, 2022
Merged

Implement the Properties panel with a transform section for layers#527
Keavon merged 28 commits into
masterfrom
layer-properties

Conversation

@mfish33
Copy link
Copy Markdown
Contributor

@mfish33 mfish33 commented Feb 9, 2022

Closes #146
This PR has the transform shape properties working. The next steps are to add styling and the rest of the modifiable properties (#529).

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Feb 9, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: dfb5105
Status: ✅  Deploy successful!
Preview URL: https://0643d865.graphite-master.pages.dev

View logs

Copy link
Copy Markdown
Contributor

@0HyperCube 0HyperCube left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good :)

Great work on this, makes it feel like an actual graphics editor.

}
#[remain::unsorted]
PropertiesPanel(message) => {
self.properties_panel_message_handler.process_action(message, &mut self.graphene_document, responses);
Copy link
Copy Markdown
Contributor

@0HyperCube 0HyperCube Feb 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not need to be mutable access to document

Comment thread editor/src/document/properties_panel_message.rs Outdated
}

fn actions(&self) -> ActionList {
actions!(ArtboardMessageDiscriminant;)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ArtboardMessageDiscriminant?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops

// 1.23 == 1
// 0.23 == 0 (Reason for the slightly more complicated code)
const leftSideDigits = Math.max(Math.floor(value).toString().length, 0) * Math.sign(value);
const leftSideDigits = Math.abs(Math.max(Math.floor(value).toString().length, 0) * Math.sign(value));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why multiply by sign and then abs?

Comment thread editor/src/layout/widgets.rs
Comment thread frontend/src/components/widgets/WidgetRow.vue Outdated
@Keavon Keavon linked an issue Feb 10, 2022 that may be closed by this pull request
@mfish33 mfish33 requested a review from TrueDoctor February 10, 2022 07:53
@Keavon Keavon changed the title Layer properties Implement the Properties panel with a transform section for layers Feb 10, 2022
@Keavon Keavon marked this pull request as ready for review February 10, 2022 08:38
Comment thread editor/src/document/properties_panel_message_handler.rs
self.transform_vector2((1., 0.).into()).length()
}

fn update_width(self, new_width: f64) -> Self {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect a function called update to actually update something by taking a &mut ref

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree however for most of the functions it is easier to just create Daffine instead of modifying since it is copy. Is there a better name that you can suggest? It also helps in the message handler below to have a consistent call signature on the update functions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like update_with_transform?
Another way of going about this would be to ditch the update mentality and just recreate the complete transform every time.
But that is technically doing more work than necessary

Comment thread frontend/src/components/panels/Properties.vue
@Keavon Keavon merged commit 216e051 into master Feb 12, 2022
@Keavon Keavon deleted the layer-properties branch February 12, 2022 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feed the Properties panel with editable layer-specific parameters

4 participants