-
-
Notifications
You must be signed in to change notification settings - Fork 579
Nested layer transforms API #301
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
Conversation
Deploying with
|
Latest commit: |
83a1a4b
|
Status: | ✅ Deploy successful! |
Preview URL: | https://af316449.graphite-master.pages.dev |
5959ed8
to
407fbd9
Compare
b779b24
to
bd4b1e2
Compare
scale: 1., | ||
} | ||
} | ||
pub fn snapped_angle(&self) -> f64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be sure to always have blank lines between functions in impl
blocks. Assuming you agree, check for this elsewhere in this CL.
if !layer_data.contains_key(path) { | ||
layer_data.insert(path.to_vec(), LayerData::new(false)); | ||
} | ||
layer_data.get_mut(path).unwrap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this can be achieved in one line... something like get_or_insert_with
.
ToolMessage::Eyedropper(EyedropperMessage::RightMouseDown) => responses.push_back(ToolMessage::SelectSecondaryColor(color).into()), | ||
_ => {} | ||
} | ||
if let LayerDataType::Shape(s) = &layer.data { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of replacing and_then
with nested maps - and_then
is designed to achieve exactly this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 54 files reviewed, 12 unresolved discussions (waiting on @0HyperCube, @henryksloan, @Keavon, @pkupper, and @TrueDoctor)
client/web/src/components/panels/LayerTree.vue, line 333 at r3 (raw file):
Previously, henryksloan (Henry Sloan) wrote…
Split this into multiple lines?
Done.
core/document/src/intersection.rs, line 14 at r3 (raw file):
Previously, henryksloan (Henry Sloan) wrote…
Add a blank line before this function signature
Done.
core/document/src/intersection.rs, line 44 at r3 (raw file):
Previously, henryksloan (Henry Sloan) wrote…
I think this
for
andif
could be refactored to just anif
usingIterator::any
Done.
core/document/src/intersection.rs, line 57 at r3 (raw file):
Previously, henryksloan (Henry Sloan) wrote…
This can also be refactored with
Iterator::any
That would get pretty ugly if I don't want to loop through the iterator multiple times
core/document/src/layers/folder.rs, line 33 at r3 (raw file):
Previously, henryksloan (Henry Sloan) wrote…
Consider splitting this across multiple lines
Done.
core/document/src/layers/simple_shape.rs, line 87 at r3 (raw file):
Previously, henryksloan (Henry Sloan) wrote…
Parentheses around
((sides + 1) % 2) as f64 * PI
would be nice, to be clear about the order of operations for the division.
Done.
core/editor/src/document/document_file.rs, line 86 at r1 (raw file):
Previously, henryksloan (Henry Sloan) wrote…
I believe this message is removed in master, replaced by
FlipSelectedLayers
. Also,FlipSelectedLayers
should probably be down here, next to the other transformations of the selected layers.
Done.
core/editor/src/document/layer_panel.rs, line 43 at r3 (raw file):
Previously, henryksloan (Henry Sloan) wrote…
I'm not sure these variables need
transform
in their names; that makes it much more verbose, and I'm not sure it makes it clearer.
Just copied this over and found out that it is fundamentally broken and needs a fix anyway
Will add a todo
core/editor/src/document/layer_panel.rs, line 52 at r3 (raw file):
Previously, henryksloan (Henry Sloan) wrote…
I believe this can be achieved in one line... something like
get_or_insert_with
.
But then you need a owned path and can't clone on demand
core/editor/src/document/layer_panel.rs, line 58 at r3 (raw file):
Previously, henryksloan (Henry Sloan) wrote…
If these variables are only used to populate the struct, I don't think they need to be stored in variables at all.
Done.
core/editor/src/tool/tools/eyedropper.rs, line 26 at r3 (raw file):
Previously, henryksloan (Henry Sloan) wrote…
I'm not a fan of replacing
and_then
with nested maps -and_then
is designed to achieve exactly this.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 54 files reviewed, 12 unresolved discussions (waiting on @0HyperCube, @henryksloan, @Keavon, and @pkupper)
core/editor/src/document/layer_panel.rs, line 31 at r3 (raw file):
Previously, henryksloan (Henry Sloan) wrote…
I think we should be sure to always have blank lines between functions in
impl
blocks. Assuming you agree, check for this elsewhere in this CL.
We'll try to add them as we got through the pr
core/editor/src/document/layer_panel.rs, line 43 at r3 (raw file):
Previously, TrueDoctor wrote…
Just copied this over and found out that it is fundamentally broken and needs a fix anyway
Will add a todo
Done.
fdcf8dc
to
c2f7637
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 55 files reviewed, 20 unresolved discussions (waiting on @0HyperCube, @henryksloan, @Keavon, and @pkupper)
core/editor/src/consts.rs, line 14 at r5 (raw file):
Previously, Keavon (Keavon Chambers) wrote…
Wondering if this should be 15. However this already was 12 beforehand, yet the actual application does work in 15° increments while holding Shift.
Done.
core/editor/src/tool/tools/ellipse.rs, line 33 at r5 (raw file):
Previously, Keavon (Keavon Chambers) wrote…
Two spaces between
DragStop,
andAbort,
Done.
core/editor/src/tool/tools/ellipse.rs, line 98 at r5 (raw file):
Previously, Keavon (Keavon Chambers) wrote…
Is this comment still accurate? Also please switch from
TODO -
toTODO:
for consistency (and because it helps with tooling which highlightsTODO:
blocks but apparently mine doesn't highlightTODO -
).
Yes that is still a thing we should do, should be a pretty small fix
core/editor/src/tool/tools/line.rs, line 33 at r5 (raw file):
Previously, Keavon (Keavon Chambers) wrote…
Remove double space and space before closing paren.
Done.
core/editor/src/tool/tools/rectangle.rs, line 33 at r5 (raw file):
Previously, Keavon (Keavon Chambers) wrote…
Double space before
Abort,
.
Done.
core/editor/src/tool/tools/select.rs, line 45 at r5 (raw file):
Previously, Keavon (Keavon Chambers) wrote…
Double space here also.
Done.
core/editor/src/tool/tools/select.rs, line 130 at r5 (raw file):
Previously, Keavon (Keavon Chambers) wrote…
Let's make the stroke width 1.0 and the hex code
#00A8FF
(0x00
,0xA8
,0xFF
).
Done.
core/editor/src/tool/tools/shape.rs, line 33 at r5 (raw file):
Previously, Keavon (Keavon Chambers) wrote…
Double space here too.
Good thing I would never copy paste code, pretty weird chance that the duplicate whitespace was in all files!
* Enforce cache dirtification * Turn all shapes into one struct * Remove working folder * Remove old shapes * Major restructuring * Refactor Ellipse, Rectangle and ShapeTool * Simplify bounding box calculation for folder * Fix panic in select tool * Refactorselect tool * Refactor Align * Refactor flipping layers * Zoom to fit all * Refactor tools to avoid state keeping * Refactor more tools to use state that is passed along * Fix whitespace + change selection box style * Set viewbox of svg export based on the contents
* Enforce cache dirtification * Turn all shapes into one struct * Remove working folder * Remove old shapes * Major restructuring * Refactor Ellipse, Rectangle and ShapeTool * Simplify bounding box calculation for folder * Fix panic in select tool * Refactorselect tool * Refactor Align * Refactor flipping layers * Zoom to fit all * Refactor tools to avoid state keeping * Refactor more tools to use state that is passed along * Fix whitespace + change selection box style * Set viewbox of svg export based on the contents
Fixes #251
unblocks #149
Fixes #148
Fixes #290
This change is