before_code
stringlengths
30
149k
reviewer_comment
stringlengths
16
20.6k
after_code
stringlengths
30
163k
diff_context
stringlengths
0
22.4k
file_path
stringlengths
6
155
comment_line
int64
0
26
language
stringclasses
19 values
quality_score
float64
0.07
1
comment_type
stringclasses
9 values
comment_length
int64
16
20.6k
before_lines
int64
2
4.61k
after_lines
int64
2
4.4k
is_negative
bool
2 classes
pr_title
stringlengths
7
140
pr_number
int64
18
61.2k
repo_name
stringclasses
29 values
repo_stars
int64
321
56k
repo_language
stringclasses
14 values
reviewer_username
stringclasses
378 values
author_username
stringclasses
739 values
user
stringlengths
361
200k
assistant
stringlengths
16
20.6k
system
stringclasses
1 value
Multimap<String, String> decoded = RegistryClient.decodeTokenRepositoryGrants( "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsIng1YyI6WyJNSUlDK2pDQ0FwK2dBd0lCQWdJQkFEQUtCZ2dxaGtqT1BRUURBakJHTVVRd1FnWURWUVFERXpzeVYwNVpPbFZMUzFJNlJFMUVVanBTU1U5Rk9reEhOa0U2UTFWWVZEcE5SbFZNT2tZelNFVTZOVkF5VlRwTFNqTkdPa05CTmxr...
No issues found.
Multimap<String, String> decoded = RegistryClient.decodeTokenRepositoryGrants( "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsIng1YyI6WyJNSUlDK2pDQ0FwK2dBd0lCQWdJQkFEQUtCZ2dxaGtqT1BRUURBakJHTVVRd1FnWURWUVFERXpzeVYwNVpPbFZMUzFJNlJFMUVVanBTU1U5Rk9reEhOa0U2UTFWWVZEcE5SbFZNT2tZelNFVTZOVkF5VlRwTFNqTkdPa05CTmxr...
@@ -16,10 +16,10 @@ package com.google.cloud.tools.jib.registry; -import com.google.api.client.util.Base64; import com.google.cloud.tools.jib.http.Authorization; import com.google.common.collect.Multimap; import java.nio.charset.StandardCharsets; +import java.util.Base64; import org.junit.Assert; import org.j...
jib-core/src/test/java/com/google/cloud/tools/jib/registry/DockerRegistryBearerTokenTest.java
0
Java
1
none
16
51
51
true
Replace google api util base64 with java util base64
3,872
GoogleContainerTools/jib
11,032
Java
Sineaggi
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/registry/DockerRegistryBearerTokenTest.java PR Title: Replace google api util base64 with java util base64 BEFORE CODE: Multimap<String, String> decoded = RegistryClient.decodeTokenRepositoryGrants( ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.google.cloud.tools.jib.api; import com.google.cloud....
No issues found.
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.google.cloud.tools.jib.api; import com.google.cloud....
@@ -0,0 +1,70 @@ +/* + * Copyright 2018 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
jib-plugins-common/src/test/java/com/google/cloud/tools/jib/api/HttpRequestTester.java
0
Java
1
none
16
51
51
true
ci: test suite and script changes for compatibility with Kokoro ubuntu migration
3,886
GoogleContainerTools/jib
11,032
Java
emmileaf
Review this pull request change. Language: Java File: jib-plugins-common/src/test/java/com/google/cloud/tools/jib/api/HttpRequestTester.java PR Title: ci: test suite and script changes for compatibility with Kokoro ubuntu migration BEFORE CODE: * distributed under the License is distributed on an "AS IS" BASIS, WI...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@Test public void testBuild_failOffline() { String targetImage = IntegrationTestingConfiguration.getTestRepositoryLocation() + "/simpleimageoffline:gradle" + System.nanoTime(); Exception exception = assertThrows( UnexpectedBuildFailure.class, ...
No issues found.
@Test public void testBuild_failOffline() { String targetImage = IntegrationTestingConfiguration.getTestRepositoryLocation() + "/simpleimageoffline:gradle" + System.nanoTime(); Exception exception = assertThrows( UnexpectedBuildFailure.class, ...
@@ -37,6 +37,8 @@ import java.time.Instant; import org.gradle.testkit.runner.BuildResult; import org.gradle.testkit.runner.UnexpectedBuildFailure; +import org.hamcrest.CoreMatchers; +import org.hamcrest.MatcherAssert; import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; @@ -96,27 +98,23 @@ ...
jib-gradle-plugin/src/integration-test/java/com/google/cloud/tools/jib/gradle/SingleProjectIntegrationTest.java
0
Java
1
none
16
51
51
true
test: update integration test assertions for docker inspect output
3,926
GoogleContainerTools/jib
11,032
Java
emmileaf
Review this pull request change. Language: Java File: jib-gradle-plugin/src/integration-test/java/com/google/cloud/tools/jib/gradle/SingleProjectIntegrationTest.java PR Title: test: update integration test assertions for docker inspect output BEFORE CODE: @Test public void testBuild_failOffline() { String t...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
assertThat(bootWarTask).isNotNull(); for (String taskName : KNOWN_JIB_TASKS) { Set<Object> taskDependencies = tasks.getByPath(taskName).getDependsOn(); assertThat(taskDependencies) .comparingElementsUsing(PROVIDES_TASK_OF) .containsAtLeast(warTask, bootWarTask); } } @Te...
No issues found.
assertThat(bootWarTask).isNotNull(); for (String taskName : KNOWN_JIB_TASKS) { Set<Object> taskDependencies = tasks.getByPath(taskName).getDependsOn(); assertThat(taskDependencies) .comparingElementsUsing(PROVIDES_TASK_OF) .containsAtLeast(warTask, bootWarTask); } } @Te...
@@ -407,6 +407,18 @@ public void testLazyEvalForContainerCreationAndFileModificationTimes() { assertThat(output).contains("filesModificationTime=2022-07-19T11:23:42Z"); } + @Test + public void testLazyEvalForMainClass() { + BuildResult showLabels = testProject.build("showMainClass"); + assertThat(show...
jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibPluginTest.java
0
Java
1
none
16
51
51
true
Support lazy configuration for `mainClass` and `jvmFlags` properties of `ContainerParameters`
3,936
GoogleContainerTools/jib
11,032
Java
erdi
Review this pull request change. Language: Java File: jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibPluginTest.java PR Title: Support lazy configuration for `mainClass` and `jvmFlags` properties of `ContainerParameters` BEFORE CODE: assertThat(bootWarTask).isNotNull(); for (String ta...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
* the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the sp...
No issues found.
* the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the sp...
@@ -37,7 +37,10 @@ public void testCheck_exists() throws IOException, RegistryException { RegistryClient.factory(EventHandlers.NONE, "gcr.io", "distroless/base", httpClient) .newRegistryClient(); V22ManifestTemplate manifestTemplate = - registryClient.pullManifest("latest", V22Manifest...
jib-core/src/integration-test/java/com/google/cloud/tools/jib/registry/BlobCheckerIntegrationTest.java
0
Java
1
none
16
51
51
true
ci: update integration tests that expect docker manifest format from distroless image
3,965
GoogleContainerTools/jib
11,032
Java
emmileaf
Review this pull request change. Language: Java File: jib-core/src/integration-test/java/com/google/cloud/tools/jib/registry/BlobCheckerIntegrationTest.java PR Title: ci: update integration tests that expect docker manifest format from distroless image BEFORE CODE: * the License at * * http://www.apache.org...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
.setEntrypoint("echo", "Hello World") .containerize( Containerizer.to(RegistryImage.named(toImage)).setAllowInsecureRegistries(true)); Assert.assertEquals("Hello World\n", pullAndRunBuiltImage(toImage)); Assert.assertEquals( "Hello World\n", pullAndRunBuiltImage(...
No issues found.
.setEntrypoint("echo", "Hello World") .containerize( Containerizer.to(RegistryImage.named(toImage)).setAllowInsecureRegistries(true)); Assert.assertEquals("Hello World\n", pullAndRunBuiltImage(toImage)); Assert.assertEquals( "Hello World\n", pullAndRunBuiltImage(...
@@ -49,6 +49,10 @@ /** Integration tests for {@link Jib}. */ public class JibIntegrationTest { + /** A known oci index sha for gcr.io/distroless/base. */ + public static final String KNOWN_OCI_INDEX_SHA = + "sha256:2c50b819aa3bfaf6ae72e47682f6c5abc0f647cf3f4224a4a9be97dd30433909"; + @ClassRule public stat...
jib-core/src/integration-test/java/com/google/cloud/tools/jib/api/JibIntegrationTest.java
0
Java
1
none
16
51
51
true
Fix V22ManifestListTemplate cast when pulling an oci index manifest
3,974
GoogleContainerTools/jib
11,032
Java
rquinio
Review this pull request change. Language: Java File: jib-core/src/integration-test/java/com/google/cloud/tools/jib/api/JibIntegrationTest.java PR Title: Fix V22ManifestListTemplate cast when pulling an oci index manifest BEFORE CODE: .setEntrypoint("echo", "Hello World") .containerize( ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
Set<Object> taskDependencies = tasks.getByPath(taskName).getDependsOn(); assertThat(taskDependencies) .comparingElementsUsing(PROVIDES_TASK_OF) .containsAtLeast(warTask, bootWarTask); } } @Test public void testSpringBootJarProject_nonPackagedMode() { Project project = ...
No issues found.
Set<Object> taskDependencies = tasks.getByPath(taskName).getDependsOn(); assertThat(taskDependencies) .comparingElementsUsing(PROVIDES_TASK_OF) .containsAtLeast(warTask, bootWarTask); } } @Test public void testSpringBootJarProject_nonPackagedMode() { Project project = ...
@@ -368,6 +368,12 @@ public void testLazyEvalForLabels() { "labels contain values [firstkey:updated-first-label, secondKey:updated-second-label]"); } + @Test + public void testLazyEvalForEntryPoint() { + BuildResult showEntrypoint = testProject.build("showentrypoint", "-Djib.console=plain"); + ...
jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibPluginTest.java
0
Java
1
none
16
51
51
true
use gradle lazy Provider for entrypoint container parameter
4,003
GoogleContainerTools/jib
11,032
Java
wakingrufus
Review this pull request change. Language: Java File: jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibPluginTest.java PR Title: use gradle lazy Provider for entrypoint container parameter BEFORE CODE: Set<Object> taskDependencies = tasks.getByPath(taskName).getDependsOn(); assertTha...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} assertThat(actual) .containsExactly( "98682a867906d9d07cf3c51a4fb9e08e9d5baddd1ca5dc7834f58f434c9cb15c.tar.gz", "527db49d4e0c4159346119b4971d59016bfedceed874abab2b510ce433f6b15c.tar.gz", "16d03883198935b4119896dcea0ea14e1bf105b6ac0a35a88820d08bc0263306.tar.gz", ...
No issues found.
} assertThat(actual) .containsExactly( "98682a867906d9d07cf3c51a4fb9e08e9d5baddd1ca5dc7834f58f434c9cb15c.tar.gz", "527db49d4e0c4159346119b4971d59016bfedceed874abab2b510ce433f6b15c.tar.gz", "16d03883198935b4119896dcea0ea14e1bf105b6ac0a35a88820d08bc0263306.tar.gz", ...
@@ -102,9 +102,9 @@ public void testTarballStructure() throws IOException { assertThat(actual) .containsExactly( - "c46572ef74f58d95e44dd36c1fbdfebd3752e8b56a794a13c11cfed35a1a6e1c.tar.gz", - "6d2763b0f3940d324ea6b55386429e5b173899608abf7d1bff62e25dd2e4dcea.tar.gz", - "5...
jib-core/src/integration-test/java/com/google/cloud/tools/jib/api/ReproducibleImageTest.java
0
Java
1
none
16
51
51
true
Update apache-commons to 1.26.0 and set PAX headers to address build reproducibility issue
4,204
GoogleContainerTools/jib
11,032
Java
izogfif
Review this pull request change. Language: Java File: jib-core/src/integration-test/java/com/google/cloud/tools/jib/api/ReproducibleImageTest.java PR Title: Update apache-commons to 1.26.0 and set PAX headers to address build reproducibility issue BEFORE CODE: } assertThat(actual) .containsExactly(...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
package dep; public class A { public static void getResult() { System.out.print("Hello "); } }
No issues found.
package dep; public class A { public static void getResult() { System.out.print("Hello "); } }
@@ -0,0 +1,7 @@ +package dep; + +public class A { + public static void getResult() { + System.out.print("Hello "); + } +}
jib-cli/src/integration-test/resources/jarTest/standard/dep/A.java
0
Java
1
none
16
8
8
true
chore: Dynamically create test jars for JarCommandTest
4,210
GoogleContainerTools/jib
11,032
Java
meltsufin
Review this pull request change. Language: Java File: jib-cli/src/integration-test/resources/jarTest/standard/dep/A.java PR Title: chore: Dynamically create test jars for JarCommandTest BEFORE CODE: package dep; public class A { public static void getResult() { System.out.print("Hello "); } } AFTER CODE:...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
Files.readAllBytes(appCacheDirectory.resolve("jib-classpath-file")), StandardCharsets.UTF_8); assertThat(classpath).isEqualTo("/app/resources:/app/classes:/app/libs/*"); String mainClass = new String( Files.readAllBytes(appCacheDirectory.resolve("jib-main-class-file")...
No issues found.
Files.readAllBytes(appCacheDirectory.resolve("jib-classpath-file")), StandardCharsets.UTF_8); assertThat(classpath).isEqualTo("/app/resources:/app/classes:/app/libs/*"); String mainClass = new String( Files.readAllBytes(appCacheDirectory.resolve("jib-main-class-file")...
@@ -474,7 +474,7 @@ public void testEntrypoint_defaultWarPackaging() ContainerBuildPlan buildPlan = processCommonConfiguration(); assertThat(buildPlan.getEntrypoint()) - .containsExactly("java", "-jar", "/usr/local/jetty/start.jar") + .containsExactly("java", "-jar", "/usr/local/jetty/start.ja...
jib-plugins-common/src/test/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessorTest.java
0
Java
1
none
16
51
51
true
fix: modify default entrypoint for WAR containerization to be compatible with Jetty 12+
4,216
GoogleContainerTools/jib
11,032
Java
mpeddada1
Review this pull request change. Language: Java File: jib-plugins-common/src/test/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessorTest.java PR Title: fix: modify default entrypoint for WAR containerization to be compatible with Jetty 12+ BEFORE CODE: Files.readAllBytes(appCach...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
// Pretend that a thread pulling base images returned some (meaningless) result. stepsRunner.pullBaseImages(progressDispatcherFactory); DescriptorDigest digest1 = DescriptorDigest.fromHash( "1111111111111111111111111111111111111111111111111111111111111111"); DescriptorDigest digest2...
No issues found.
// Pretend that a thread pulling base images returned some (meaningless) result. stepsRunner.pullBaseImages(progressDispatcherFactory); DescriptorDigest digest1 = DescriptorDigest.fromHash( "1111111111111111111111111111111111111111111111111111111111111111"); DescriptorDigest digest2...
@@ -16,6 +16,9 @@ package com.google.cloud.tools.jib.builder.steps; +import static com.google.common.truth.Truth.assertThat; +import static org.mockito.Mockito.when; + import com.google.cloud.tools.jib.api.DescriptorDigest; import com.google.cloud.tools.jib.builder.ProgressEventDispatcher; import com.google.clo...
jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/StepsRunnerTest.java
0
Java
1
none
16
51
51
true
feat: determine platform details from local docker installation for jibDockerBuild
4,249
GoogleContainerTools/jib
11,032
Java
mpeddada1
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/StepsRunnerTest.java PR Title: feat: determine platform details from local docker installation for jibDockerBuild BEFORE CODE: // Pretend that a thread pulling base images returned some (meaning...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
public class JibMultiPlatformIntegrationTest { @ClassRule public static final LocalRegistry localRegistry = new LocalRegistry(5000); private final String dockerHost = System.getenv("DOCKER_IP") != null ? System.getenv("DOCKER_IP") : "localhost"; private String imageToDelete; @After public void tearD...
No issues found.
public class JibMultiPlatformIntegrationTest { @ClassRule public static final LocalRegistry localRegistry = new LocalRegistry(5000); private final String dockerHost = System.getenv("DOCKER_IP") != null ? System.getenv("DOCKER_IP") : "localhost"; private String imageToDelete; @After public void tearD...
@@ -0,0 +1,109 @@ +/* + * Copyright 2024 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by...
jib-core/src/integration-test/java/com/google/cloud/tools/jib/api/JibMultiPlatformIntegrationTest.java
0
Java
1
none
16
51
51
true
fix: allow pushing images with different arch/os to docker daemon
4,268
GoogleContainerTools/jib
11,032
Java
mpeddada1
Review this pull request change. Language: Java File: jib-core/src/integration-test/java/com/google/cloud/tools/jib/api/JibMultiPlatformIntegrationTest.java PR Title: fix: allow pushing images with different arch/os to docker daemon BEFORE CODE: public class JibMultiPlatformIntegrationTest { @ClassRule public s...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
assertThat(testPluginConfiguration.getArgs()).containsExactly("arg1", "arg2", "arg3").inOrder(); project.getProperties().setProperty("jib.container.entrypoint", "entry1,entry2,entry3"); assertThat(testPluginConfiguration.getEntrypoint()) .containsExactly("entry1", "entry2", "entry3") .inOrde...
No issues found.
assertThat(testPluginConfiguration.getArgs()).containsExactly("arg1", "arg2", "arg3").inOrder(); project.getProperties().setProperty("jib.container.entrypoint", "entry1,entry2,entry3"); assertThat(testPluginConfiguration.getEntrypoint()) .containsExactly("entry1", "entry2", "entry3") .inOrde...
@@ -43,15 +43,17 @@ public class JibPluginConfigurationTest { private final MavenProject project = new MavenProject(); - private final Properties sessionProperties = new Properties(); + private final Properties sessionUserProperties = new Properties(); + private final Properties sessionSystemProperties = new P...
jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/JibPluginConfigurationTest.java
0
Java
1
none
16
51
51
true
Check Maven user properties with highest precedence when fetching a property value
4,345
GoogleContainerTools/jib
11,032
Java
breun
Review this pull request change. Language: Java File: jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/JibPluginConfigurationTest.java PR Title: Check Maven user properties with highest precedence when fetching a property value BEFORE CODE: assertThat(testPluginConfiguration.getArgs()).containsEx...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
self.work_mounted = false; self.work_mount_path = vec![]; self.work = Layer::new(LayerDataTypes::Folder(Folder::default()), DAffine2::IDENTITY.to_cols_array(), PathStyle::default()); let mut responses = vec![]; for operation in ops.into_iter() { if let Some(mut op_responses) = self.handle_opera...
this can be replaced by: ```rust self.mark_as_dirty(path)?; self.layer_mut(&path).unwrap().blend_mode = *blend_mode; ```
self.work_mounted = false; self.work_mount_path = vec![]; self.work = Layer::new(LayerDataTypes::Folder(Folder::default()), DAffine2::IDENTITY.to_cols_array(), PathStyle::default()); let mut responses = vec![]; for operation in ops.into_iter() { if let Some(mut op_responses) = self.handle_opera...
@@ -393,13 +395,23 @@ impl Document { Some(responses) } Operation::ToggleVisibility { path } => { - let _ = self.layer_mut(&path).map(|layer| { + if let Ok(layer) = self.layer_mut(&path) { layer.visible = !layer.visible; layer.cache_dirty = true; - }); + } let path = path.as_sl...
core/document/src/document.rs
26
Rust
0.786
suggestion
124
51
51
false
Blend modes
252
GraphiteEditor/Graphite
17,935
Rust
TrueDoctor
geom3trik
Review this pull request change. Language: Rust File: core/document/src/document.rs PR Title: Blend modes BEFORE CODE: self.work_mounted = false; self.work_mount_path = vec![]; self.work = Layer::new(LayerDataTypes::Folder(Folder::default()), DAffine2::IDENTITY.to_cols_array(), PathStyle::default()); ...
this can be replaced by: ```rust self.mark_as_dirty(path)?; self.layer_mut(&path).unwrap().blend_mode = *blend_mode; ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
Line(Line), PolyLine(PolyLine), Shape(Shape), } #[derive(PartialEq, Copy, Clone, Debug, Serialize, Deserialize)] pub enum BlendMode { Normal, Multiply, Darken, ColorBurn, Screen, Lighten, ColorDodge, Overlay, SoftLight, HardLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity, } impl Ble...
Using a String here seems like unnecessary heap allocations
Line(Line), PolyLine(PolyLine), Shape(Shape), } #[derive(PartialEq, Copy, Clone, Debug, Serialize, Deserialize)] pub enum BlendMode { Normal, Multiply, Darken, ColorBurn, Screen, Lighten, ColorDodge, Overlay, SoftLight, HardLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity, } impl Ble...
@@ -40,6 +43,49 @@ pub enum LayerDataTypes { Shape(Shape), } +#[derive(PartialEq, Copy, Clone, Debug, Serialize, Deserialize)] +pub enum BlendMode { + Normal, + Multiply, + Darken, + ColorBurn, + Screen, + Lighten, + ColorDodge, + Overlay, + SoftLight, + HardLight, + Difference, + Exclusion, + Hue, + Saturation, +...
core/document/src/layers/mod.rs
26
Rust
0.214
suggestion
59
51
51
false
Blend modes
252
GraphiteEditor/Graphite
17,935
Rust
TrueDoctor
geom3trik
Review this pull request change. Language: Rust File: core/document/src/layers/mod.rs PR Title: Blend modes BEFORE CODE: Line(Line), PolyLine(PolyLine), Shape(Shape), } #[derive(PartialEq, Copy, Clone, Debug, Serialize, Deserialize)] pub enum BlendMode { Normal, Multiply, Darken, ColorBurn, Screen, Lighte...
Using a String here seems like unnecessary heap allocations
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} GetOpenDocumentsList => { // Send the list of document tab names let open_documents = self.documents.iter().map(|doc| doc.name.clone()).collect(); responses.push_back(FrontendMessage::UpdateOpenDocumentsList { open_documents }.into()); } NextDocument => { let id = (self.active_document_ind...
The name should reflect this affects the selection
} GetOpenDocumentsList => { // Send the list of document tab names let open_documents = self.documents.iter().map(|doc| doc.name.clone()).collect(); responses.push_back(FrontendMessage::UpdateOpenDocumentsList { open_documents }.into()); } NextDocument => { let id = (self.active_document_ind...
@@ -342,6 +344,13 @@ impl MessageHandler<DocumentMessage, &InputPreprocessor> for DocumentMessageHand } .into(), ), + SetBlendMode(blend_mode) => {
core/editor/src/document/document_message_handler.rs
26
Rust
0.286
suggestion
51
51
51
false
Blend modes
252
GraphiteEditor/Graphite
17,935
Rust
TrueDoctor
geom3trik
Review this pull request change. Language: Rust File: core/editor/src/document/document_message_handler.rs PR Title: Blend modes BEFORE CODE: } GetOpenDocumentsList => { // Send the list of document tab names let open_documents = self.documents.iter().map(|doc| doc.name.clone()).collect(); respons...
The name should reflect this affects the selection
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
use crate::frontend::layer_panel::LayerPanelEntry; use crate::message_prelude::*; use crate::tool::tool_options::ToolOptions; use crate::Color; use serde::{Deserialize, Serialize}; pub type Callback = Box<dyn Fn(FrontendMessage)>; #[impl_message(Message, Frontend)] #[derive(PartialEq, Clone, Deserialize, Serialize, D...
I'm wondering if it makes sense to put this in an `Option`. What's the point of even calling the message in the `None` case? Do you think it would be reasonable to require all tools to have a `ToolOptions`, even if it's empty? This message is the same name as `FrontendMessage::SetToolOptions` which led me to confusi...
use crate::frontend::layer_panel::LayerPanelEntry; use crate::message_prelude::*; use crate::tool::tool_options::ToolOptions; use crate::Color; use serde::{Deserialize, Serialize}; pub type Callback = Box<dyn Fn(FrontendMessage)>; #[impl_message(Message, Frontend)] #[derive(PartialEq, Clone, Deserialize, Serialize, D...
@@ -11,6 +12,7 @@ pub enum FrontendMessage { CollapseFolder { path: Vec<LayerId> }, ExpandFolder { path: Vec<LayerId>, children: Vec<LayerPanelEntry> }, SetActiveTool { tool_name: String }, + SetToolOptions { tool_name: String, tool_options: Option<ToolOptions> },
editor/src/frontend/frontend_message_handler.rs
15
Rust
0.571
suggestion
784
40
40
false
Add two-way tool option messaging system
361
GraphiteEditor/Graphite
17,935
Rust
Keavon
henryksloan
Review this pull request change. Language: Rust File: editor/src/frontend/frontend_message_handler.rs PR Title: Add two-way tool option messaging system BEFORE CODE: use crate::frontend::layer_panel::LayerPanelEntry; use crate::message_prelude::*; use crate::tool::tool_options::ToolOptions; use crate::Color; use se...
I'm wondering if it makes sense to put this in an `Option`. What's the point of even calling the message in the `None` case? Do you think it would be reasonable to require all tools to have a `ToolOptions`, even if it's empty? This message is the same name as `FrontendMessage::SetToolOptions` which led me to confusi...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
#[child] Line(LineMessage), #[child] Crop(CropMessage), #[child] Eyedropper(EyedropperMessage), #[child] Navigate(NavigateMessage), #[child] Path(PathMessage), #[child] Pen(PenMessage), #[child] Shape(ShapeMessage), } #[derive(Debug, Default)] pub struct ToolMessageHandler { tool_state: ToolFsmState, } ...
Consider moving this up into a `let` statement above. Possibly even two: `let tool_data = self.tool_state.document_tool_data;` and `let tool_options = tool_data.tool_options.get(&tool_type).map(|tool_options| *tool_options);`.
#[child] Line(LineMessage), #[child] Crop(CropMessage), #[child] Eyedropper(EyedropperMessage), #[child] Navigate(NavigateMessage), #[child] Path(PathMessage), #[child] Pen(PenMessage), #[child] Shape(ShapeMessage), } #[derive(Debug, Default)] pub struct ToolMessageHandler { tool_state: ToolFsmState, } ...
@@ -46,6 +46,17 @@ pub enum ToolMessage { pub struct ToolMessageHandler { tool_state: ToolFsmState, } +impl ToolMessageHandler { + fn update_frontend_tool_options(&self, responses: &mut VecDeque<Message>, tool_type: ToolType) { + responses.push_back( + FrontendMessage::SetToolOptions { + tool_name: tool_type....
editor/src/tool/tool_message_handler.rs
26
Rust
0.786
suggestion
226
51
51
false
Add two-way tool option messaging system
361
GraphiteEditor/Graphite
17,935
Rust
Keavon
henryksloan
Review this pull request change. Language: Rust File: editor/src/tool/tool_message_handler.rs PR Title: Add two-way tool option messaging system BEFORE CODE: #[child] Line(LineMessage), #[child] Crop(CropMessage), #[child] Eyedropper(EyedropperMessage), #[child] Navigate(NavigateMessage), #[child] Path(Pa...
Consider moving this up into a `let` statement above. Possibly even two: `let tool_data = self.tool_state.document_tool_data;` and `let tool_options = tool_data.tool_options.get(&tool_type).map(|tool_options| *tool_options);`.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
// `action` is used via `IconButtonWidget.callback` icon: string; size: number; gapAfter?: boolean; } // Popover Button export interface PopoverButtonWidget { kind: "PopoverButton"; tooltip?: string; callback?: Function; // popover: WidgetLayout; popover: { title: string; text: string }; // TODO: Replace this...
I am worried that the word "path" is becoming very overloaded (it is both an SVG curve path as well as a layer path). I'm probably going to refactor layer paths in the backend from "path" to "layer_path" to avoid confusion. It would be good if we can similarly disambiguate here by calling this `optionPath` or something...
// `action` is used via `IconButtonWidget.callback` icon: string; size: number; gapAfter?: boolean; } // Popover Button export interface PopoverButtonWidget { kind: "PopoverButton"; tooltip?: string; callback?: Function; // popover: WidgetLayout; popover: { title: string; text: string }; // TODO: Replace this...
@@ -55,8 +55,8 @@ export interface PopoverButtonProps { export interface NumberInputWidget { kind: "NumberInput"; tooltip?: string; - callback?: Function; - props: NumberInputProps; + path: string[];
frontend/src/components/widgets/widgets.ts
26
TypeScript
0.643
refactor
369
51
51
false
Add two-way tool option messaging system
361
GraphiteEditor/Graphite
17,935
Rust
Keavon
henryksloan
Review this pull request change. Language: TypeScript File: frontend/src/components/widgets/widgets.ts PR Title: Add two-way tool option messaging system BEFORE CODE: // `action` is used via `IconButtonWidget.callback` icon: string; size: number; gapAfter?: boolean; } // Popover Button export interface Popover...
I am worried that the word "path" is becoming very overloaded (it is both an SVG curve path as well as a layer path). I'm probably going to refactor layer paths in the backend from "path" to "layer_path" to avoid confusion. It would be good if we can similarly disambiguate here by calling this `optionPath` or something...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
display: flex; align-items: center; } </style> <script lang="ts"> import { defineComponent } from "vue"; import { comingSoon } from "@/utilities/errors"; import { WidgetRow, SeparatorType, IconButtonWidget } from "@/components/widgets/widgets"; import Separator from "@/components/widgets/separators/Separator.vue";...
Sorry if I'm forgetting my Vue, but can't you also just do `this.currentToolOptions` and `this.activeTool` without the `.$props`? Disregard if you can't, I might be forgetting. Please break out your parenthesized expression into a variable, it would make this more readable.
flex: 0 0 auto; display: flex; align-items: center; } </style> <script lang="ts"> import { defineComponent, PropType } from "vue"; import { comingSoon } from "@/utilities/errors"; import { WidgetRow, SeparatorType, IconButtonWidget } from "@/components/widgets/widgets"; import Separator from "@/components/widgets...
@@ -38,29 +43,39 @@ const wasm = import("@/../wasm/pkg"); export default defineComponent({ props: { activeTool: { type: String }, + currentToolOptions: { type: Object }, }, - computed: {}, - methods: { - async setShapeOptions(newValue: number) { - // TODO: Each value-input widget (i.e. not a button) should ...
frontend/src/components/widgets/options/ToolOptions.vue
26
Vue
0.571
suggestion
277
51
51
false
Add two-way tool option messaging system
361
GraphiteEditor/Graphite
17,935
Rust
Keavon
henryksloan
Review this pull request change. Language: Vue File: frontend/src/components/widgets/options/ToolOptions.vue PR Title: Add two-way tool option messaging system BEFORE CODE: display: flex; align-items: center; } </style> <script lang="ts"> import { defineComponent } from "vue"; import { comingSoon } from "@/util...
Sorry if I'm forgetting my Vue, but can't you also just do `this.currentToolOptions` and `this.activeTool` without the `.$props`? Disregard if you can't, I might be forgetting. Please break out your parenthesized expression into a variable, it would make this more readable.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import NumberInput from "@/components/widgets/inputs/NumberInput.vue"; const wasm = import("@/../wasm/pkg"); export default defineComponent({ props: { activeTool: { type: String }, currentToolOptions: { type: Object }, }, computed: { activeToolOptions(): Record<string, object> { return (this.$props.curren...
I don't remember off the top of my head what `.slice(0, -1)` does, so breaking this out into a `const` variable above with a self-descriptive name would be helpful for readability. Can this `.forEach()` loop that mutates `value` be turned into a `.map()` which generates a new array, and then it gets combined with `v...
import PopoverButton from "@/components/widgets/buttons/PopoverButton.vue"; import NumberInput from "@/components/widgets/inputs/NumberInput.vue"; const wasm = import("@/../wasm/pkg"); export default defineComponent({ props: { activeTool: { type: String }, activeToolOptions: { type: Object as PropType<Record<str...
@@ -38,29 +43,39 @@ const wasm = import("@/../wasm/pkg"); export default defineComponent({ props: { activeTool: { type: String }, + currentToolOptions: { type: Object }, }, - computed: {}, - methods: { - async setShapeOptions(newValue: number) { - // TODO: Each value-input widget (i.e. not a button) should ...
frontend/src/components/widgets/options/ToolOptions.vue
26
Vue
0.571
suggestion
547
51
51
false
Add two-way tool option messaging system
361
GraphiteEditor/Graphite
17,935
Rust
Keavon
henryksloan
Review this pull request change. Language: Vue File: frontend/src/components/widgets/options/ToolOptions.vue PR Title: Add two-way tool option messaging system BEFORE CODE: import NumberInput from "@/components/widgets/inputs/NumberInput.vue"; const wasm = import("@/../wasm/pkg"); export default defineComponent({...
I don't remember off the top of my head what `.slice(0, -1)` does, so breaking this out into a `const` variable above with a self-descriptive name would be helpful for readability. Can this `.forEach()` loop that mutates `value` be turned into a `.map()` which generates a new array, and then it gets combined with `v...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
export default defineComponent({ props: { activeTool: { type: String }, currentToolOptions: { type: Object }, }, computed: { activeToolOptions(): Record<string, object> { return (this.$props.currentToolOptions || {})[this.$props.activeTool || ""]; }, }, methods: { async updateToolOptions(path: string[...
Try to avoid such complex indexers, I'd suggest breaking this out into a variable also.
export default defineComponent({ props: { activeTool: { type: String }, activeToolOptions: { type: Object as PropType<Record<string, object>> }, }, methods: { async updateToolOptions(path: string[], newValue: number) { this.setToolOption(path, newValue); (await wasm).set_tool_options(this.activeTool || ...
@@ -38,29 +43,39 @@ const wasm = import("@/../wasm/pkg"); export default defineComponent({ props: { activeTool: { type: String }, + currentToolOptions: { type: Object }, }, - computed: {}, - methods: { - async setShapeOptions(newValue: number) { - // TODO: Each value-input widget (i.e. not a button) should ...
frontend/src/components/widgets/options/ToolOptions.vue
26
Vue
0.286
suggestion
87
51
51
false
Add two-way tool option messaging system
361
GraphiteEditor/Graphite
17,935
Rust
Keavon
henryksloan
Review this pull request change. Language: Vue File: frontend/src/components/widgets/options/ToolOptions.vue PR Title: Add two-way tool option messaging system BEFORE CODE: export default defineComponent({ props: { activeTool: { type: String }, currentToolOptions: { type: Object }, }, computed: { activeToo...
Try to avoid such complex indexers, I'd suggest breaking this out into a variable also.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import PopoverButton from "@/components/widgets/buttons/PopoverButton.vue"; import NumberInput from "@/components/widgets/inputs/NumberInput.vue"; const wasm = import("@/../wasm/pkg"); export default defineComponent({ props: { activeTool: { type: String }, currentToolOptions: { type: Object }, }, computed: { ...
Is `value` an accurate name here? Wouldn't `toolOptions` be more accurate? Same for `final`, can you think of a more accurate or descriptive name for that?
import IconButton from "@/components/widgets/buttons/IconButton.vue"; import PopoverButton from "@/components/widgets/buttons/PopoverButton.vue"; import NumberInput from "@/components/widgets/inputs/NumberInput.vue"; const wasm = import("@/../wasm/pkg"); export default defineComponent({ props: { activeTool: { type...
@@ -38,29 +43,39 @@ const wasm = import("@/../wasm/pkg"); export default defineComponent({ props: { activeTool: { type: String }, + currentToolOptions: { type: Object }, }, - computed: {}, - methods: { - async setShapeOptions(newValue: number) { - // TODO: Each value-input widget (i.e. not a button) should ...
frontend/src/components/widgets/options/ToolOptions.vue
26
Vue
0.5
question
155
51
51
false
Add two-way tool option messaging system
361
GraphiteEditor/Graphite
17,935
Rust
Keavon
henryksloan
Review this pull request change. Language: Vue File: frontend/src/components/widgets/options/ToolOptions.vue PR Title: Add two-way tool option messaging system BEFORE CODE: import PopoverButton from "@/components/widgets/buttons/PopoverButton.vue"; import NumberInput from "@/components/widgets/inputs/NumberInput.vu...
Is `value` an accurate name here? Wouldn't `toolOptions` be more accurate? Same for `final`, can you think of a more accurate or descriptive name for that?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
methods: { async updateToolOptions(path: string[], newValue: number) { this.setToolOption(path, newValue); (await wasm).set_tool_options(this.$props.activeTool || "", this.activeToolOptions); }, async sendToolMessage(message: string | object) { (await wasm).send_tool_message(this.$props.activeTool || ""...
See the above comments for this function also.
}, async sendToolMessage(message: string | object) { (await wasm).send_tool_message(this.activeTool || "", message); }, // Traverses the given path and returns the direct parent of the option getRecordContainingOption(optionPath: string[]): Record<string, number> { const allButLast = optionPath.slice(0,...
@@ -38,29 +43,39 @@ const wasm = import("@/../wasm/pkg"); export default defineComponent({ props: { activeTool: { type: String }, + currentToolOptions: { type: Object }, }, - computed: {}, - methods: { - async setShapeOptions(newValue: number) { - // TODO: Each value-input widget (i.e. not a button) should ...
frontend/src/components/widgets/options/ToolOptions.vue
26
Vue
0.071
suggestion
46
51
51
false
Add two-way tool option messaging system
361
GraphiteEditor/Graphite
17,935
Rust
Keavon
henryksloan
Review this pull request change. Language: Vue File: frontend/src/components/widgets/options/ToolOptions.vue PR Title: Add two-way tool option messaging system BEFORE CODE: methods: { async updateToolOptions(path: string[], newValue: number) { this.setToolOption(path, newValue); (await wasm).set_tool_optio...
See the above comments for this function also.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
flex: 0 0 auto; display: flex; align-items: center; } </style> <script lang="ts"> import { defineComponent } from "vue"; import { comingSoon } from "@/utilities/errors"; import { WidgetRow, SeparatorType, IconButtonWidget } from "@/components/widgets/widgets"; import Separator from "@/components/widgets/separator...
Should this be `Record<string, object | number>`? You do an `as` cast below with that type.
height: 100%; flex: 0 0 auto; display: flex; align-items: center; } </style> <script lang="ts"> import { defineComponent, PropType } from "vue"; import { comingSoon } from "@/utilities/errors"; import { WidgetRow, SeparatorType, IconButtonWidget } from "@/components/widgets/widgets"; import Separator from "@/com...
@@ -38,29 +43,39 @@ const wasm = import("@/../wasm/pkg"); export default defineComponent({ props: { activeTool: { type: String }, + currentToolOptions: { type: Object }, }, - computed: {}, - methods: { - async setShapeOptions(newValue: number) { - // TODO: Each value-input widget (i.e. not a button) should ...
frontend/src/components/widgets/options/ToolOptions.vue
26
Vue
0.571
suggestion
91
51
51
false
Add two-way tool option messaging system
361
GraphiteEditor/Graphite
17,935
Rust
Keavon
henryksloan
Review this pull request change. Language: Vue File: frontend/src/components/widgets/options/ToolOptions.vue PR Title: Add two-way tool option messaging system BEFORE CODE: flex: 0 0 auto; display: flex; align-items: center; } </style> <script lang="ts"> import { defineComponent } from "vue"; import { comingSo...
Should this be `Record<string, object | number>`? You do an `as` cast below with that type.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
<style lang="scss"> .tool-options { height: 100%; flex: 0 0 auto; display: flex; align-items: center; } </style> <script lang="ts"> import { defineComponent } from "vue"; import { comingSoon } from "@/utilities/errors"; import { WidgetRow, SeparatorType, IconButtonWidget } from "@/components/widgets/widgets"; im...
As a bonus, could you cast this with `as PropType<Record<string, object | number>>` (perhaps not with the ` | number` part if the following comment is not correct). Search for another usage of `PropType` as an example (you'll have to import it from `"vue"`).
<style lang="scss"> .tool-options { height: 100%; flex: 0 0 auto; display: flex; align-items: center; } </style> <script lang="ts"> import { defineComponent, PropType } from "vue"; import { comingSoon } from "@/utilities/errors"; import { WidgetRow, SeparatorType, IconButtonWidget } from "@/components/widgets/wi...
@@ -38,29 +43,39 @@ const wasm = import("@/../wasm/pkg"); export default defineComponent({ props: { activeTool: { type: String }, + currentToolOptions: { type: Object },
frontend/src/components/widgets/options/ToolOptions.vue
26
Vue
0.786
suggestion
258
51
51
false
Add two-way tool option messaging system
361
GraphiteEditor/Graphite
17,935
Rust
Keavon
henryksloan
Review this pull request change. Language: Vue File: frontend/src/components/widgets/options/ToolOptions.vue PR Title: Add two-way tool option messaging system BEFORE CODE: <style lang="scss"> .tool-options { height: 100%; flex: 0 0 auto; display: flex; align-items: center; } </style> <script lang="ts"> import...
As a bonus, could you cast this with `as PropType<Record<string, object | number>>` (perhaps not with the ` | number` part if the following comment is not correct). Search for another usage of `PropType` as an example (you'll have to import it from `"vue"`).
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
}, props: {}, }, { kind: "Separator", props: { type: SeparatorType.Section } }, { kind: "IconButton", tooltip: "Boolean Union", callback: () => comingSoon(197), props: { icon: "BooleanUnion", size: 24 } }, { kind: "IconButton", tooltip: "Boolean Subtract Front", callback: () => comingSoon(19...
Just for some context of what's coming up next, #147 pertains to moving this entire definition block (`const toolOptions: Record<string, WidgetRow> = { ... };`) into the Rust. Let's keep that to another PR, of course, but that's the goal because that also unblocks #186 which is a required feature for the 0.1 release.
props: {}, }, { kind: "Separator", props: { type: SeparatorType.Section } }, { kind: "IconButton", tooltip: "Boolean Union", callback: () => comingSoon(197), props: { icon: "BooleanUnion", size: 24 } }, { kind: "IconButton", tooltip: "Boolean Subtract Front", callback: () => comingSoon(197), prop...
@@ -134,9 +149,9 @@ export default defineComponent({ props: {}, }, ], - Shape: [{ kind: "NumberInput", callback: this.setShapeOptions, props: { value: 6, min: 3, isInteger: true, label: "Sides" } }], - Line: [{ kind: "NumberInput", callback: this.setLineOptions, props: { value: 5, min: 1, isInteger: ...
frontend/src/components/widgets/options/ToolOptions.vue
26
Vue
0.643
suggestion
318
43
42
false
Add two-way tool option messaging system
361
GraphiteEditor/Graphite
17,935
Rust
Keavon
henryksloan
Review this pull request change. Language: Vue File: frontend/src/components/widgets/options/ToolOptions.vue PR Title: Add two-way tool option messaging system BEFORE CODE: }, props: {}, }, { kind: "Separator", props: { type: SeparatorType.Section } }, { kind: "IconButton", tooltip: "Boolean...
Just for some context of what's coming up next, #147 pertains to moving this entire definition block (`const toolOptions: Record<string, WidgetRow> = { ... };`) into the Rust. Let's keep that to another PR, of course, but that's the goal because that also unblocks #186 which is a required feature for the 0.1 release.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
<template> <div class="tool-options"> <template v-for="(option, index) in toolOptions[activeTool] || []" :key="index"> <!-- TODO: Use `<component :is="" v-bind="attributesObject"></component>` to avoid all the separate components with `v-if` --> <IconButton v-if="option.kind === 'IconButton'" :action="() => ha...
Since you changed the `NumberInputWidget` definition to `props: Omit<NumberInputProps, "value">;`, doesn't that mean we'll never receive an `option.props` containing a `value` property? If you agree with that logic, I think it would be clearer to separate this into two attributes: `:value="getToolOption(option.path)"` ...
<template> <div class="tool-options"> <template v-for="(option, index) in toolOptionsWidgets[activeTool] || []" :key="index"> <!-- TODO: Use `<component :is="" v-bind="attributesObject"></component>` to avoid all the separate components with `v-if` --> <IconButton v-if="option.kind === 'IconButton'" :action="(...
@@ -7,7 +7,12 @@ <h3>{{ option.popover.title }}</h3> <p>{{ option.popover.text }}</p> </PopoverButton> - <NumberInput v-if="option.kind === 'NumberInput'" v-model:value="option.props.value" @update:value="option.callback" :title="option.tooltip" v-bind="option.props" /> + <NumberInput + v-if="optio...
frontend/src/components/widgets/options/ToolOptions.vue
14
Vue
0.643
suggestion
348
39
39
false
Add two-way tool option messaging system
361
GraphiteEditor/Graphite
17,935
Rust
Keavon
henryksloan
Review this pull request change. Language: Vue File: frontend/src/components/widgets/options/ToolOptions.vue PR Title: Add two-way tool option messaging system BEFORE CODE: <template> <div class="tool-options"> <template v-for="(option, index) in toolOptions[activeTool] || []" :key="index"> <!-- TODO: Use `<c...
Since you changed the `NumberInputWidget` definition to `props: Omit<NumberInputProps, "value">;`, doesn't that mean we'll never receive an `option.props` containing a `value` property? If you agree with that logic, I think it would be clearer to separate this into two attributes: `:value="getToolOption(option.path)"` ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
title: "Flip", text: "The contents of this popover menu are coming soon", }, props: {}, }, { kind: "Separator", props: { type: SeparatorType.Section } }, { kind: "IconButton", tooltip: "Boolean Union", callback: () => comingSoon(197), props: { icon: "BooleanUnion", size: 24 } }, ...
Is there a reason that `"Polygon"` is uppercase when the others are lower snake_case?
text: "The contents of this popover menu are coming soon", }, props: {}, }, { kind: "Separator", props: { type: SeparatorType.Section } }, { kind: "IconButton", tooltip: "Boolean Union", callback: () => comingSoon(197), props: { icon: "BooleanUnion", size: 24 } }, { kind: "IconButton",...
@@ -134,9 +149,9 @@ export default defineComponent({ props: {}, }, ], - Shape: [{ kind: "NumberInput", callback: this.setShapeOptions, props: { value: 6, min: 3, isInteger: true, label: "Sides" } }], - Line: [{ kind: "NumberInput", callback: this.setLineOptions, props: { value: 5, min: 1, isInteger: ...
frontend/src/components/widgets/options/ToolOptions.vue
26
Vue
0.357
question
85
45
44
false
Add two-way tool option messaging system
361
GraphiteEditor/Graphite
17,935
Rust
Keavon
henryksloan
Review this pull request change. Language: Vue File: frontend/src/components/widgets/options/ToolOptions.vue PR Title: Add two-way tool option messaging system BEFORE CODE: title: "Flip", text: "The contents of this popover menu are coming soon", }, props: {}, }, { kind: "Separator", ...
Is there a reason that `"Polygon"` is uppercase when the others are lower snake_case?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
// eslint-disable-next-line @typescript-eslint/no-explicit-any export function panicProxy(module: any) { const proxyHandler = { // eslint-disable-next-line @typescript-eslint/no-explicit-any get(target: any, propKey: any, receiver: any) { const interceptedFunction = target[propKey]; // TODO: Figure out how ...
If this is the only branch of this block that can return, why not use `return targetValue.apply(this, args);`
// Import this function and chain it on all `wasm` imports like: const wasm = import("@/../wasm/pkg").then(panicProxy); // This works by proxying every function call wrapping a try-catch block to filter out redundant and confusing `RuntimeError: unreachable` exceptions sent to the console // eslint-disable-next-line @t...
@@ -0,0 +1,49 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function panicProxy(module: any) { + const proxyHandler = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + get(target: any, propKey: any, receiver: any) { + const interceptedFunction = target[propKey]; + + ...
frontend/src/utilities/panic.ts
19
TypeScript
0.571
suggestion
109
44
44
false
Show a crash dialog when the editor panics
362
GraphiteEditor/Graphite
17,935
Rust
henryksloan
Keavon
Review this pull request change. Language: TypeScript File: frontend/src/utilities/panic.ts PR Title: Show a crash dialog when the editor panics BEFORE CODE: // eslint-disable-next-line @typescript-eslint/no-explicit-any export function panicProxy(module: any) { const proxyHandler = { // eslint-disable-next-line...
If this is the only branch of this block that can return, why not use `return targetValue.apply(this, args);`
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if (direction === "Increase" && this.incrementCallbackIncrease) this.incrementCallbackIncrease(); if (direction === "Decrease" && this.incrementCallbackDecrease) this.incrementCallbackDecrease(); break; } default: break; } }, updateValue(newValue: number) { let sanitized = newValue...
These examples really don't make any sense to me. `10.25 -> 2` leads me to believe "left side digits" means left of the decimal point. `1.23` leads me to believe it means all the digits. `0.23` leads me to believe it means left of the decimal point. What does "left side digits" and "digits on the left side of the numbe...
if (direction === "Increase" && this.incrementCallbackIncrease) this.incrementCallbackIncrease(); if (direction === "Decrease" && this.incrementCallbackDecrease) this.incrementCallbackDecrease(); break; } default: break; } }, updateValue(newValue: number) { let sanitized = newValue...
@@ -240,13 +242,21 @@ export default defineComponent({ if (invalid) sanitized = this.value; if (this.isInteger) sanitized = Math.round(sanitized); - if (typeof this.min === "number" && !Number.isNaN(this.min)) sanitized = Math.max(sanitized, this.min); - if (typeof this.max === "number" && !Number.isNaN(t...
frontend/src/components/widgets/inputs/NumberInput.vue
26
Vue
0.571
question
328
51
51
false
Better decimal rounding in the NumberInput widget
457
GraphiteEditor/Graphite
17,935
Rust
Keavon
mfish33
Review this pull request change. Language: Vue File: frontend/src/components/widgets/inputs/NumberInput.vue PR Title: Better decimal rounding in the NumberInput widget BEFORE CODE: if (direction === "Increase" && this.incrementCallbackIncrease) this.incrementCallbackIncrease(); if (direction === "Decrease...
These examples really don't make any sense to me. `10.25 -> 2` leads me to believe "left side digits" means left of the decimal point. `1.23` leads me to believe it means all the digits. `0.23` leads me to believe it means left of the decimal point. What does "left side digits" and "digits on the left side of the numbe...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
responses.push_back(FolderChanged(vec![]).into()); } FolderChanged(path) => { let _ = self.graphene_document.render_root(self.view_mode); responses.extend([LayerChanged(path).into(), DocumentStructureChanged.into()]); } DocumentStructureChanged => { let data_buffer: RawBuffer = self.serializ...
I think this should be an error right? could we maybe add a log::warn! in the else case? I don't think this should ever not be true
responses.push_back(FolderChanged(vec![]).into()); } FolderChanged(path) => { let _ = self.graphene_document.render_root(self.view_mode); responses.extend([LayerChanged(path).into(), DocumentStructureChanged.into()]); } DocumentStructureChanged => { let data_buffer: RawBuffer = self.serializ...
@@ -842,10 +847,12 @@ impl MessageHandler<DocumentMessage, &InputPreprocessor> for DocumentMessageHand } DocumentResponse::LayerChanged { path } => responses.push_back(LayerChanged(path.clone()).into()), DocumentResponse::CreatedLayer { path } => { - self.layer_metadata.insert(path.clone(...
editor/src/document/document_file.rs
26
Rust
0.571
suggestion
132
51
51
false
Migrate to using MoveSelectedLayersTo
469
GraphiteEditor/Graphite
17,935
Rust
TrueDoctor
0HyperCube
Review this pull request change. Language: Rust File: editor/src/document/document_file.rs PR Title: Migrate to using MoveSelectedLayersTo BEFORE CODE: responses.push_back(FolderChanged(vec![]).into()); } FolderChanged(path) => { let _ = self.graphene_document.render_root(self.view_mode); response...
I think this should be an error right? could we maybe add a log::warn! in the else case? I don't think this should ever not be true
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} } // Needed to make JsEditorHandle functions pub to Rust. // The reason is not fully clear but it has to do with the #[wasm_bindgen] procedural macro. impl JsEditorHandle { pub fn send_frontend_message_to_js_rust_proxy(&self, message: FrontendMessage) { self.send_frontend_message_to_js(message); } } impl Drop ...
This should probably say something about "when using a tool", maybe `layer_deleted_while_using_tool` is a better name for it?
//! This file is where functions are defined to be called directly from JS. //! It serves as a thin wrapper over the editor backend API that relies //! on the dispatcher messaging system and more complex Rust data types. use crate::helpers::{translate_key, Error}; use crate::{EDITOR_HAS_CRASHED, EDITOR_INSTANCES, JS_E...
@@ -435,3 +435,23 @@ impl Drop for JsEditorHandle { EDITOR_INSTANCES.with(|instances| instances.borrow_mut().remove(&self.editor_id)); } } + +#[cfg(test)] +mod layer_delete_bug_tests { + use super::*; + + use editor::misc::test_utils::EditorTestUtils; + use editor::viewport_tools::tool::ToolType; + + #[test] + fn...
frontend/wasm/src/editor_api.rs
26
Rust
0.571
question
125
37
438
false
Fix layer deletion bugs when tools are in use
684
GraphiteEditor/Graphite
17,935
Rust
Keavon
ghost
Review this pull request change. Language: Rust File: frontend/wasm/src/editor_api.rs PR Title: Fix layer deletion bugs when tools are in use BEFORE CODE: } } // Needed to make JsEditorHandle functions pub to Rust. // The reason is not fully clear but it has to do with the #[wasm_bindgen] procedural macro. impl J...
This should probably say something about "when using a tool", maybe `layer_deleted_while_using_tool` is a better name for it?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
pub fn should_close_shape(&self) -> bool { if self.last_point(ManipulatorType::Anchor).is_none() { return false; } self.first_point(ManipulatorType::Anchor) .unwrap() .position .distance(self.last_point(ManipulatorType::Anchor).unwrap().position) < 0.001 // TODO Replace with constant, a small eps...
We should definitely add this function to the `bezier-rs` implementation of `Subpath`. I'm wondering if it'd be beneficial to do it as part of this PR. If you were to add this code into `libraries/bezier-rs/subpath/solvers.rs` and use the `bezier-rs` `Subpath` instead, I think you'd be able to avoid needing `PathIte...
pub fn should_close_shape(&self) -> bool { if self.last_point(ManipulatorType::Anchor).is_none() { return false; } self.first_point(ManipulatorType::Anchor) .unwrap() .position .distance(self.last_point(ManipulatorType::Anchor).unwrap().position) < 0.001 // TODO Replace with constant, a small eps...
@@ -334,15 +334,14 @@ impl Subpath { &mut self.0 } - // ** INTERFACE WITH KURBO ** - - // TODO Implement our own a local bounding box calculation /// Return the bounding box of the shape - pub fn bounding_box(&self) -> Rect { - <&Self as Into<BezPath>>::into(self).bounding_box() + pub fn bounding_box(&self) -...
graphene/src/layers/vector/subpath.rs
26
Rust
0.643
suggestion
431
51
51
false
Add point insertion to the Path tool
754
GraphiteEditor/Graphite
17,935
Rust
hannahli2010
0HyperCube
Review this pull request change. Language: Rust File: graphene/src/layers/vector/subpath.rs PR Title: Add point insertion to the Path tool BEFORE CODE: pub fn should_close_shape(&self) -> bool { if self.last_point(ManipulatorType::Anchor).is_none() { return false; } self.first_point(ManipulatorType::Anch...
We should definitely add this function to the `bezier-rs` implementation of `Subpath`. I'm wondering if it'd be beneficial to do it as part of this PR. If you were to add this code into `libraries/bezier-rs/subpath/solvers.rs` and use the `bezier-rs` `Subpath` instead, I think you'd be able to avoid needing `PathIte...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
let transform = document.generate_transform_relative_to_viewport(layer_path).ok()?; let layer_pos = transform.inverse().transform_point2(pos); let projection_options = bezier_rs::ProjectionOptions { lut_size: 5, ..Default::default() }; if let Some(shape) = document.layer(layer_path).ok()?.as_subpath() { for...
This comment does not match with the function
let mut result: Option<(BezierId, f64)> = None; let mut closest_distance_squared: f64 = tolerance * tolerance; for bezier_id in document.layer(layer_path).ok()?.as_subpath()?.bezier_iter() { let bezier = bezier_id.internal; let t = bezier.project(layer_pos, projection_options); let layerspace = bezier....
@@ -259,6 +259,73 @@ impl ShapeEditor { result } + /// Find the path segement we have clicked upon + /// + /// Returns the [`BezierId`] and t as an f64 + fn closest_segement(&self, document: &Document, layer_path: &[LayerId], pos: glam::DVec2, tolerance: f64) -> Option<(BezierId, f64)> { + let mut closest_dista...
editor/src/messages/tool/common_functionality/shape_editor.rs
26
Rust
0.071
suggestion
45
51
51
false
Add point insertion to the Path tool
754
GraphiteEditor/Graphite
17,935
Rust
nupsi
0HyperCube
Review this pull request change. Language: Rust File: editor/src/messages/tool/common_functionality/shape_editor.rs PR Title: Add point insertion to the Path tool BEFORE CODE: let transform = document.generate_transform_relative_to_viewport(layer_path).ok()?; let layer_pos = transform.inverse().transform_point2...
This comment does not match with the function
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
fn closest_point_in_layer(&self, document: &Document, layer_path: &[LayerId], pos: glam::DVec2) -> Option<(u64, usize, f64)> { let mut closest_distance_squared: f64 = f64::MAX; // Not ideal let mut result: Option<(u64, usize, f64)> = None; if let Some(shape) = document.layer(layer_path).ok()?.as_subpath() { ...
s**ege**ment is used in here and in comments in `graphene/src/layers/vector/subpath.rs` is this a typo for segment, or does it mean something special?
fn closest_point_in_layer(&self, document: &Document, layer_path: &[LayerId], pos: glam::DVec2) -> Option<(u64, usize, f64)> { let mut closest_distance_squared: f64 = f64::MAX; // Not ideal let mut result: Option<(u64, usize, f64)> = None; if let Some(shape) = document.layer(layer_path).ok()?.as_subpath() { ...
@@ -259,6 +259,73 @@ impl ShapeEditor { result } + /// Find the path segement we have clicked upon + /// + /// Returns the [`BezierId`] and t as an f64 + fn closest_segement(&self, document: &Document, layer_path: &[LayerId], pos: glam::DVec2, tolerance: f64) -> Option<(BezierId, f64)> {
editor/src/messages/tool/common_functionality/shape_editor.rs
26
Rust
0.571
question
150
51
51
false
Add point insertion to the Path tool
754
GraphiteEditor/Graphite
17,935
Rust
nupsi
0HyperCube
Review this pull request change. Language: Rust File: editor/src/messages/tool/common_functionality/shape_editor.rs PR Title: Add point insertion to the Path tool BEFORE CODE: fn closest_point_in_layer(&self, document: &Document, layer_path: &[LayerId], pos: glam::DVec2) -> Option<(u64, usize, f64)> { let mut cl...
s**ege**ment is used in here and in comments in `graphene/src/layers/vector/subpath.rs` is this a typo for segment, or does it mean something special?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
props: { value: { type: String as PropType<string | undefined>, required: false }, label: { type: String as PropType<string>, required: false }, noTransparency: { type: Boolean as PropType<boolean>, default: false }, disabled: { type: Boolean as PropType<boolean>, default: false }, tooltip: { type: String as...
don't know if this is cleaner but you could do ```ts const [r, g, b, a] = this.value.match(/.{1,2}/g).map(byte => parseInt(byte, 16)) ``` the match(/.{1,2}/g) chunks the string into pairs https://stackoverflow.com/questions/7033639/split-large-string-in-n-size-chunks-in-javascript You also have to make the if ...
props: { value: { type: String as PropType<string | undefined>, required: false }, label: { type: String as PropType<string>, required: false }, noTransparency: { type: Boolean as PropType<boolean>, default: false }, disabled: { type: Boolean as PropType<boolean>, default: false }, tooltip: { type: String as...
@@ -98,16 +95,17 @@ export default defineComponent({ }; }, computed: { - color() { - if (!this.value) return { r: 0, g: 0, b: 0, a: 1 }; - - const r = parseInt(this.value.slice(0, 2), 16); - const g = parseInt(this.value.slice(2, 4), 16); - const b = parseInt(this.value.slice(4, 6), 16); - const a = p...
frontend/src/components/widgets/inputs/ColorInput.vue
26
Vue
1
bug
368
51
51
false
Refactor color picker floating menu
809
GraphiteEditor/Graphite
17,935
Rust
mfish33
Keavon
Review this pull request change. Language: Vue File: frontend/src/components/widgets/inputs/ColorInput.vue PR Title: Refactor color picker floating menu BEFORE CODE: props: { value: { type: String as PropType<string | undefined>, required: false }, label: { type: String as PropType<string>, required: false }, ...
don't know if this is cleaner but you could do ```ts const [r, g, b, a] = this.value.match(/.{1,2}/g).map(byte => parseInt(byte, 16)) ``` the match(/.{1,2}/g) chunks the string into pairs https://stackoverflow.com/questions/7033639/split-large-string-in-n-size-chunks-in-javascript You also have to make the if ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
const outputConnectedNodeID = outputNode?.getAttribute("data-node") ?? undefined; const inputConnectedNodeID = inputNode?.getAttribute("data-node") ?? undefined; if (outputNode && inputNode && outputConnectedNodeID && inputConnectedNodeID) { const inputNodeInPorts = Array.from(inputNode.querySelectorA...
Nit: extraneous space at the start of the template string. While you're here, would you mind giving the code a little breathing room by spacing out the related blocks of lines? Also while you're working in this event handler, would you mind adding something for closing the Add Nodes menu if you click out of it wh...
if (this.disconnecting) { this.editor.instance.disconnectNodes(BigInt(this.disconnecting.nodeId), this.disconnecting.inputIndex); } this.disconnecting = undefined; if (this.linkInProgressToConnector instanceof HTMLDivElement && this.linkInProgressFromConnector) { const outputNode = this.linkInProg...
@@ -632,6 +647,38 @@ export default defineComponent({ } } this.editor.instance.moveSelectedNodes(this.draggingNodes.roundX, this.draggingNodes.roundY); + + if (this.selected.length === 1) { + const id = this.selected[0]; + const selectedNode = containerBounds.querySelector(` [data-node="${Str...
frontend/src/components/panels/NodeGraph.vue
26
Vue
0.571
nitpick
344
51
51
false
Add drag to connect nodes
901
GraphiteEditor/Graphite
17,935
Rust
Keavon
0HyperCube
Review this pull request change. Language: Vue File: frontend/src/components/panels/NodeGraph.vue PR Title: Add drag to connect nodes BEFORE CODE: const outputConnectedNodeID = outputNode?.getAttribute("data-node") ?? undefined; const inputConnectedNodeID = inputNode?.getAttribute("data-node") ?? undefined;...
Nit: extraneous space at the start of the template string. While you're here, would you mind giving the code a little breathing room by spacing out the related blocks of lines? Also while you're working in this event handler, would you mind adding something for closing the Add Nodes menu if you click out of it wh...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
pub fn connect_nodes_by_link(&self, output_node: u64, input_node: u64, input_node_connector_index: usize) { let message = NodeGraphMessage::ConnectNodesByLink { output_node, input_node, input_node_connector_index, }; self.dispatch(message); } /// Notifies the backend that the user disconnected a node...
It's probably safe to also check if the connector curve is entirely within a node (which, once we change the design to make nodes bigger, or perhaps if you have a wide node with a long name and a lot of exposed inputs, this will matter more): `is_contained_within()`
pub fn connect_nodes_by_link(&self, output_node: u64, input_node: u64, input_node_connector_index: usize) { let message = NodeGraphMessage::ConnectNodesByLink { output_node, input_node, input_node_connector_index, }; self.dispatch(message); } /// Shifts the node and its children to stop nodes going o...
@@ -594,6 +594,18 @@ impl JsEditorHandle { self.dispatch(message); } + /// Check for intersections between the curve and a rectangle defined by opposite corners + #[wasm_bindgen(js_name = rectangleIntersects)] + pub fn rectangle_intersects(&self, bezier_x: Vec<f64>, bezier_y: Vec<f64>, top: f64, left: f64, botto...
frontend/wasm/src/editor_api.rs
26
Rust
0.643
suggestion
266
51
51
false
Add drag to connect nodes
901
GraphiteEditor/Graphite
17,935
Rust
Keavon
0HyperCube
Review this pull request change. Language: Rust File: frontend/wasm/src/editor_api.rs PR Title: Add drag to connect nodes BEFORE CODE: pub fn connect_nodes_by_link(&self, output_node: u64, input_node: u64, input_node_connector_index: usize) { let message = NodeGraphMessage::ConnectNodesByLink { output_node, ...
It's probably safe to also check if the connector curve is entirely within a node (which, once we change the design to make nodes bigger, or perhaps if you have a wide node with a long name and a lot of exposed inputs, this will matter more): `is_contained_within()`
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} #[derive(Clone, Debug, Default, PartialEq, DynAny)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct NodeNetwork { pub inputs: Vec<NodeId>, pub output: NodeId, pub nodes: HashMap<NodeId, DocumentNode>, } impl NodeNetwork { pub fn map_ids(&mut self, f: impl Fn(NodeId) -> No...
Does outward mean downstream? That's how I interpret it but I want to make sure that's correct. Maybe if you can put "(downstream/rightward)" in the comment, that'd help make it clearer. And consider, depending if you agree with me about its greater clarity, renaming the function from `outwards` to `downstream`.
} #[derive(Clone, Debug, Default, PartialEq, DynAny)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct NodeNetwork { pub inputs: Vec<NodeId>, pub output: NodeId, pub nodes: HashMap<NodeId, DocumentNode>, } impl NodeNetwork { pub fn map_ids(&mut self, f: impl Fn(NodeId) -> No...
@@ -180,6 +180,19 @@ impl NodeNetwork { .collect(); } + /// Collect a hashmap of nodes with a list of the nodes that use it as input
node-graph/graph-craft/src/document.rs
26
Rust
0.643
suggestion
313
51
51
false
Add drag to connect nodes
901
GraphiteEditor/Graphite
17,935
Rust
Keavon
0HyperCube
Review this pull request change. Language: Rust File: node-graph/graph-craft/src/document.rs PR Title: Add drag to connect nodes BEFORE CODE: } #[derive(Clone, Debug, Default, PartialEq, DynAny)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct NodeNetwork { pub inputs: Vec<...
Does outward mean downstream? That's how I interpret it but I want to make sure that's correct. Maybe if you can put "(downstream/rightward)" in the comment, that'd help make it clearer. And consider, depending if you agree with me about its greater clarity, renaming the function from `outwards` to `downstream`.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if let NodeInput::Value { tagged_value: TaggedValue::VecF32(x), exposed: false, } = &document_node.inputs[index] { widgets.extend_from_slice(&[ Separator::new(SeparatorType::Unrelated).widget_holder(), text_props .value(x.iter().map(|v| v.to_string()).collect::<Vec<_>>().join(", ")) .on_update(op...
If we want to be more forgiving with the syntax, allowing the style of `<path d=` in SVG, we could do something like: ```rs string .split(|c: char| !c.is_alphanumeric() && !matches!(c, '.' | '+' | '-')) .filter(|x| !x.is_empty()) .map(|x| x.parse::<f64>().ok()) .collect::<Option<Vec<_>>>() .map(|numbers| nu...
tagged_value: TaggedValue::VecF32(x), exposed: false, } = &document_node.inputs[index] { widgets.extend_from_slice(&[ Separator::new(SeparatorType::Unrelated).widget_holder(), text_props .value(x.iter().map(|v| v.to_string()).collect::<Vec<_>>().join(", ")) .on_update(optionally_update_value(move ...
@@ -217,6 +218,49 @@ fn vec_f32_input(document_node: &DocumentNode, node_id: NodeId, index: usize, na } widgets } + +fn vec_dvec2_input(document_node: &DocumentNode, node_id: NodeId, index: usize, name: &str, text_props: TextInput, blank_assist: bool) -> Vec<WidgetHolder> { + let mut widgets = start_widgets(docume...
editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/node_properties.rs
26
Rust
0.857
style
429
51
51
false
New nodes: shape/curve primitives
1,389
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
Ezbaze
Review this pull request change. Language: Rust File: editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/node_properties.rs PR Title: New nodes: shape/curve primitives BEFORE CODE: if let NodeInput::Value { tagged_value: TaggedValue::VecF32(x), exposed: false, } = &document_node.inpu...
If we want to be more forgiving with the syntax, allowing the style of `<path d=` in SVG, we could do something like: ```rs string .split(|c: char| !c.is_alphanumeric() && !matches!(c, '.' | '+' | '-')) .filter(|x| !x.is_empty()) .map(|x| x.parse::<f64>().ok()) .collect::<Option<Vec<_>>>() .map(|numbers| nu...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
.trim() .split("),") .filter(|x| !x.is_empty()) .map(|item| { let parts: Vec<_> = item.trim().split(",").filter(|x| !x.is_empty()).collect(); if parts.len() == 2 { let x = parts[0].trim().trim_end_matches(')').trim_start_matches('(').trim().parse::<f64>().ok()?; let y = parts[1].trim().tri...
Could be shortened to: ```rs .value(x.iter().map(|v| format!("({}, {})", v.x, v.y)).collect::<Vec<_>>().join(", ") ```
.map(TaggedValue::VecDVec2) }; if let NodeInput::Value { tagged_value: TaggedValue::VecDVec2(x), exposed: false, } = &document_node.inputs[index] { widgets.extend_from_slice(&[ Separator::new(SeparatorType::Unrelated).widget_holder(), text_props .value(x.iter().map(|v| format!("({}, {})", v.x, v...
@@ -217,6 +218,49 @@ fn vec_f32_input(document_node: &DocumentNode, node_id: NodeId, index: usize, na } widgets } + +fn vec_dvec2_input(document_node: &DocumentNode, node_id: NodeId, index: usize, name: &str, text_props: TextInput, blank_assist: bool) -> Vec<WidgetHolder> { + let mut widgets = start_widgets(docume...
editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/node_properties.rs
26
Rust
0.786
suggestion
121
51
51
false
New nodes: shape/curve primitives
1,389
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
Ezbaze
Review this pull request change. Language: Rust File: editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/node_properties.rs PR Title: New nodes: shape/curve primitives BEFORE CODE: .trim() .split("),") .filter(|x| !x.is_empty()) .map(|item| { let parts: Vec<_> = item.trim()...
Could be shortened to: ```rs .value(x.iter().map(|v| format!("({}, {})", v.x, v.y)).collect::<Vec<_>>().join(", ") ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
pub fn eq_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> { let operand = |name: &str, index| { let widgets = number_widget(document_node, node_id, index, name, NumberInput::default(), true); LayoutGroup::Row { widgets } }; vec![operand("Equal...
There is no real need to have an operand closure only to call it once. Could be shortened to: ```rs let radius = number_widget(document_node, node_id, 1, "radius", NumberInput::default(), true); vec![LayoutGroup::Row { widgets: radius }] ```
LayoutGroup::Row { widgets } }; vec![operand("Modulo", 1)] } pub fn circle_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> { vec![LayoutGroup::Row { widgets: number_widget(document_node, node_id, 1, "Radius", NumberInput::default(), true), }] ...
@@ -1139,6 +1183,58 @@ pub fn modulo_properties(document_node: &DocumentNode, node_id: NodeId, _context vec![operand("Modulo", 1)] } +pub fn circle_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> { + let operand = |name: &str, index| { + let widg...
editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/node_properties.rs
26
Rust
0.857
suggestion
245
51
51
false
New nodes: shape/curve primitives
1,389
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
Ezbaze
Review this pull request change. Language: Rust File: editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/node_properties.rs PR Title: New nodes: shape/curve primitives BEFORE CODE: pub fn eq_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) ->...
There is no real need to have an operand closure only to call it once. Could be shortened to: ```rs let radius = number_widget(document_node, node_id, 1, "radius", NumberInput::default(), true); vec![LayoutGroup::Row { widgets: radius }] ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
use crate::uuid::ManipulatorGroupId; use crate::vector::VectorData; use crate::Node; use bezier_rs::Subpath; use glam::DVec2; #[derive(Debug, Clone, Copy)] pub struct UnitCircleGenerator<Radius> { radius: Radius, } #[node_macro::node_fn(UnitCircleGenerator)] fn unit_circle(_input: (), radius: f32) -> VectorData { ...
Where you have mentioned unit in these node names is outdated (as the output can be of any size).
use crate::uuid::ManipulatorGroupId; use crate::vector::VectorData; use crate::Node; use bezier_rs::Subpath; use glam::DVec2; #[derive(Debug, Clone, Copy)] pub struct CircleGenerator<Radius> { radius: Radius, } #[node_macro::node_fn(CircleGenerator)] fn circle_generator(_input: (), radius: f32) -> VectorData { le...
@@ -6,19 +6,96 @@ use bezier_rs::Subpath; use glam::DVec2; -pub struct UnitCircleGenerator; +#[derive(Debug, Clone, Copy)] +pub struct UnitCircleGenerator<Radius> {
node-graph/gcore/src/vector/generator_nodes.rs
10
Rust
0.214
nitpick
97
35
35
false
New nodes: shape/curve primitives
1,389
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
Ezbaze
Review this pull request change. Language: Rust File: node-graph/gcore/src/vector/generator_nodes.rs PR Title: New nodes: shape/curve primitives BEFORE CODE: use crate::uuid::ManipulatorGroupId; use crate::vector::VectorData; use crate::Node; use bezier_rs::Subpath; use glam::DVec2; #[derive(Debug, Clone, Copy)]...
Where you have mentioned unit in these node names is outdated (as the output can be of any size).
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
use glam::DVec2; #[derive(Debug, Clone, Copy)] pub struct UnitCircleGenerator<Radius> { radius: Radius, } #[node_macro::node_fn(UnitCircleGenerator)] fn unit_circle(_input: (), radius: f32) -> VectorData { let radius = radius.into(); super::VectorData::from_subpath(Subpath::new_ellipse(DVec2::splat(radius * -1.),...
Could be simplified to: ```rs let radius = DVec2::new(radius_x as f64, radius_y as f64); let corner1 = -radius; let corner2 = radius; ```
use glam::DVec2; #[derive(Debug, Clone, Copy)] pub struct CircleGenerator<Radius> { radius: Radius, } #[node_macro::node_fn(CircleGenerator)] fn circle_generator(_input: (), radius: f32) -> VectorData { let radius: f64 = radius.into(); super::VectorData::from_subpath(Subpath::new_ellipse(DVec2::splat(-radius), DV...
@@ -6,19 +6,96 @@ use bezier_rs::Subpath; use glam::DVec2; -pub struct UnitCircleGenerator; +#[derive(Debug, Clone, Copy)] +pub struct UnitCircleGenerator<Radius> { + radius: Radius, +} #[node_macro::node_fn(UnitCircleGenerator)] -fn unit_circle(_input: ()) -> VectorData { - super::VectorData::from_subpath(Subp...
node-graph/gcore/src/vector/generator_nodes.rs
26
Rust
0.786
suggestion
142
51
51
false
New nodes: shape/curve primitives
1,389
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
Ezbaze
Review this pull request change. Language: Rust File: node-graph/gcore/src/vector/generator_nodes.rs PR Title: New nodes: shape/curve primitives BEFORE CODE: use glam::DVec2; #[derive(Debug, Clone, Copy)] pub struct UnitCircleGenerator<Radius> { radius: Radius, } #[node_macro::node_fn(UnitCircleGenerator)] fn u...
Could be simplified to: ```rs let radius = DVec2::new(radius_x as f64, radius_y as f64); let corner1 = -radius; let corner2 = radius; ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
pub struct UnitElipseGenerator<RadiusX, RadiusY> { radius_x: RadiusX, radius_y: RadiusY, } #[node_macro::node_fn(UnitElipseGenerator)] fn unit_elipse(_input: (), radius_x: f32, radius_y: f32) -> VectorData { let radius_x = radius_x.into(); let radius_y: f64 = radius_y.into(); let corner1 = DVec2::new(radius_x * -...
The size here is actual half of the side - either rename it or change it to be the actual size: ```rs let size = DVec2::new(size_x as f64, size_y as f64); let corner1 = -size / 2.; let corner2 = size / 2.; ```
pub struct EllipseGenerator<RadiusX, RadiusY> { radius_x: RadiusX, radius_y: RadiusY, } #[node_macro::node_fn(EllipseGenerator)] fn ellipse_generator(_input: (), radius_x: f32, radius_y: f32) -> VectorData { let radius = DVec2::new(radius_x as f64, radius_y as f64); let corner1 = -radius; let corner2 = radius; s...
@@ -6,19 +6,96 @@ use bezier_rs::Subpath; use glam::DVec2; -pub struct UnitCircleGenerator; +#[derive(Debug, Clone, Copy)] +pub struct UnitCircleGenerator<Radius> { + radius: Radius, +} #[node_macro::node_fn(UnitCircleGenerator)] -fn unit_circle(_input: ()) -> VectorData { - super::VectorData::from_subpath(Subp...
node-graph/gcore/src/vector/generator_nodes.rs
26
Rust
0.857
suggestion
214
51
51
false
New nodes: shape/curve primitives
1,389
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
Ezbaze
Review this pull request change. Language: Rust File: node-graph/gcore/src/vector/generator_nodes.rs PR Title: New nodes: shape/curve primitives BEFORE CODE: pub struct UnitElipseGenerator<RadiusX, RadiusY> { radius_x: RadiusX, radius_y: RadiusY, } #[node_macro::node_fn(UnitElipseGenerator)] fn unit_elipse(_inpu...
The size here is actual half of the side - either rename it or change it to be the actual size: ```rs let size = DVec2::new(size_x as f64, size_y as f64); let corner1 = -size / 2.; let corner2 = size / 2.; ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
#[derive(Debug, Clone, Copy)] pub struct UnitPolygonGenerator<Points, Radius> { points: Points, radius: Radius, } #[node_macro::node_fn(UnitPolygonGenerator)] fn unit_polygon(_input: (), points: u32, radius: f32) -> VectorData { let points = points.into(); let radius = (radius * 2.).into(); super::VectorData::fr...
These actually refer to the diameter and would ideally be named as such.
pub struct RegularPolygonGenerator<Points, Radius> { points: Points, radius: Radius, } #[node_macro::node_fn(RegularPolygonGenerator)] fn regular_polygon_generator(_input: (), points: u32, radius: f32) -> VectorData { let points = points.into(); let radius: f64 = (radius * 2.).into(); super::VectorData::from_subp...
@@ -6,19 +6,96 @@ use bezier_rs::Subpath; use glam::DVec2; -pub struct UnitCircleGenerator; +#[derive(Debug, Clone, Copy)] +pub struct UnitCircleGenerator<Radius> { + radius: Radius, +} #[node_macro::node_fn(UnitCircleGenerator)] -fn unit_circle(_input: ()) -> VectorData { - super::VectorData::from_subpath(Subp...
node-graph/gcore/src/vector/generator_nodes.rs
26
Rust
0.214
suggestion
72
51
51
false
New nodes: shape/curve primitives
1,389
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
Ezbaze
Review this pull request change. Language: Rust File: node-graph/gcore/src/vector/generator_nodes.rs PR Title: New nodes: shape/curve primitives BEFORE CODE: #[derive(Debug, Clone, Copy)] pub struct UnitPolygonGenerator<Points, Radius> { points: Points, radius: Radius, } #[node_macro::node_fn(UnitPolygonGenerat...
These actually refer to the diameter and would ideally be named as such.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
register_node!(graphene_std::raster::ImageFrameNode<_, _>, input: Image<Color>, params: [DAffine2]), register_node!(graphene_std::raster::PixelNoiseNode<_, _, _>, input: u32, params: [u32, u32, NoiseType]), #[cfg(feature = "quantization")] register_node!(graphene_std::quantization::GenerateQuantizationNode<_, _...
The node names here are outdated as they include `Unit` when they actually output arbitrary sizes.
register_node!(graphene_std::raster::ImageFrameNode<_, _>, input: Image<Color>, params: [DAffine2]), register_node!(graphene_std::raster::PixelNoiseNode<_, _, _>, input: u32, params: [u32, u32, NoiseType]), #[cfg(feature = "quantization")] register_node!(graphene_std::quantization::GenerateQuantizationNode<_, _...
@@ -630,7 +630,13 @@ fn node_registry() -> HashMap<NodeIdentifier, HashMap<NodeIOTypes, NodeConstruct register_node!(graphene_core::vector::RepeatNode<_, _>, input: VectorData, params: [DVec2, u32]), register_node!(graphene_core::vector::BoundingBoxNode, input: VectorData, params: []), register_node!(graphene_...
node-graph/interpreted-executor/src/node_registry.rs
26
Rust
0.357
suggestion
98
51
51
false
New nodes: shape/curve primitives
1,389
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
Ezbaze
Review this pull request change. Language: Rust File: node-graph/interpreted-executor/src/node_registry.rs PR Title: New nodes: shape/curve primitives BEFORE CODE: register_node!(graphene_std::raster::ImageFrameNode<_, _>, input: Image<Color>, params: [DAffine2]), register_node!(graphene_std::raster::PixelNoise...
The node names here are outdated as they include `Unit` when they actually output arbitrary sizes.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
.collect::<Result<Vec<_>, _>>() .ok() .map(TaggedValue::VecF32) }; if let NodeInput::Value { tagged_value: TaggedValue::VecF32(x), exposed: false, } = &document_node.inputs[index] { widgets.extend_from_slice(&[ Separator::new(SeparatorType::Unrelated).widget_holder(), text_props .value(x.i...
This line is now unnecessary (you can also remove the regex dependency).
.ok() .map(TaggedValue::VecF32) }; if let NodeInput::Value { tagged_value: TaggedValue::VecF32(x), exposed: false, } = &document_node.inputs[index] { widgets.extend_from_slice(&[ Separator::new(SeparatorType::Unrelated).widget_holder(), text_props .value(x.iter().map(|v| v.to_string()).collec...
@@ -217,6 +218,37 @@ fn vec_f32_input(document_node: &DocumentNode, node_id: NodeId, index: usize, na } widgets } + +fn vec_dvec2_input(document_node: &DocumentNode, node_id: NodeId, index: usize, name: &str, text_props: TextInput, blank_assist: bool) -> Vec<WidgetHolder> { + let mut widgets = start_widgets(docume...
editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/node_properties.rs
26
Rust
0.286
suggestion
72
51
51
false
New nodes: shape/curve primitives
1,389
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
Ezbaze
Review this pull request change. Language: Rust File: editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/node_properties.rs PR Title: New nodes: shape/curve primitives BEFORE CODE: .collect::<Result<Vec<_>, _>>() .ok() .map(TaggedValue::VecF32) }; if let NodeInput::Value { ta...
This line is now unnecessary (you can also remove the regex dependency).
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
use super::curve::{Curve, CurveManipulatorGroup, ValueMapperNode}; use super::{Channel, Color, Image, ImageFrame, Node}; use bezier_rs::{Bezier, TValue}; use dyn_any::{DynAny, StaticType}; use core::fmt::Debug; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; #[cfg(target_arch = "spirv")] use spirv_std:...
Would it be possible to mutate the existing image to avoid unnecessary allocations - something like: ```rs pub fn color_fill_node(mut image_frame: ImageFrame<Color>, color: Color) -> ImageFrame<Color> { for pixel in &mut image_frame.image.data { *pixel = color; } } ```
// Color { red: 0., green: 1., blue: 0., alpha: 1. } let overlay_color = Color::GREEN; // 100% of the output should come from the multiplied value let opacity = 100_f32; let result = ColorOverlayNode { color: ClonedNode(overlay_color), blend_mode: ClonedNode(BlendMode::Multiply), opacity: ClonedNode(opaci...
@@ -924,6 +924,34 @@ fn generate_curves<_Channel: Channel + super::Linear>(_primary: (), curve: Curve ValueMapperNode::new(lut) } +#[derive(Debug, Clone)] +pub struct ColorFillNode<C> { + color: C, +} + +#[node_macro::node_fn(ColorFillNode)] +pub fn color_fill_node(image_frame: ImageFrame<Color>, color: Color) -> ...
node-graph/gcore/src/raster/adjustments.rs
26
Rust
0.857
performance
280
978
42
false
New node: Color Overlay
1,391
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
dhruv-ahuja
Review this pull request change. Language: Rust File: node-graph/gcore/src/raster/adjustments.rs PR Title: New node: Color Overlay BEFORE CODE: use super::curve::{Curve, CurveManipulatorGroup, ValueMapperNode}; use super::{Channel, Color, Image, ImageFrame, Node}; use bezier_rs::{Bezier, TValue}; use dyn_any::{Dyn...
Would it be possible to mutate the existing image to avoid unnecessary allocations - something like: ```rs pub fn color_fill_node(mut image_frame: ImageFrame<Color>, color: Color) -> ImageFrame<Color> { for pixel in &mut image_frame.image.data { *pixel = color; } } ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
inputs: vec![NodeInput::node(0, 0), NodeInput::Network(concrete!(Color))], implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::raster::adjustments::ColorFillNode<_>")), ..Default::default() }, DocumentNode { name: "Blend".to_string(), inputs...
Should this be exposed by default? Most of the other nodes hide the optional parameters by default (by specifying false here).
name: "Fill", category: "Vector", identifier: NodeImplementation::proto("graphene_core::vector::SetFillNode<_, _, _, _, _, _, _>"), inputs: vec![ DocumentInputType::value("Vector Data", TaggedValue::VectorData(graphene_core::vector::VectorData::empty()), true), DocumentInputType::value("Fill Type", ...
@@ -2069,6 +2069,69 @@ fn static_nodes() -> Vec<DocumentNodeType> { properties: node_properties::index_node_properties, ..Default::default() }, + // applies the given color to each pixel of an image + DocumentNodeType { + name: "Color Fill", + category: "Image Adjustments", + identifier: NodeImplemen...
editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/document_node_types.rs
26
Rust
0.429
suggestion
129
51
51
false
New node: Color Overlay
1,391
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
dhruv-ahuja
Review this pull request change. Language: Rust File: editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/document_node_types.rs PR Title: New node: Color Overlay BEFORE CODE: inputs: vec![NodeInput::node(0, 0), NodeInput::Network(concrete!(Color))], implementation: DocumentNode...
Should this be exposed by default? Most of the other nodes hide the optional parameters by default (by specifying false here).
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
.next() .map(|t| bezier.evaluate(TValue::Parametric(t.clamp(0., 1.))).y) // a very bad approximation if bezier_rs failes .unwrap_or_else(|| (x - x0) / (x3 - x0) * (y3 - y0) + y0) }; lut[index] = _Channel::from_f64(y); } pos = sample.anchor; param = sample.handles[1]; } ValueMapperNode...
This doesn't work how you might have expected it to because the `pixel` variable is a reference - a pointer to the location of the colour struct. This code here changes the pixel variable so it points to a different colour struct (whilst the original colour remains the same). What you actually wanted to do was to mo...
let lut_index_left: usize = (left * (lut.len() - 1) as f32).floor() as _; let lut_index_right: usize = (right * (lut.len() - 1) as f32).ceil() as _; for index in lut_index_left..=lut_index_right { let x = index as f64 / (lut.len() - 1) as f64; let y = if x <= x0 { y0 } else if x >= x3 { y3 } e...
@@ -924,6 +924,26 @@ fn generate_curves<_Channel: Channel + super::Linear>(_primary: (), curve: Curve ValueMapperNode::new(lut) } +#[derive(Debug, Clone)] +pub struct ColorFillNode<C> { + color: C, +} + +#[node_macro::node_fn(ColorFillNode)] +pub fn color_fill_node(image_frame: ImageFrame<Color>, color: Color) -> ...
node-graph/gcore/src/raster/adjustments.rs
26
Rust
0.643
suggestion
352
51
51
false
New node: Color Overlay
1,391
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
dhruv-ahuja
Review this pull request change. Language: Rust File: node-graph/gcore/src/raster/adjustments.rs PR Title: New node: Color Overlay BEFORE CODE: .next() .map(|t| bezier.evaluate(TValue::Parametric(t.clamp(0., 1.))).y) // a very bad approximation if bezier_rs failes .unwrap_or_else(|| (x - x0) / (...
This doesn't work how you might have expected it to because the `pixel` variable is a reference - a pointer to the location of the colour struct. This code here changes the pixel variable so it points to a different colour struct (whilst the original colour remains the same). What you actually wanted to do was to mo...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
.next() .map(|t| bezier.evaluate(TValue::Parametric(t.clamp(0., 1.))).y) // a very bad approximation if bezier_rs failes .unwrap_or_else(|| (x - x0) / (x3 - x0) * (y3 - y0) + y0) }; lut[index] = _Channel::from_f64(y); } pos = sample.anchor; param = sample.handles[1]; } ValueMapperNode...
If you want to preserve the opacity, you could change this code to be something like ```rs pixel.set_red(color.red()); pixel.set_green(color.green()); pixel.set_blue(color.blue()); ``` After importing the correct traits.
let lut_index_left: usize = (left * (lut.len() - 1) as f32).floor() as _; let lut_index_right: usize = (right * (lut.len() - 1) as f32).ceil() as _; for index in lut_index_left..=lut_index_right { let x = index as f64 / (lut.len() - 1) as f64; let y = if x <= x0 { y0 } else if x >= x3 { y3 } e...
@@ -924,6 +924,26 @@ fn generate_curves<_Channel: Channel + super::Linear>(_primary: (), curve: Curve ValueMapperNode::new(lut) } +#[derive(Debug, Clone)] +pub struct ColorFillNode<C> { + color: C, +} + +#[node_macro::node_fn(ColorFillNode)] +pub fn color_fill_node(image_frame: ImageFrame<Color>, color: Color) -> ...
node-graph/gcore/src/raster/adjustments.rs
26
Rust
0.857
suggestion
226
51
51
false
New node: Color Overlay
1,391
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
dhruv-ahuja
Review this pull request change. Language: Rust File: node-graph/gcore/src/raster/adjustments.rs PR Title: New node: Color Overlay BEFORE CODE: .next() .map(|t| bezier.evaluate(TValue::Parametric(t.clamp(0., 1.))).y) // a very bad approximation if bezier_rs failes .unwrap_or_else(|| (x - x0) / (...
If you want to preserve the opacity, you could change this code to be something like ```rs pixel.set_red(color.red()); pixel.set_green(color.green()); pixel.set_blue(color.blue()); ``` After importing the correct traits.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} for input in input_node.inputs.iter_mut() { if let NodeInput::Node { .. } = input { *input = NodeInput::Network(generic!(T)) } } node.inputs = vec![NodeInput::value(TaggedValue::DocumentNode(input_node), false)]; } } self.nodes.extend(extraction_nodes); } /// Due to the adap...
Stylistic suggestion: use `.filter(|node| node.name != "Empty Stack")` to make this all a one-liner.
if let DocumentNodeImplementation::Unresolved(ident) = &node.implementation { if ident.name == "graphene_core::ops::IdNode" { assert_eq!(node.inputs.len(), 1, "Id node has more than one input"); if let NodeInput::Node { node_id, output_index, .. } = node.inputs[0] { let input_node_id = node_id; f...
@@ -925,6 +925,48 @@ impl NodeNetwork { self.nodes.extend(extraction_nodes); } + /// Due to the adaptive resolution system, nodes that take a `GraphicGroup` as input must call the upstream node with the `Footprint` parameter. + /// + /// However, in the case of the default input, we must insert a node that takes...
node-graph/graph-craft/src/document.rs
26
Rust
0.571
suggestion
100
51
51
false
Remove explicit empty stack nodes
1,445
GraphiteEditor/Graphite
17,935
Rust
Keavon
0HyperCube
Review this pull request change. Language: Rust File: node-graph/graph-craft/src/document.rs PR Title: Remove explicit empty stack nodes BEFORE CODE: } for input in input_node.inputs.iter_mut() { if let NodeInput::Node { .. } = input { *input = NodeInput::Network(generic!(T)) } } no...
Stylistic suggestion: use `.filter(|node| node.name != "Empty Stack")` to make this all a one-liner.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
/// Due to the adaptive resolution system, nodes that take a `GraphicGroup` as input must call the upstream node with the `Footprint` parameter. /// /// However, in the case of the default input, we must insert a node that takes an input of `Footprint` and returns `GraphicGroup::Empty`, in order to satisfy the type ...
Stylistic suggestion: invert this `if` statement by removing the preceding `!` and put the two lines inside the block in place of the `continue;` to save on a few lines.
if *output_node_id == id { *output_node_id = input_node_id; *output_output_index = output_index; } } } for NodeOutput { ref mut node_id, ref mut node_output_index, } in self.outputs.iter_mut() { if *node_id == id { *node_id = ...
@@ -925,6 +925,48 @@ impl NodeNetwork { self.nodes.extend(extraction_nodes); } + /// Due to the adaptive resolution system, nodes that take a `GraphicGroup` as input must call the upstream node with the `Footprint` parameter. + /// + /// However, in the case of the default input, we must insert a node that takes...
node-graph/graph-craft/src/document.rs
26
Rust
0.5
suggestion
169
51
51
false
Remove explicit empty stack nodes
1,445
GraphiteEditor/Graphite
17,935
Rust
Keavon
0HyperCube
Review this pull request change. Language: Rust File: node-graph/graph-craft/src/document.rs PR Title: Remove explicit empty stack nodes BEFORE CODE: /// Due to the adaptive resolution system, nodes that take a `GraphicGroup` as input must call the upstream node with the `Footprint` parameter. /// /// However, i...
Stylistic suggestion: invert this `if` statement by removing the preceding `!` and put the two lines inside the block in place of the `continue;` to save on a few lines.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
}, MenuBarEntry { label: "Lower".into(), shortcut: action_keys!(DocumentMessageDiscriminant::SelectedLayersLower), action: MenuBarEntry::create_action(|_| DocumentMessage::SelectedLayersLower.into()), disabled: no_active_document, ..MenuBarEntry::default() },...
This was disabled because it crashes (as it wasn't ported to document nodes). And with this PR (at least on my computer) this still does crash. So I'll revert this line for now so it doesn't hold up the rest of the PR which I'm merging now.
}, MenuBarEntry { label: "Lower".into(), shortcut: action_keys!(DocumentMessageDiscriminant::SelectedLayersLower), action: MenuBarEntry::create_action(|_| DocumentMessage::SelectedLayersLower.into()), disabled: no_active_document, ..MenuBarEntry::default() },...
@@ -254,7 +254,7 @@ impl LayoutHolder for MenuBarMessageHandler { no_active_document, MenuBarEntryChildren(vec![vec![MenuBarEntry { label: "Clear Artboards".into(), - action: MenuBarEntry::create_action(|_| DialogMessage::RequestComingSoonDialog { issue: None }.into()), + action: MenuBarEntry::c...
editor/src/messages/portfolio/menu_bar/menu_bar_message_handler.rs
26
Rust
0.5
bug
240
51
51
false
Fixes for removing artboards; white infinite canvas background
1,497
GraphiteEditor/Graphite
17,935
Rust
Keavon
0HyperCube
Review this pull request change. Language: Rust File: editor/src/messages/portfolio/menu_bar/menu_bar_message_handler.rs PR Title: Fixes for removing artboards; white infinite canvas background BEFORE CODE: }, MenuBarEntry { label: "Lower".into(), shortcut: action_keys!(DocumentMessage...
This was disabled because it crashes (as it wasn't ported to document nodes). And with this PR (at least on my computer) this still does crash. So I'll revert this line for now so it doesn't hold up the rest of the PR which I'm merging now.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
let bounds_size = bounds_max - bounds_min; if bounds_size.x < 1e-10 { bounds_max.x = bounds_min.x + 1.; } if bounds_size.y < 1e-10 { bounds_max.y = bounds_min.y + 1.; } [bounds_min, bounds_max] } /// Compute the pivot of the layer in layerspace (the coordinates of the subpaths) pub fn layerspace_...
I'm not sure why we need this function as subpaths is public anyway?
let bounds_size = bounds_max - bounds_min; if bounds_size.x < 1e-10 { bounds_max.x = bounds_min.x + 1.; } if bounds_size.y < 1e-10 { bounds_max.y = bounds_min.y + 1.; } [bounds_min, bounds_max] } /// Compute the pivot of the layer in layerspace (the coordinates of the subpaths) pub fn layerspace_...
@@ -102,6 +102,10 @@ impl VectorData { pub fn local_pivot(&self, normalized_pivot: DVec2) -> DVec2 { self.transform.transform_point2(self.layerspace_pivot(normalized_pivot)) } + + pub fn cloned_subpaths(&self) -> Vec<bezier_rs::Subpath<ManipulatorGroupId>> { + self.subpaths.clone() + }
node-graph/gcore/src/vector/vector_data.rs
26
Rust
0.214
question
68
51
51
false
New node: Copy to Points
1,513
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
Keavon
Review this pull request change. Language: Rust File: node-graph/gcore/src/vector/vector_data.rs PR Title: New node: Copy to Points BEFORE CODE: let bounds_size = bounds_max - bounds_min; if bounds_size.x < 1e-10 { bounds_max.x = bounds_min.x + 1.; } if bounds_size.y < 1e-10 { bounds_max.y = bounds_mi...
I'm not sure why we need this function as subpaths is public anyway?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
PathToolFsmState::Ready } // Delete key (_, PathToolMessage::Delete) => { // Delete the selected points and clean up overlays responses.add(DocumentMessage::AddTransaction); shape_editor.delete_selected_points(document, responses); responses.add(PathToolMessage::SelectionChanged); Pa...
`if nearest_point.is_some() {`
responses.add(PathToolMessage::SelectedPointUpdated); tool_data.snap_manager.cleanup(responses); PathToolFsmState::Ready } // Delete key (_, PathToolMessage::Delete) => { // Delete the selected points and clean up overlays responses.add(DocumentMessage::AddTransaction); shape_editor.d...
@@ -774,11 +783,19 @@ impl Fsm for PathToolFsmState { PathToolFsmState::Ready } (_, PathToolMessage::FlipSmoothSharp) => { - if !tool_data.double_click_handled { - shape_editor.flip_smooth_sharp(&document.network_interface, input.mouse.position, SELECTION_TOLERANCE, responses); - responses.add(P...
editor/src/messages/tool/tool_messages/path_tool.rs
26
Rust
0.214
suggestion
30
51
51
false
Make Path tool deselect all points on single-click, and select all on double-click, of shape's fill
2,148
GraphiteEditor/Graphite
17,935
Rust
Keavon
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/path_tool.rs PR Title: Make Path tool deselect all points on single-click, and select all on double-click, of shape's fill BEFORE CODE: PathToolFsmState::Ready } // Delete key (_, PathToolMessage::Delete) => ...
`if nearest_point.is_some() {`
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
use crate::consts::COLOR_OVERLAY_BLUE; use crate::messages::portfolio::document::overlays::utility_types::{OverlayContext, Pivot}; use crate::messages::tool::tool_messages::tool_prelude::*; use graphene_std::renderer::Rect; /// Draws a dashed line between two points transformed by the given affine transformation. fn ...
I don't see anywhere that this function is called with `None` for any of these three. So I believe you can just remove the `Option` wrapper from these three parameters?
use crate::consts::COLOR_OVERLAY_BLUE; use crate::messages::portfolio::document::overlays::utility_types::{OverlayContext, Pivot}; use crate::messages::tool::tool_messages::tool_prelude::*; use graphene_std::renderer::Rect; /// Draws a dashed line between two points transformed by the given affine transformation. fn ...
@@ -13,21 +13,37 @@ fn draw_dashed_line(line_start: DVec2, line_end: DVec2, transform: DAffine2, ove } /// 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_vi...
editor/src/messages/tool/common_functionality/measure.rs
24
Rust
0.571
question
168
49
49
false
Improve quick measurement overlays with better number alignment and decimal rounding
2,155
GraphiteEditor/Graphite
17,935
Rust
Keavon
singhutsav5502
Review this pull request change. Language: Rust File: editor/src/messages/tool/common_functionality/measure.rs PR Title: Improve quick measurement overlays with better number alignment and decimal rounding BEFORE CODE: use crate::consts::COLOR_OVERLAY_BLUE; use crate::messages::portfolio::document::overlays::utilit...
I don't see anywhere that this function is called with `None` for any of these three. So I believe you can just remove the `Option` wrapper from these three parameters?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
use crate::consts::COLOR_OVERLAY_BLUE; use crate::messages::portfolio::document::overlays::utility_types::{OverlayContext, Pivot}; use crate::messages::tool::tool_messages::tool_prelude::*; use graphene_std::renderer::Rect; /// Draws a dashed line between two points transformed by the given affine transformation. fn ...
Please refactor this into a struct instead of using three parameters.
use crate::consts::COLOR_OVERLAY_BLUE; use crate::messages::portfolio::document::overlays::utility_types::{OverlayContext, Pivot}; use crate::messages::tool::tool_messages::tool_prelude::*; use graphene_std::renderer::Rect; /// Draws a dashed line between two points transformed by the given affine transformation. fn ...
@@ -13,21 +13,41 @@ fn draw_dashed_line(line_start: DVec2, line_end: DVec2, transform: DAffine2, ove } /// 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_vi...
editor/src/messages/tool/common_functionality/measure.rs
24
Rust
0.286
refactor
69
49
49
false
Improve quick measurement overlays with better number alignment and decimal rounding
2,155
GraphiteEditor/Graphite
17,935
Rust
Keavon
singhutsav5502
Review this pull request change. Language: Rust File: editor/src/messages/tool/common_functionality/measure.rs PR Title: Improve quick measurement overlays with better number alignment and decimal rounding BEFORE CODE: use crate::consts::COLOR_OVERLAY_BLUE; use crate::messages::portfolio::document::overlays::utilit...
Please refactor this into a struct instead of using three parameters.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} /// 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, is_vertical_line: bool, text_on_left: boo...
`const TEXT_PADDING: f64 = 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_...
@@ -13,21 +13,41 @@ fn draw_dashed_line(line_start: DVec2, line_end: DVec2, transform: DAffine2, ove } /// 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_vi...
editor/src/messages/tool/common_functionality/measure.rs
26
Rust
0.214
suggestion
31
51
51
false
Improve quick measurement overlays with better number alignment and decimal rounding
2,155
GraphiteEditor/Graphite
17,935
Rust
Keavon
singhutsav5502
Review this pull request change. Language: Rust File: editor/src/messages/tool/common_functionality/measure.rs PR Title: Improve quick measurement overlays with better number alignment and decimal rounding BEFORE CODE: } /// Draws a solid line with a length annotation between two points transformed by the given af...
`const TEXT_PADDING: f64 = 5.;`
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
use graphene_core::renderer::Quad; use graphene_std::renderer::Rect; use graphene_std::vector::misc::BooleanOperation; // use web_sys::console; use std::fmt; #[derive(Default)] pub struct SelectTool { fsm_state: SelectToolFsmState, tool_data: SelectToolData, } #[allow(dead_code)] #[derive(Default)] pub struct Sele...
There's a capitalization error here.
use graphene_core::renderer::Quad; use graphene_core::text::load_face; use graphene_std::renderer::Rect; use graphene_std::vector::misc::BooleanOperation; use std::fmt; #[derive(Default)] pub struct SelectTool { fsm_state: SelectToolFsmState, tool_data: SelectToolData, } #[allow(dead_code)] #[derive(Default)] pub ...
@@ -39,6 +41,12 @@ pub enum SelectOptionsUpdate { NestedSelectionBehavior(NestedSelectionBehavior), } +enum SelectionDirection { + LeftWards,
editor/src/messages/tool/tool_messages/select_tool.rs
26
Rust
0.214
bug
36
51
51
false
Add an editor preference for touched/enclosed/directional based selection
2,156
GraphiteEditor/Graphite
17,935
Rust
Keavon
pratikagr
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/select_tool.rs PR Title: Add an editor preference for touched/enclosed/directional based selection BEFORE CODE: use graphene_core::renderer::Quad; use graphene_std::renderer::Rect; use graphene_std::vector::misc::BooleanOpe...
There's a capitalization error here.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
HintGroup(vec![ HintInfo::arrow_keys("Nudge Selected"), HintInfo::keys([Key::Shift], "10x").prepend_plus(), HintInfo::keys([Key::Alt], "Resize Corner").prepend_plus(), HintInfo::keys([Key::Control], "Other Corner").prepend_plus(), ]), HintGroup(vec![ HintInfo::keys_and_mouse...
This can be moved to the line above the commented out `HintGroup...` line. I also recommend linking to `https://discord.com/channels/731730685944922173/1216976541947531264/1321360311298818048` for context to the future reader of this comment.
HintGroup(vec![ HintInfo::arrow_keys("Nudge Selected"), HintInfo::keys([Key::Shift], "10x").prepend_plus(), HintInfo::keys([Key::Alt], "Resize Corner").prepend_plus(), HintInfo::keys([Key::Control], "Other Corner").prepend_plus(), ]), HintGroup(vec![ HintInfo::keys_and_mouse...
@@ -1143,9 +1157,12 @@ impl Fsm for SelectToolFsmState { responses.add(FrontendMessage::UpdateInputHints { hint_data }); } SelectToolFsmState::DrawingBox { .. } => { - // TODO: Add hint and implement functionality for holding Shift to extend the selection, thus preventing the prior selection from being ...
editor/src/messages/tool/tool_messages/select_tool.rs
26
Rust
0.643
suggestion
242
51
51
false
Add selection removal to the Select tool's box select (Ctrl+Shift modifier)
2,162
GraphiteEditor/Graphite
17,935
Rust
Keavon
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/select_tool.rs PR Title: Add selection removal to the Select tool's box select (Ctrl+Shift modifier) BEFORE CODE: HintGroup(vec![ HintInfo::arrow_keys("Nudge Selected"), HintInfo::keys([Key::Shift], "10x")....
This can be moved to the line above the commented out `HintGroup...` line. I also recommend linking to `https://discord.com/channels/731730685944922173/1216976541947531264/1321360311298818048` for context to the future reader of this comment.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
entry!(KeyDown(KeyC); modifiers=[Shift], action_dispatch=NodeGraphMessage::PrintSelectedNodeCoordinates), entry!(KeyDown(KeyC); modifiers=[Alt], action_dispatch=NodeGraphMessage::SendClickTargets), entry!(KeyDown(KeyM); modifiers=[Accel], action_dispatch=NodeGraphMessage::MergeSelectedNodes), entry!(KeyUp(KeyC)...
We don't get autoformatting in these macros so please be careful to be consistent about your formatting in this code.
entry!(KeyDown(KeyC); modifiers=[Shift], action_dispatch=NodeGraphMessage::PrintSelectedNodeCoordinates), entry!(KeyDown(KeyC); modifiers=[Alt], action_dispatch=NodeGraphMessage::SendClickTargets), entry!(KeyDown(KeyM); modifiers=[Accel], action_dispatch=NodeGraphMessage::MergeSelectedNodes), entry!(KeyUp(KeyC)...
@@ -98,7 +98,7 @@ pub fn input_mappings() -> Mapping { // SelectToolMessage entry!(PointerMove; refresh_keys=[Control, Alt, Shift], action_dispatch=SelectToolMessage::PointerMove(SelectToolPointerKeys { axis_align: Shift, snap_angle: Control, center: Alt, duplicate: Alt })), entry!(KeyDown(MouseLeft); action_d...
editor/src/messages/input_mapper/input_mappings.rs
26
Rust
0.357
style
117
51
51
false
Add selection removal to the Select tool's box select (Ctrl+Shift modifier)
2,162
GraphiteEditor/Graphite
17,935
Rust
Keavon
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/input_mapper/input_mappings.rs PR Title: Add selection removal to the Select tool's box select (Ctrl+Shift modifier) BEFORE CODE: entry!(KeyDown(KeyC); modifiers=[Shift], action_dispatch=NodeGraphMessage::PrintSelectedNodeCoordinates), en...
We don't get autoformatting in these macros so please be careful to be consistent about your formatting in this code.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
let selection = tool_data.nested_selection_behavior; SelectToolFsmState::Ready { selection } } ( SelectToolFsmState::DrawingBox { .. }, SelectToolMessage::DragStop { remove_from_selection, negative_box_selection, }, ) => { let quad = tool_data.selection_quad(); let new_sel...
```suggestion // Find the parent node ```
let selection = tool_data.nested_selection_behavior; SelectToolFsmState::Ready { selection } } ( SelectToolFsmState::DrawingBox { .. }, SelectToolMessage::DragStop { remove_from_selection, negative_box_selection, }, ) => { let quad = tool_data.selection_quad(); let new_sel...
@@ -1001,20 +1001,34 @@ impl Fsm for SelectToolFsmState { let selection = tool_data.nested_selection_behavior; SelectToolFsmState::Ready { selection } } - (SelectToolFsmState::DrawingBox { .. }, SelectToolMessage::DragStop { .. } | SelectToolMessage::Enter) => { + ( + SelectToolFsmState::DrawingBox...
editor/src/messages/tool/tool_messages/select_tool.rs
26
Rust
0.571
suggestion
51
51
51
false
Add selection removal to the Select tool's box select (Ctrl+Shift modifier)
2,162
GraphiteEditor/Graphite
17,935
Rust
Keavon
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/select_tool.rs PR Title: Add selection removal to the Select tool's box select (Ctrl+Shift modifier) BEFORE CODE: let selection = tool_data.nested_selection_behavior; SelectToolFsmState::Ready { selection } } ...
```suggestion // Find the parent node ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
HintInfo::keys([Key::Alt], "Resize Corner").prepend_plus(), HintInfo::keys([Key::Control], "Other Corner").prepend_plus(), ]), HintGroup(vec![ HintInfo::keys_and_mouse([Key::Alt], MouseMotion::LmbDrag, "Move Duplicate"), HintInfo::keys([Key::Control, Key::KeyD], "Duplicate").add_mac_ke...
```suggestion // TODO: Re-select deselected layers during drag when Shift is pressed, and re-deselect if Shift is released before drag ends. // TODO: (See https://discord.com/channels/731730685944922173/1216976541947531264/1321360311298818048) ```
HintInfo::keys([Key::Alt], "Resize Corner").prepend_plus(), HintInfo::keys([Key::Control], "Other Corner").prepend_plus(), ]), HintGroup(vec![ HintInfo::keys_and_mouse([Key::Alt], MouseMotion::LmbDrag, "Move Duplicate"), HintInfo::keys([Key::Control, Key::KeyD], "Duplicate").add_mac_ke...
@@ -1143,9 +1157,12 @@ impl Fsm for SelectToolFsmState { responses.add(FrontendMessage::UpdateInputHints { hint_data }); } SelectToolFsmState::DrawingBox { .. } => { - // TODO: Add hint and implement functionality for holding Shift to extend the selection, thus preventing the prior selection from being ...
editor/src/messages/tool/tool_messages/select_tool.rs
26
Rust
0.786
suggestion
260
51
51
false
Add selection removal to the Select tool's box select (Ctrl+Shift modifier)
2,162
GraphiteEditor/Graphite
17,935
Rust
Keavon
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/select_tool.rs PR Title: Add selection removal to the Select tool's box select (Ctrl+Shift modifier) BEFORE CODE: HintInfo::keys([Key::Alt], "Resize Corner").prepend_plus(), HintInfo::keys([Key::Control], "Other...
```suggestion // TODO: Re-select deselected layers during drag when Shift is pressed, and re-deselect if Shift is released before drag ends. // TODO: (See https://discord.com/channels/731730685944922173/1216976541947531264/1321360311298818048) ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
entry!(KeyDown(KeyC); modifiers=[Shift], action_dispatch=NodeGraphMessage::PrintSelectedNodeCoordinates), entry!(KeyDown(KeyC); modifiers=[Alt], action_dispatch=NodeGraphMessage::SendClickTargets), entry!(KeyDown(KeyM); modifiers=[Accel], action_dispatch=NodeGraphMessage::MergeSelectedNodes), entry!(KeyUp(KeyC)...
```suggestion entry!(KeyUp(MouseLeft); action_dispatch=SelectToolMessage::DragStop { remove_from_selection: Shift, negative_box_selection: Control }), ```
entry!(KeyDown(KeyC); modifiers=[Shift], action_dispatch=NodeGraphMessage::PrintSelectedNodeCoordinates), entry!(KeyDown(KeyC); modifiers=[Alt], action_dispatch=NodeGraphMessage::SendClickTargets), entry!(KeyDown(KeyM); modifiers=[Accel], action_dispatch=NodeGraphMessage::MergeSelectedNodes), entry!(KeyUp(KeyC)...
@@ -98,7 +98,7 @@ pub fn input_mappings() -> Mapping { // SelectToolMessage entry!(PointerMove; refresh_keys=[Control, Alt, Shift], action_dispatch=SelectToolMessage::PointerMove(SelectToolPointerKeys { axis_align: Shift, snap_angle: Control, center: Alt, duplicate: Alt })), entry!(KeyDown(MouseLeft); action_d...
editor/src/messages/input_mapper/input_mappings.rs
26
Rust
0.786
suggestion
158
51
51
false
Add selection removal to the Select tool's box select (Ctrl+Shift modifier)
2,162
GraphiteEditor/Graphite
17,935
Rust
Keavon
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/input_mapper/input_mappings.rs PR Title: Add selection removal to the Select tool's box select (Ctrl+Shift modifier) BEFORE CODE: entry!(KeyDown(KeyC); modifiers=[Shift], action_dispatch=NodeGraphMessage::PrintSelectedNodeCoordinates), en...
```suggestion entry!(KeyUp(MouseLeft); action_dispatch=SelectToolMessage::DragStop { remove_from_selection: Shift, negative_box_selection: Control }), ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
#![allow(clippy::too_many_arguments)] use super::tool_prelude::*; use crate::consts::DRAG_THRESHOLD; use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn; use crate::messages::portfolio::document::overlays::utility_types::OverlayContext; use crate::messages::portfolio::document::utilit...
All the pivot and multi-layer transformation related code is commented out here. Besides that, the hints are yet to be added.
#![allow(clippy::too_many_arguments)] use super::tool_prelude::*; use crate::consts::{COLOR_OVERLAY_RED, DRAG_THRESHOLD}; use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn; use crate::messages::portfolio::document::overlays::utility_types::OverlayContext; use crate::messages::portfo...
editor/src/messages/tool/tool_messages/text_tool.rs
1
Rust
0.357
style
125
26
26
false
Add sizing gizmos to the Text tool's text area
2,176
GraphiteEditor/Graphite
17,935
Rust
Nitish-bot
Nitish-bot
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/text_tool.rs PR Title: Add sizing gizmos to the Text tool's text area BEFORE CODE: #![allow(clippy::too_many_arguments)] use super::tool_prelude::*; use crate::consts::DRAG_THRESHOLD; use crate::messages::portfolio::docume...
All the pivot and multi-layer transformation related code is commented out here. Besides that, the hints are yet to be added.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
self.opposing_handle_lengths = Some(shape_editor.opposing_handle_lengths(document)); return false; }; let Some((layer, _)) = shape_editor.selected_shape_state.iter().next() else { self.opposing_handle_lengths = Some(shape_editor.opposing_handle_lengths(document)); return false; }; ...
```suggestion if opposite_handle_length.map_or(false, |l| l == 0.) { ```
self.opposing_handle_lengths = Some(shape_editor.opposing_handle_lengths(document)); return false; }; let Some((layer, _)) = shape_editor.selected_shape_state.iter().next() else { self.opposing_handle_lengths = Some(shape_editor.opposing_handle_lengths(document)); return false; }; ...
@@ -469,13 +475,47 @@ impl PathToolData { self.toggle_colinear_debounce = toggle_colinear; if equidistant && self.opposing_handle_lengths.is_none() { + if !is_colinear { + // Try to get selected handle info + let Some((_, _, selected_handle_id)) = self.try_get_selected_handle_and_anchor(shape_editor, do...
editor/src/messages/tool/tool_messages/path_tool.rs
26
Rust
0.714
suggestion
79
51
51
false
In Path tool when dragging a handle, make Alt recover the opposing handle if it's not cubic rather than zero-length
2,196
GraphiteEditor/Graphite
17,935
Rust
Keavon
bakayu
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/path_tool.rs PR Title: In Path tool when dragging a handle, make Alt recover the opposing handle if it's not cubic rather than zero-length BEFORE CODE: self.opposing_handle_lengths = Some(shape_editor.opposing_handle_l...
```suggestion if opposite_handle_length.map_or(false, |l| l == 0.) { ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
.map_err(|error| log::warn!("Error drawing dashed line: {:?}", error)) .ok(); } let start = start.round() - DVec2::splat(0.5); let end = end.round() - DVec2::splat(0.5); self.render_context.begin_path(); self.render_context.move_to(start.x, start.y); self.render_context.line_to(end.x, end.y); se...
```suggestion pub fn manipulator_handle(&mut self, position: DVec2, selected: bool, color: Option<&str>) { ```
.map_err(|error| log::warn!("Error drawing dashed line: {:?}", error)) .ok(); } let start = start.round() - DVec2::splat(0.5); let end = end.round() - DVec2::splat(0.5); self.render_context.begin_path(); self.render_context.move_to(start.x, start.y); self.render_context.line_to(end.x, end.y); se...
@@ -127,7 +127,7 @@ impl OverlayContext { } } - pub fn manipulator_handle(&mut self, position: DVec2, selected: bool) { + pub fn manipulator_handle(&mut self, position: DVec2, selected: bool, optional_stroke_style: Option<&str>) {
editor/src/messages/portfolio/document/overlays/utility_types.rs
26
Rust
0.857
suggestion
113
51
51
false
Add handle visualization during point insertion in the Path tool
2,197
GraphiteEditor/Graphite
17,935
Rust
Keavon
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/portfolio/document/overlays/utility_types.rs PR Title: Add handle visualization during point insertion in the Path tool BEFORE CODE: .map_err(|error| log::warn!("Error drawing dashed line: {:?}", error)) .ok(); } let start = star...
```suggestion pub fn manipulator_handle(&mut self, position: DVec2, selected: bool, color: Option<&str>) { ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
self.render_context.set_stroke_style_str(color.unwrap_or(COLOR_OVERLAY_BLUE)); self.render_context.stroke(); // Reset the dash pattern back to solid if dash_width.is_some() { self.render_context .set_line_dash(&JsValue::from(js_sys::Array::new())) .map_err(|error| log::warn!("Error drawing dashed li...
```suggestion self.render_context.set_stroke_style_str(color.unwrap_or(COLOR_OVERLAY_BLUE)); ```
self.render_context.set_stroke_style_str(color.unwrap_or(COLOR_OVERLAY_BLUE)); self.render_context.stroke(); // Reset the dash pattern back to solid if dash_width.is_some() { self.render_context .set_line_dash(&JsValue::from(js_sys::Array::new())) .map_err(|error| log::warn!("Error drawing dashed li...
@@ -137,7 +137,7 @@ impl OverlayContext { let fill = if selected { COLOR_OVERLAY_BLUE } else { COLOR_OVERLAY_WHITE }; self.render_context.set_fill_style_str(fill); - self.render_context.set_stroke_style_str(COLOR_OVERLAY_BLUE); + self.render_context.set_stroke_style_str(optional_stroke_style.unwrap_or(COLOR_O...
editor/src/messages/portfolio/document/overlays/utility_types.rs
26
Rust
0.714
suggestion
100
51
51
false
Add handle visualization during point insertion in the Path tool
2,197
GraphiteEditor/Graphite
17,935
Rust
Keavon
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/portfolio/document/overlays/utility_types.rs PR Title: Add handle visualization during point insertion in the Path tool BEFORE CODE: self.render_context.set_stroke_style_str(color.unwrap_or(COLOR_OVERLAY_BLUE)); self.render_context.stroke...
```suggestion self.render_context.set_stroke_style_str(color.unwrap_or(COLOR_OVERLAY_BLUE)); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
match self { Self::DrawingBox => { let fill_color = graphene_std::Color::from_rgb_str(crate::consts::COLOR_OVERLAY_BLUE.strip_prefix('#').unwrap()) .unwrap() .with_alpha(0.05) .rgba_hex(); overlay_context.quad(Quad::from_box([tool_data.drag_start_pos, tool_data.previous_mouse_...
This should probably be split up in case one handle exists but not the other, so they aren't dependent on each other both existing to draw either one of them.
self } (_, PathToolMessage::Overlays(mut overlay_context)) => { path_overlays(document, shape_editor, &mut overlay_context); match self { Self::DrawingBox => { let fill_color = graphene_std::Color::from_rgb_str(crate::consts::COLOR_OVERLAY_BLUE.strip_prefix('#').unwrap()) .unwrap() ...
@@ -620,6 +620,12 @@ impl Fsm for PathToolFsmState { if let Some(closest_segment) = &tool_data.segment { overlay_context.manipulator_anchor(closest_segment.closest_point_to_viewport(), false, Some(COLOR_OVERLAY_YELLOW)); + if let (Some(handle1), Some(handle2)) = closest_segment.handle_positions(d...
editor/src/messages/tool/tool_messages/path_tool.rs
26
Rust
0.571
suggestion
158
51
51
false
Add handle visualization during point insertion in the Path tool
2,197
GraphiteEditor/Graphite
17,935
Rust
Keavon
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/path_tool.rs PR Title: Add handle visualization during point insertion in the Path tool BEFORE CODE: match self { Self::DrawingBox => { let fill_color = graphene_std::Color::from_rgb_str(crate::consts::COLOR_...
This should probably be split up in case one handle exists but not the other, so they aren't dependent on each other both existing to draw either one of them.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
struct SplineToolData { /// list of points inserted. points: Vec<(PointId, DVec2)>, /// Point to be inserted. next_point: DVec2, /// Point that was inserted temporarily to show preview. preview_point: Option<PointId>, /// Segment that was inserted temporarily to show preview. preview_segment: Option<SegmentId>,...
Please fix the grammar here so it's a full sentence, also with a capital first letter and period at the end.
/// List of points inserted. points: Vec<(PointId, DVec2)>, /// Point to be inserted. next_point: DVec2, /// Point that was inserted temporarily to show preview. preview_point: Option<PointId>, /// Segment that was inserted temporarily to show preview. preview_segment: Option<SegmentId>, extend: bool, weight:...
@@ -178,40 +185,104 @@ impl ToolTransition for SplineTool { #[derive(Clone, Debug, Default)] struct SplineToolData { - /// Points that are inserted. + /// list of points inserted. points: Vec<(PointId, DVec2)>, /// Point to be inserted. next_point: DVec2, /// Point that was inserted temporarily to show prev...
editor/src/messages/tool/tool_messages/spline_tool.rs
26
Rust
0.357
nitpick
108
51
51
false
Implement extending, joining, and creating new subpaths with the Spline tool
2,203
GraphiteEditor/Graphite
17,935
Rust
Keavon
indierusty
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/spline_tool.rs PR Title: Implement extending, joining, and creating new subpaths with the Spline tool BEFORE CODE: struct SplineToolData { /// list of points inserted. points: Vec<(PointId, DVec2)>, /// Point to be inser...
Please fix the grammar here so it's a full sentence, also with a capital first letter and period at the end.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
let hint_data = match self { SplineToolFsmState::Ready => HintData(vec![HintGroup(vec![ HintInfo::mouse(MouseMotion::Lmb, "Draw Spline"), HintInfo::keys([Key::Shift], "Append to Selected Layer").prepend_plus(), ])]), SplineToolFsmState::Drawing => HintData(vec![ HintGroup(vec![HintInfo::mouse(Mou...
Capitalize and put a blank line above this to form a new block
SplineToolFsmState::Drawing => HintData(vec![ HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, ""), HintInfo::keys([Key::Escape], "Cancel").prepend_slash()]), HintGroup(vec![HintInfo::mouse(MouseMotion::Lmb, "Extend Spline")]), HintGroup(vec![HintInfo::keys([Key::Enter], "End Spline")]), ]), }; r...
@@ -320,7 +406,35 @@ impl Fsm for SplineToolFsmState { } } -fn update_spline(tool_data: &mut SplineToolData, show_preview: bool, responses: &mut VecDeque<Message>) { +/// Return `true` only if new segment is inserted to connect two end points in the selected layer otherwise `false`. +fn join_path(document: &Docume...
editor/src/messages/tool/tool_messages/spline_tool.rs
26
Rust
0.214
style
62
51
51
false
Implement extending, joining, and creating new subpaths with the Spline tool
2,203
GraphiteEditor/Graphite
17,935
Rust
Keavon
indierusty
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/spline_tool.rs PR Title: Implement extending, joining, and creating new subpaths with the Spline tool BEFORE CODE: let hint_data = match self { SplineToolFsmState::Ready => HintData(vec![HintGroup(vec![ HintInfo::m...
Capitalize and put a blank line above this to form a new block
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
])]), SplineToolFsmState::Drawing => HintData(vec![ HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, ""), HintInfo::keys([Key::Escape], "Cancel").prepend_slash()]), HintGroup(vec![HintInfo::mouse(MouseMotion::Lmb, "Extend Spline")]), HintGroup(vec![HintInfo::keys([Key::Enter], "End Spline")]), ]), ...
Capitalize and put a blank line above this to form a new block
]), }; responses.add(FrontendMessage::UpdateInputHints { hint_data }); } fn update_cursor(&self, responses: &mut VecDeque<Message>) { responses.add(FrontendMessage::UpdateMouseCursor { cursor: MouseCursorIcon::Default }); } } /// Return `true` only if new segment is inserted to connect two end points in ...
@@ -320,7 +406,35 @@ impl Fsm for SplineToolFsmState { } } -fn update_spline(tool_data: &mut SplineToolData, show_preview: bool, responses: &mut VecDeque<Message>) { +/// Return `true` only if new segment is inserted to connect two end points in the selected layer otherwise `false`. +fn join_path(document: &Docume...
editor/src/messages/tool/tool_messages/spline_tool.rs
26
Rust
0.214
style
62
51
51
false
Implement extending, joining, and creating new subpaths with the Spline tool
2,203
GraphiteEditor/Graphite
17,935
Rust
Keavon
indierusty
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/spline_tool.rs PR Title: Implement extending, joining, and creating new subpaths with the Spline tool BEFORE CODE: ])]), SplineToolFsmState::Drawing => HintData(vec![ HintGroup(vec![HintInfo::mouse(MouseMotion::Rm...
Capitalize and put a blank line above this to form a new block
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
HintGroup(vec![HintInfo::mouse(MouseMotion::Lmb, "Extend Spline")]), HintGroup(vec![HintInfo::keys([Key::Enter], "End Spline")]), ]), }; responses.add(FrontendMessage::UpdateInputHints { hint_data }); } fn update_cursor(&self, responses: &mut VecDeque<Message>) { responses.add(FrontendMessage::Upda...
Please put the `closest_point(...)` function call on its own line, with its return value set to a variable, for improved formatting.
responses.add(FrontendMessage::UpdateInputHints { hint_data }); } fn update_cursor(&self, responses: &mut VecDeque<Message>) { responses.add(FrontendMessage::UpdateMouseCursor { cursor: MouseCursorIcon::Default }); } } /// Return `true` only if new segment is inserted to connect two end points in the selected ...
@@ -320,7 +406,35 @@ impl Fsm for SplineToolFsmState { } } -fn update_spline(tool_data: &mut SplineToolData, show_preview: bool, responses: &mut VecDeque<Message>) { +/// Return `true` only if new segment is inserted to connect two end points in the selected layer otherwise `false`. +fn join_path(document: &Docume...
editor/src/messages/tool/tool_messages/spline_tool.rs
26
Rust
0.5
style
132
51
51
false
Implement extending, joining, and creating new subpaths with the Spline tool
2,203
GraphiteEditor/Graphite
17,935
Rust
Keavon
indierusty
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/spline_tool.rs PR Title: Implement extending, joining, and creating new subpaths with the Spline tool BEFORE CODE: HintGroup(vec![HintInfo::mouse(MouseMotion::Lmb, "Extend Spline")]), HintGroup(vec![HintInfo::keys([...
Please put the `closest_point(...)` function call on its own line, with its return value set to a variable, for improved formatting.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
responses.add(FrontendMessage::UpdateInputHints { hint_data }); } fn update_cursor(&self, responses: &mut VecDeque<Message>) { responses.add(FrontendMessage::UpdateMouseCursor { cursor: MouseCursorIcon::Default }); } } /// Return `true` only if new segment is inserted to connect two end points in the selected ...
Please improve the grammatical correctness of this sentence to improve its readability.
} } /// Return `true` only if new segment is inserted to connect two end points in the selected layer otherwise `false`. fn join_path(document: &DocumentMessageHandler, mouse_pos: DVec2, tool_data: &mut SplineToolData, responses: &mut VecDeque<Message>) -> bool { let Some(&(endpoint, _)) = tool_data.points.last() el...
@@ -320,7 +406,35 @@ impl Fsm for SplineToolFsmState { } } -fn update_spline(tool_data: &mut SplineToolData, show_preview: bool, responses: &mut VecDeque<Message>) { +/// Return `true` only if new segment is inserted to connect two end points in the selected layer otherwise `false`. +fn join_path(document: &Docume...
editor/src/messages/tool/tool_messages/spline_tool.rs
26
Rust
0.214
suggestion
87
51
51
false
Implement extending, joining, and creating new subpaths with the Spline tool
2,203
GraphiteEditor/Graphite
17,935
Rust
Keavon
indierusty
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/spline_tool.rs PR Title: Implement extending, joining, and creating new subpaths with the Spline tool BEFORE CODE: responses.add(FrontendMessage::UpdateInputHints { hint_data }); } fn update_cursor(&self, responses: &m...
Please improve the grammatical correctness of this sentence to improve its readability.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
ColinearLocked, // Alt pressed: Handle length is locked ColinearEquidistant, // Alt pressed: Handle is equidistant } #[derive(Clone, Debug, Default)] struct PenToolData { snap_manager: SnapManager, latest_points: Vec<LastPoint>, point_index: usize, handle_end: Option<DVec2>, next_point: DVec2, next_handle_star...
If GRS has not been used, this is set to zero, which is rather misleading. I would suggest grouping the GRS keys into a struct and storing an `Option<GRSState>`. Also it isn't really clear what `before_grs_pos` refers to. Is it the anchor that has not yet been placed? Also maybe tmp_handle_pos could be renamed to `h...
/// Pressing 'Alt': Handle length is locked #[default] ColinearLocked, /// Pressing 'Alt': Handles are equidistant ColinearEquidistant, } #[derive(Clone, Debug, Default)] struct PenToolData { snap_manager: SnapManager, latest_points: Vec<LastPoint>, point_index: usize, handle_end: Option<DVec2>, next_point: ...
@@ -222,14 +231,21 @@ struct PenToolData { next_handle_start: DVec2, g1_continuous: bool, + toggle_colinear_debounce: bool, + + segment_end_before_bent: Option<SegmentId>, angle: f64, auto_panning: AutoPanning, modifiers: ModifierState, buffering_merged_vector: bool, - before_grs_pos: DVec2, + befor...
editor/src/messages/tool/tool_messages/pen_tool.rs
26
Rust
0.786
suggestion
340
51
51
false
Improve the Pen tool's colinearity and equidistance controls
2,242
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/pen_tool.rs PR Title: Improve the Pen tool's colinearity and equidistance controls BEFORE CODE: ColinearLocked, // Alt pressed: Handle length is locked ColinearEquidistant, // Alt pressed: Handle is equidistant } #[deriv...
If GRS has not been used, this is set to zero, which is rather misleading. I would suggest grouping the GRS keys into a struct and storing an `Option<GRSState>`. Also it isn't really clear what `before_grs_pos` refers to. Is it the anchor that has not yet been placed? Also maybe tmp_handle_pos could be renamed to `h...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
continue; }; point.pos = pos; point.handle_start = point.pos; } } } /// If the user places the anchor on top of the previous anchor, it becomes sharp and the outgoing handle may be dragged. fn bend_from_previous_point(&mut self, snap_data: SnapData, transform: DAffine2, layer: LayerNodeIdentif...
You can just do `vector_data.segment_domain.ids().last()`.
}; for point in &mut self.latest_points { let Some(pos) = vector_data.point_domain.position_from_id(point.id) else { continue; }; point.pos = pos; point.handle_start = point.pos; } } } /// If the user places the anchor on top of the previous anchor, it becomes sharp and the outgoing h...
@@ -265,19 +281,24 @@ impl PenToolData { } /// If the user places the anchor on top of the previous anchor, it becomes sharp and the outgoing handle may be dragged. - fn bend_from_previous_point(&mut self, snap_data: SnapData, transform: DAffine2) { + fn bend_from_previous_point(&mut self, snap_data: SnapData, tr...
editor/src/messages/tool/tool_messages/pen_tool.rs
26
Rust
0.357
suggestion
58
51
51
false
Improve the Pen tool's colinearity and equidistance controls
2,242
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/pen_tool.rs PR Title: Improve the Pen tool's colinearity and equidistance controls BEFORE CODE: continue; }; point.pos = pos; point.handle_start = point.pos; } } } /// If the user places the anchor ...
You can just do `vector_data.segment_domain.ids().last()`.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
working_color_changed: Some(PenToolMessage::WorkingColorChanged.into()), overlay_provider: Some(|overlay_context| PenToolMessage::Overlays(overlay_context).into()), ..Default::default() } } } #[derive(Clone, Debug, Default)] struct ModifierState { snap_angle: bool, lock_angle: bool, break_handle: bool, ...
It isn't really clear why this should be the default value? Also it is a bit confusing to say that the length is locked seeing as you can change the length of the handle by dragging. I presume you mean that the opposite handle's length is locked?
working_color_changed: Some(PenToolMessage::WorkingColorChanged.into()), overlay_provider: Some(|overlay_context| PenToolMessage::Overlays(overlay_context).into()), ..Default::default() } } } #[derive(Clone, Debug, Default)] struct ModifierState { snap_angle: bool, lock_angle: bool, break_handle: bool, ...
@@ -212,6 +213,14 @@ struct LastPoint { handle_start: DVec2, } +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] +enum HandleMode { + Free, + #[default] // Pressing 'C' breaks colinearity + ColinearLocked, // Alt pressed: Handle length is locked
editor/src/messages/tool/tool_messages/pen_tool.rs
26
Rust
0.643
question
246
51
51
false
Improve the Pen tool's colinearity and equidistance controls
2,242
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/pen_tool.rs PR Title: Improve the Pen tool's colinearity and equidistance controls BEFORE CODE: working_color_changed: Some(PenToolMessage::WorkingColorChanged.into()), overlay_provider: Some(|overlay_context| PenTool...
It isn't really clear why this should be the default value? Also it is a bit confusing to say that the length is locked seeing as you can change the length of the handle by dragging. I presume you mean that the opposite handle's length is locked?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
overlay_provider: Some(|overlay_context| PenToolMessage::Overlays(overlay_context).into()), ..Default::default() } } } #[derive(Clone, Debug, Default)] struct ModifierState { snap_angle: bool, lock_angle: bool, break_handle: bool, colinear: bool, } #[derive(Clone, Debug)] struct LastPoint { id: PointId, ...
Both of these say `Alt pressed:`. Is this correct?
overlay_provider: Some(|overlay_context| PenToolMessage::Overlays(overlay_context).into()), ..Default::default() } } } #[derive(Clone, Debug, Default)] struct ModifierState { snap_angle: bool, lock_angle: bool, break_handle: bool, colinear: bool, } #[derive(Clone, Debug)] struct LastPoint { id: PointId, ...
@@ -212,6 +213,14 @@ struct LastPoint { handle_start: DVec2, } +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] +enum HandleMode { + Free, + #[default] // Pressing 'C' breaks colinearity + ColinearLocked, // Alt pressed: Handle length is locked + ColinearEquidistant, // Alt pressed: Handle is equidistant
editor/src/messages/tool/tool_messages/pen_tool.rs
26
Rust
0.357
question
50
51
51
false
Improve the Pen tool's colinearity and equidistance controls
2,242
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/pen_tool.rs PR Title: Improve the Pen tool's colinearity and equidistance controls BEFORE CODE: overlay_provider: Some(|overlay_context| PenToolMessage::Overlays(overlay_context).into()), ..Default::default() } } }...
Both of these say `Alt pressed:`. Is this correct?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
let document = snap_data.document; self.next_handle_start = self.compute_snapped_angle(snap_data, transform, colinear, mouse, Some(self.next_point), false); let Some(layer) = layer else { return Some(PenToolFsmState::DraggingHandle(self.handle_mode)) }; let vector_data = document.network_interface.compute_modif...
I'm a bit confused about what handle is being adjusted and why? Could you perhaps detail this in the function name / a doc comment.
fn drag_handle(&mut self, snap_data: SnapData, transform: DAffine2, mouse: DVec2, responses: &mut VecDeque<Message>, layer: Option<LayerNodeIdentifier>) -> Option<PenToolFsmState> { let colinear = (self.handle_mode == HandleMode::ColinearEquidistant && self.modifiers.break_handle) || (self.handle_mode == HandleMode...
@@ -351,19 +373,106 @@ impl PenToolData { Some(if close_subpath { PenToolFsmState::Ready } else { PenToolFsmState::PlacingAnchor }) } - fn drag_handle(&mut self, snap_data: SnapData, transform: DAffine2, mouse: DVec2, responses: &mut VecDeque<Message>) -> Option<PenToolFsmState> { - let colinear = !self.modifie...
editor/src/messages/tool/tool_messages/pen_tool.rs
26
Rust
0.571
suggestion
131
51
51
false
Improve the Pen tool's colinearity and equidistance controls
2,242
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/pen_tool.rs PR Title: Improve the Pen tool's colinearity and equidistance controls BEFORE CODE: let document = snap_data.document; self.next_handle_start = self.compute_snapped_angle(snap_data, transform, colinear, mous...
I'm a bit confused about what handle is being adjusted and why? Could you perhaps detail this in the function name / a doc comment.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
let Some(latest) = self.latest_point() else { return }; let anchor_pos = latest.pos; match self.handle_mode { HandleMode::ColinearEquidistant => self.adjust_equidistant_handle(anchor_pos, responses, layer, vector_data), HandleMode::ColinearLocked => self.adjust_locked_length_handle(anchor_pos, responses, l...
You can do `anchor_point + (handle_end - anchor_point).project_onto_normalized(direction)` to avoid taking the square root in the length function.
} /// Makes the opposite handle equidistant or locks its length. fn adjust_handle_length(&mut self, responses: &mut VecDeque<Message>, layer: LayerNodeIdentifier, vector_data: &VectorData) { let Some(latest) = self.latest_point() else { return }; let anchor_pos = latest.pos; match self.handle_mode { Handl...
@@ -351,19 +373,106 @@ impl PenToolData { Some(if close_subpath { PenToolFsmState::Ready } else { PenToolFsmState::PlacingAnchor }) } - fn drag_handle(&mut self, snap_data: SnapData, transform: DAffine2, mouse: DVec2, responses: &mut VecDeque<Message>) -> Option<PenToolFsmState> { - let colinear = !self.modifie...
editor/src/messages/tool/tool_messages/pen_tool.rs
26
Rust
0.714
suggestion
146
51
51
false
Improve the Pen tool's colinearity and equidistance controls
2,242
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/pen_tool.rs PR Title: Improve the Pen tool's colinearity and equidistance controls BEFORE CODE: let Some(latest) = self.latest_point() else { return }; let anchor_pos = latest.pos; match self.handle_mode { HandleM...
You can do `anchor_point + (handle_end - anchor_point).project_onto_normalized(direction)` to avoid taking the square root in the length function.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
let new_handle_position = anchor_point + handle_offset * direction; self.update_handle_position(new_handle_position, anchor_point, responses, layer); } fn adjust_equidistant_handle(&mut self, anchor_pos: DVec2, responses: &mut VecDeque<Message>, layer: LayerNodeIdentifier, vector_data: &VectorData) { if self.m...
I assume that DVec2::ZERO represents an unset handle position? What if the handle actually exists at the origin? Perhaps it would be clearer to use an `Option<DVec2>`.
let Some(end_handle) = end_handle.get_position(vector_data) else { return }; (end_handle - anchor_point).length() }; let new_handle_position = anchor_point + handle_offset * direction; self.update_handle_position(new_handle_position, anchor_point, responses, layer); } fn adjust_equidistant_handle(&mut se...
@@ -351,19 +373,106 @@ impl PenToolData { Some(if close_subpath { PenToolFsmState::Ready } else { PenToolFsmState::PlacingAnchor }) } - fn drag_handle(&mut self, snap_data: SnapData, transform: DAffine2, mouse: DVec2, responses: &mut VecDeque<Message>) -> Option<PenToolFsmState> { - let colinear = !self.modifie...
editor/src/messages/tool/tool_messages/pen_tool.rs
26
Rust
0.714
suggestion
167
51
51
false
Improve the Pen tool's colinearity and equidistance controls
2,242
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/pen_tool.rs PR Title: Improve the Pen tool's colinearity and equidistance controls BEFORE CODE: let new_handle_position = anchor_point + handle_offset * direction; self.update_handle_position(new_handle_position, anchor...
I assume that DVec2::ZERO represents an unset handle position? What if the handle actually exists at the origin? Perhaps it would be clearer to use an `Option<DVec2>`.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
self.update_handle_position(new_handle_position, anchor_point, responses, layer); } fn adjust_equidistant_handle(&mut self, anchor_pos: DVec2, responses: &mut VecDeque<Message>, layer: LayerNodeIdentifier, vector_data: &VectorData) { if self.modifiers.break_handle { // Store original handle before equidistant...
It isn't really clear which handle is stored and why. Perhaps this could be added to the name / a doc comment.
(end_handle - anchor_point).length() }; let new_handle_position = anchor_point + handle_offset * direction; self.update_handle_position(new_handle_position, anchor_point, responses, layer); } fn adjust_equidistant_handle(&mut self, anchor_pos: DVec2, responses: &mut VecDeque<Message>, layer: LayerNodeIdenti...
@@ -351,19 +373,106 @@ impl PenToolData { Some(if close_subpath { PenToolFsmState::Ready } else { PenToolFsmState::PlacingAnchor }) } - fn drag_handle(&mut self, snap_data: SnapData, transform: DAffine2, mouse: DVec2, responses: &mut VecDeque<Message>) -> Option<PenToolFsmState> { - let colinear = !self.modifie...
editor/src/messages/tool/tool_messages/pen_tool.rs
26
Rust
0.571
suggestion
110
51
51
false
Improve the Pen tool's colinearity and equidistance controls
2,242
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
0SlowPoke0
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/pen_tool.rs PR Title: Improve the Pen tool's colinearity and equidistance controls BEFORE CODE: self.update_handle_position(new_handle_position, anchor_point, responses, layer); } fn adjust_equidistant_handle(&mut self...
It isn't really clear which handle is stored and why. Perhaps this could be added to the name / a doc comment.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
let mut prev_handles = handles; let mut prev_start_point_index = start_point_index; let mut prev_end_point_index = end_point_index; let mut prev_original_length = prev_bezier.length(None); let mut prev_length = prev_original_length; let mut first_original_length = prev_original_length; let mut first_lengt...
This doesn't work when the layer is transformed: https://github.com/user-attachments/assets/7a8f031f-9b6a-475d-a890-7999c4161b92
style: vector_data.get(instance_row_index).unwrap().instance.style.clone(), ..Default::default() }; for (_, (_, bezpath)) in bezpaths.iter().enumerate().filter(|(i, (ri, _))| *i != index && *ri == instance_row_index) { result_vector_data.append_bezpath(bezpath.clone()); } let t = if t_value == bezpath...
@@ -1135,65 +1135,243 @@ fn bevel_algorithm(mut vector_data: VectorData, distance: f64) -> VectorData { } } + fn calculate_distance_to_spilt(bezier1: bezier_rs::Bezier, bezier2: bezier_rs::Bezier, bevel_length: f64) -> f64 { + if bezier1.is_linear() && bezier2.is_linear() { + let v1 = (bezier1.end - bezier1.s...
node-graph/gcore/src/vector/vector_nodes.rs
26
Rust
0.429
suggestion
133
51
51
false
Fix the Bevel node so it applies a consistent bevel size regardless of angle
2,293
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
MohdMohsin97
Review this pull request change. Language: Rust File: node-graph/gcore/src/vector/vector_nodes.rs PR Title: Fix the Bevel node so it applies a consistent bevel size regardless of angle BEFORE CODE: let mut prev_handles = handles; let mut prev_start_point_index = start_point_index; let mut prev_end_point_index...
This doesn't work when the layer is transformed: https://github.com/user-attachments/assets/7a8f031f-9b6a-475d-a890-7999c4161b92
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
self.id.retain(f); } pub fn push(&mut self, id: PointId, position: DVec2) { if self.id.contains(&id) { warn!("Duplicate point"); return; } self.id.push(id); self.positions.push(position); } pub fn positions(&self) -> &[DVec2] { &self.positions } pub fn positions_mut(&mut self) -> impl Iterat...
TODO this is dead and will be removed
debug_assert!(!self.id.contains(&id)); self.id.push(id); self.position.push(position); } pub fn positions(&self) -> &[DVec2] { &self.position } pub fn positions_mut(&mut self) -> impl Iterator<Item = (PointId, &mut DVec2)> { self.id.iter().copied().zip(self.position.iter_mut()) } pub fn set_position(...
@@ -149,6 +152,15 @@ impl PointDomain { self.positions[index] = position; } + pub fn set_position_by_id(&mut self, id: PointId, position: DVec2) {
node-graph/gcore/src/vector/vector_data/attributes.rs
26
Rust
0.143
suggestion
37
51
51
false
New node: Merge by Distance
2,307
GraphiteEditor/Graphite
17,935
Rust
richard-uk1
richard-uk1
Review this pull request change. Language: Rust File: node-graph/gcore/src/vector/vector_data/attributes.rs PR Title: New node: Merge by Distance BEFORE CODE: self.id.retain(f); } pub fn push(&mut self, id: PointId, position: DVec2) { if self.id.contains(&id) { warn!("Duplicate point"); return; } ...
TODO this is dead and will be removed
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} pub fn fill(&self) -> &[FillId] { &self.fill } fn concat(&mut self, other: &Self, _transform: DAffine2, id_map: &IdMap) { self.ids.extend(other.ids.iter().map(|id| *id_map.region_map.get(id).unwrap_or(id))); self.segment_range.extend( other .segment_range .iter() .map(|range| *id_map.segmen...
TODO also remove this dead code
self.segment_range.extend( other .segment_range .iter() .map(|range| *id_map.segment_map.get(range.start()).unwrap_or(range.start())..=*id_map.segment_map.get(range.end()).unwrap_or(range.end())), ); self.fill.extend(&other.fill); } pub fn map_ids(&mut self, id_map: &IdMap) { self.id.iter_mut(...
@@ -504,6 +542,12 @@ impl RegionDomain { } } +pub struct Region {
node-graph/gcore/src/vector/vector_data/attributes.rs
26
Rust
0.143
refactor
31
51
51
false
New node: Merge by Distance
2,307
GraphiteEditor/Graphite
17,935
Rust
richard-uk1
richard-uk1
Review this pull request change. Language: Rust File: node-graph/gcore/src/vector/vector_data/attributes.rs PR Title: New node: Merge by Distance BEFORE CODE: } pub fn fill(&self) -> &[FillId] { &self.fill } fn concat(&mut self, other: &Self, _transform: DAffine2, id_map: &IdMap) { self.ids.extend(other.i...
TODO also remove this dead code
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
use std::borrow::Cow; use bezier_rs::BezierHandles; use glam::DVec2; use petgraph::graph::{EdgeIndex, NodeIndex, UnGraph}; use rustc_hash::FxHashMap; use super::{PointId, SegmentId, VectorData}; pub struct IndexedVectorData<'a> { /// This structure owns the data to allow convenient modification + storage /// Can w...
Not all fields are used here. They would be useful in other contexts - TODO consider whether to delete or not.
use super::{PointId, SegmentId, VectorData}; use glam::DVec2; use petgraph::graph::{EdgeIndex, NodeIndex, UnGraph}; use rustc_hash::FxHashMap; /// All the fixed fields of a point from the point domain. pub struct Point { pub id: PointId, pub position: DVec2, } /// Useful indexes to speed up various operations on `V...
@@ -0,0 +1,146 @@ +use std::borrow::Cow; + +use bezier_rs::BezierHandles; +use glam::DVec2; +use petgraph::graph::{EdgeIndex, NodeIndex, UnGraph}; +use rustc_hash::FxHashMap; + +use super::{PointId, SegmentId, VectorData}; + +pub struct IndexedVectorData<'a> { + /// This structure owns the data to allow convenient modi...
node-graph/gcore/src/vector/vector_data/indexed.rs
13
Rust
0.429
suggestion
110
38
38
false
New node: Merge by Distance
2,307
GraphiteEditor/Graphite
17,935
Rust
richard-uk1
richard-uk1
Review this pull request change. Language: Rust File: node-graph/gcore/src/vector/vector_data/indexed.rs PR Title: New node: Merge by Distance BEFORE CODE: use std::borrow::Cow; use bezier_rs::BezierHandles; use glam::DVec2; use petgraph::graph::{EdgeIndex, NodeIndex, UnGraph}; use rustc_hash::FxHashMap; use supe...
Not all fields are used here. They would be useful in other contexts - TODO consider whether to delete or not.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
Footprint -> VectorDataTable, )] source: impl Node<F, Output = VectorDataTable>, #[default(10.)] distance: Length, ) -> VectorDataTable { let source = source.eval(footprint).await; let source = source.one_item(); let result = bevel_algorithm(source.clone(), distance); VectorDataTable::new(result) } #[node_m...
Perhaps a different default would be better.
10. * std::f64::consts::SQRT_2, 0, ) .await; let sample_points = sample_points.instances().next().unwrap().instance; assert!( (20..=40).contains(&sample_points.point_domain.positions().len()), "actual len {}", sample_points.point_domain.positions().len() ); for point in sample_points.point_do...
@@ -1220,6 +1220,29 @@ async fn bevel<F: 'n + Send + Copy>( VectorDataTable::new(result) } +#[node_macro::node(category("Vector"), path(graphene_core::vector))] +async fn merge_by_distance<F: 'n + Send + Copy>( + #[implementations( + (), + Footprint, + )] + footprint: F, + #[implementations( + () -> VectorDataT...
node-graph/gcore/src/vector/vector_nodes.rs
26
Rust
0.143
suggestion
44
51
51
false
New node: Merge by Distance
2,307
GraphiteEditor/Graphite
17,935
Rust
richard-uk1
richard-uk1
Review this pull request change. Language: Rust File: node-graph/gcore/src/vector/vector_nodes.rs PR Title: New node: Merge by Distance BEFORE CODE: Footprint -> VectorDataTable, )] source: impl Node<F, Output = VectorDataTable>, #[default(10.)] distance: Length, ) -> VectorDataTable { let source = source.eva...
Perhaps a different default would be better.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
HintGroup(vec![HintInfo::keys([Key::Shift], "Extend"), HintInfo::keys([Key::Alt], "Subtract")]), // TODO: Re-select deselected layers during drag when Shift is pressed, and re-deselect if Shift is released before drag ends. // TODO: (See https://discord.com/channels/731730685944922173/1216976541947531264...
```suggestion HintGroup(vec![HintInfo::keys([Key::Control], "Unlock Slide")]), ```
SelectToolFsmState::Drawing { has_drawn, .. } if *has_drawn => { let hint_data = HintData(vec![ HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, ""), HintInfo::keys([Key::Escape], "Cancel").prepend_slash()]), HintGroup(vec![HintInfo::keys([Key::Shift], "Extend"), HintInfo::keys([Key::Alt], "Subtract")]...
@@ -1570,7 +1570,14 @@ impl Fsm for SelectToolFsmState { ]); responses.add(FrontendMessage::UpdateInputHints { hint_data }); } - SelectToolFsmState::DraggingPivot | SelectToolFsmState::SkewingBounds { .. } => { + SelectToolFsmState::SkewingBounds { .. } => { + let hint_data = HintData(vec![ + H...
editor/src/messages/tool/tool_messages/select_tool.rs
26
Rust
0.571
suggestion
89
51
51
false
Enable free movement of transform cage edge during skew when Ctrl is held
2,358
GraphiteEditor/Graphite
17,935
Rust
Keavon
mTvare6
Review this pull request change. Language: Rust File: editor/src/messages/tool/tool_messages/select_tool.rs PR Title: Enable free movement of transform cage edge during skew when Ctrl is held BEFORE CODE: HintGroup(vec![HintInfo::keys([Key::Shift], "Extend"), HintInfo::keys([Key::Alt], "Subtract")]), // T...
```suggestion HintGroup(vec![HintInfo::keys([Key::Control], "Unlock Slide")]), ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"graphene_core::vector::generator_nodes::RegularPolygonGenerator", "graphene_core::vector::generator_nodes::RegularPolygonNode", ), ("graphene_core::vector::generator_nodes::StarGenerator", "graphene_core::vector::generator_nodes::StarNode"), ("graphene_std::executor::BlendGpuImageNode", "gra...
The method name 'set_manual_compostion' appears misspelled. Consider renaming it to 'set_manual_composition' for clarity. ```suggestion document.network_interface.set_manual_composition(node_id, &network_path, Some(graph_craft::Type::Generic("T".into()))); ```
"graphene_core::vector::generator_nodes::RegularPolygonGenerator", "graphene_core::vector::generator_nodes::RegularPolygonNode", ), ("graphene_core::vector::generator_nodes::StarGenerator", "graphene_core::vector::generator_nodes::StarNode"), ("graphene_std::executor::BlendGpuImageNode", "gra...
@@ -497,24 +497,25 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageData<'_>> for PortfolioMes ("graphene_std::executor::BlendGpuImageNode", "graphene_std::gpu_nodes::BlendGpuImageNode"), ("graphene_std::raster::SampleNode", "graphene_std::raster::SampleImageNode"), ]; - for node_id in &docu...
editor/src/messages/portfolio/portfolio_message_handler.rs
26
Rust
1
suggestion
268
51
51
false
Fix document upgrades to work recursively within subgraph nodes
2,369
GraphiteEditor/Graphite
17,935
Rust
Copilot
TrueDoctor
Review this pull request change. Language: Rust File: editor/src/messages/portfolio/portfolio_message_handler.rs PR Title: Fix document upgrades to work recursively within subgraph nodes BEFORE CODE: "graphene_core::vector::generator_nodes::RegularPolygonGenerator", "graphene_core::vector::generator_nod...
The method name 'set_manual_compostion' appears misspelled. Consider renaming it to 'set_manual_composition' for clarity. ```suggestion document.network_interface.set_manual_composition(node_id, &network_path, Some(graph_craft::Type::Generic("T".into()))); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
use crate::messages::portfolio::document::navigation::utility_types::NavigationOperation; use crate::messages::portfolio::document::utility_types::misc::PTZ; use crate::messages::portfolio::document::utility_types::network_interface::NodeNetworkInterface; use crate::messages::prelude::*; use crate::messages::tool::util...
Maybe this would be better in `PTZ` struct? This would be consistent with the rest of the resolved document transform state. It would also allow the flipped state to be saved in the document for consistency with pan, tilt, and zoom. I'm not sure if this is desired though (@Keavon?) Also I guess you might have to...
use crate::messages::portfolio::document::navigation::utility_types::NavigationOperation; use crate::messages::portfolio::document::utility_types::misc::PTZ; use crate::messages::portfolio::document::utility_types::network_interface::NodeNetworkInterface; use crate::messages::prelude::*; use crate::messages::tool::util...
@@ -30,6 +30,7 @@ pub struct NavigationMessageHandler { mouse_position: ViewportPosition, finish_operation_with_click: bool, abortable_pan_start: Option<f64>, + pub canvas_flipped: bool,
editor/src/messages/portfolio/document/navigation/navigation_message_handler.rs
26
Rust
0.643
suggestion
346
51
51
false
Add PTZ support for flipping the canvas
2,394
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
Sidharth-Singh10
Review this pull request change. Language: Rust File: editor/src/messages/portfolio/document/navigation/navigation_message_handler.rs PR Title: Add PTZ support for flipping the canvas BEFORE CODE: use crate::messages::portfolio::document::navigation::utility_types::NavigationOperation; use crate::messages::portfoli...
Maybe this would be better in `PTZ` struct? This would be consistent with the rest of the resolved document transform state. It would also allow the flipped state to be saved in the document for consistency with pan, tilt, and zoom. I'm not sure if this is desired though (@Keavon?) Also I guess you might have to...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
}) } /// Find all of the inputs of a specific node within the layer's primary flow, up until the next layer is reached. pub fn find_node_inputs(&self, node_name: &str) -> Option<&'a Vec<NodeInput>> { self.horizontal_layer_flow() .skip(1)// Skip self .take_while(|node_id| !self.network_interface.is_layer(n...
This isn't a particularly robust approach as nodes can produce raster data without an image frame input. For example the noise pattern node (if it wasn't broken).
.is_some_and(move |implementation| *implementation == graph_craft::document::DocumentNodeImplementation::proto(protonode_identifier)) }) } /// Find all of the inputs of a specific node within the layer's primary flow, up until the next layer is reached. pub fn find_node_inputs(&self, node_name: &str) -> Optio...
@@ -417,4 +417,19 @@ impl<'a> NodeGraphLayer<'a> { // TODO: Find a better way to accept a node input rather than using its index (which is quite unclear and fragile) self.find_node_inputs(node_name)?.get(index)?.as_value() } + + // Check if the current layer is backed by a raster image + pub fn is_raster_image(...
editor/src/messages/tool/common_functionality/graph_modification_utils.rs
26
Rust
0.357
bug
162
34
32
false
Fix fill tool on raster image temporarily breaks the graph
2,398
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
EllenGYY
Review this pull request change. Language: Rust File: editor/src/messages/tool/common_functionality/graph_modification_utils.rs PR Title: Fix fill tool on raster image temporarily breaks the graph BEFORE CODE: }) } /// Find all of the inputs of a specific node within the layer's primary flow, up until the next...
This isn't a particularly robust approach as nodes can produce raster data without an image frame input. For example the noise pattern node (if it wasn't broken).
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} pub fn send_dialog_to_frontend(&self, responses: &mut VecDeque<Message>, preferences: &PreferencesMessageHandler) { self.send_layout(responses, LayoutTarget::DialogColumn1, preferences); self.send_layout_column_2(responses, LayoutTarget::DialogColumn2); self.send_layout_buttons(responses, LayoutTarget::Dialo...
@Keavon when you have a moment , could be please take a look if the formula of logarithmic scaling correctly implemented for our use case. I took reference from [here](https://stackoverflow.com/questions/28125439/algorithm-to-map-values-to-unit-scale-with-logarithmic-spacing). This PR sets the minimal possible ...
} fn send_layout_buttons(&self, responses: &mut VecDeque<Message>, layout_target: LayoutTarget) { responses.add(LayoutMessage::SendLayout { layout: self.layout_buttons(), layout_target, }); } pub fn send_dialog_to_frontend(&self, responses: &mut VecDeque<Message>, preferences: &PreferencesMessageHandler...
@@ -250,3 +272,42 @@ impl PreferencesDialogMessageHandler { }); } } +// Map the actual rate value to display value (1-100) +fn map_zoom_rate_to_display(rate: f64) -> f64 { + let value = if rate <= 0.0001 { + 1.0 + } else if rate >= 0.05 { + 100.0 + } else { + // Calculate the logarithmic position between 0.000...
editor/src/messages/dialog/preferences_dialog/preferences_dialog_message_handler.rs
26
Rust
0.786
bug
442
51
37
false
Add option to adjust viewport zoom rate in the preferences dialog
2,420
GraphiteEditor/Graphite
17,935
Rust
Sidharth-Singh10
Sidharth-Singh10
Review this pull request change. Language: Rust File: editor/src/messages/dialog/preferences_dialog/preferences_dialog_message_handler.rs PR Title: Add option to adjust viewport zoom rate in the preferences dialog BEFORE CODE: } pub fn send_dialog_to_frontend(&self, responses: &mut VecDeque<Message>, preference...
@Keavon when you have a moment , could be please take a look if the formula of logarithmic scaling correctly implemented for our use case. I took reference from [here](https://stackoverflow.com/questions/28125439/algorithm-to-map-values-to-unit-scale-with-logarithmic-spacing). This PR sets the minimal possible ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
imaginate_hostname: self.imaginate_server_hostname.clone(), use_vello: self.use_vello && self.supports_wgpu(), } } pub fn supports_wgpu(&self) -> bool { graph_craft::wasm_application_io::wgpu_available().unwrap_or_default() } } impl Default for PreferencesMessageHandler { fn default() -> Self { let Ed...
Please can you use the `VIEWPORT_ZOOM_WHEEL_RATE` constant instead of the magic number? Thanks.
imaginate_hostname: self.imaginate_server_hostname.clone(), use_vello: self.use_vello && self.supports_wgpu(), } } pub fn supports_wgpu(&self) -> bool { graph_craft::wasm_application_io::wgpu_available().unwrap_or_default() } } impl Default for PreferencesMessageHandler { fn default() -> Self { let Ed...
@@ -48,6 +49,7 @@ impl Default for PreferencesMessageHandler { use_vello, vector_meshes: false, graph_wire_style: GraphWireStyle::default(), + viewport_zoom_wheel_rate: (1. / 600.) * 3.,
editor/src/messages/preferences/preferences_message_handler.rs
26
Rust
0.429
suggestion
95
51
51
false
Add option to adjust viewport zoom rate in the preferences dialog
2,420
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
Sidharth-Singh10
Review this pull request change. Language: Rust File: editor/src/messages/preferences/preferences_message_handler.rs PR Title: Add option to adjust viewport zoom rate in the preferences dialog BEFORE CODE: imaginate_hostname: self.imaginate_server_hostname.clone(), use_vello: self.use_vello && self.supports_...
Please can you use the `VIEWPORT_ZOOM_WHEEL_RATE` constant instead of the magic number? Thanks.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
let log_val = value.ln(); // Map to to_min-to_max range let normalized = (log_val - log_min) / (log_max - log_min); to_min + (to_max - to_min) * normalized } } // Function to map a value from one range to another using linear scaling pub fn map_linear_range(value: f64, from_min: f64, from_max: f64, to_min: f...
Can you write out the equations which produce these numbers, instead of just writing their magic number results? Also stylistically, please end all your whole-number floats with `.` instead of `.0` (for `1.0` -> `1.` and `100.0` -> `100.`).
use crate::consts::{VIEWPORT_ZOOM_WHEEL_RATE, VIEWPORT_ZOOM_WHEEL_RATE_CHANGE}; use crate::messages::layout::utility_types::widget_prelude::*; use crate::messages::portfolio::document::node_graph::utility_types::GraphWireStyle; use crate::messages::preferences::SelectionMode; use crate::messages::prelude::*; pub struc...
@@ -307,15 +307,15 @@ pub fn map_linear_range(value: f64, from_min: f64, from_max: f64, to_min: f64, t // Map the actual zoom rate value to display value (1-100) fn map_zoom_rate_to_display(rate: f64) -> f64 { - map_log_range(rate, 0.0001, 0.05, 1.0, 100.0).round() + map_log_range(rate, 0.000273, 0.0972, 1.0, 100.0...
editor/src/messages/dialog/preferences_dialog/preferences_dialog_message_handler.rs
26
Rust
0.643
suggestion
240
39
299
false
Add option to adjust viewport zoom rate in the preferences dialog
2,420
GraphiteEditor/Graphite
17,935
Rust
Keavon
Sidharth-Singh10
Review this pull request change. Language: Rust File: editor/src/messages/dialog/preferences_dialog/preferences_dialog_message_handler.rs PR Title: Add option to adjust viewport zoom rate in the preferences dialog BEFORE CODE: let log_val = value.ln(); // Map to to_min-to_max range let normalized = (log_val...
Can you write out the equations which produce these numbers, instead of just writing their magic number results? Also stylistically, please end all your whole-number floats with `.` instead of `.0` (for `1.0` -> `1.` and `100.0` -> `100.`).
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
)]) }), ); map } pub fn resolve_document_node_type(identifier: &str) -> Option<&DocumentNodeDefinition> { DOCUMENT_NODE_TYPES.iter().find(|definition| definition.identifier == identifier) } pub fn collect_node_types() -> Vec<FrontendNodeType> { DOCUMENT_NODE_TYPES .iter() .filter(|definition| !definition...
This ignores nodes that are compatible with multiple types. For example the transform node works on `Instances<Image<Colour>>` (if you paste a raster image into the document). However system will filter out the transform node for raster data.
]); } Ok(vec![LayoutGroup::Row { widgets }]) }), ); map.insert( "text_area".to_string(), Box::new(|node_id, index, context| { let (document_node, input_name) = node_properties::query_node_and_input_name(node_id, index, context)?; Ok(vec![LayoutGroup::Row { widgets: node_properties::text_are...
@@ -3409,7 +3409,23 @@ pub fn collect_node_types() -> Vec<FrontendNodeType> { DOCUMENT_NODE_TYPES .iter() .filter(|definition| !definition.category.is_empty()) - .map(|definition| FrontendNodeType::new(definition.identifier, definition.category)) + .map(|definition| { + let input_types = definition + .no...
editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs
26
Rust
0.714
suggestion
242
51
51
false
Make the node catalog, originating from a wire dropped in the graph, filter for valid types
2,423
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
singhutsav5502
Review this pull request change. Language: Rust File: editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs PR Title: Make the node catalog, originating from a wire dropped in the graph, filter for valid types BEFORE CODE: )]) }), ); map } pub fn resolve_document_node_type(identifie...
This ignores nodes that are compatible with multiple types. For example the transform node works on `Instances<Image<Colour>>` (if you paste a raster image into the document). However system will filter out the transform node for raster data.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
.sort((a, b) => a[0].localeCompare(b[0])) .sort((a, b) => { const aIndex = START_CATEGORIES_ORDER.findIndex((x) => a[0].startsWith(x)); const bIndex = START_CATEGORIES_ORDER.findIndex((x) => b[0].startsWith(x)); if (aIndex !== -1 && bIndex !== -1) return aIndex - bIndex; if (aIndex !== -1) return ...
I'm not quite sure of the UX of having the type as the search term. This prevents the user from further filtering down the options. For example vector data is used by many nodes (and more will be added over time), so the user may wish to further filter them with a keyword.
} else { categories.set(node.category, { open, nodes: [node], }); } }); const START_CATEGORIES_ORDER = ["UNCATEGORIZED", "General", "Value", "Math", "Style"]; const END_CATEGORIES_ORDER = ["Debug"]; return Array.from(categories) .sort((a, b) => a[0].localeCompare(b[0])) .sort((a, ...
@@ -82,7 +99,7 @@ </script> <div class="node-catalog"> - <TextInput placeholder="Search Nodes..." value={searchTerm} on:value={({ detail }) => (searchTerm = detail)} bind:this={nodeSearchInput} /> + <TextInput placeholder="Search Nodes... (or type:InputType)" value={searchTerm} on:value={({ detail }) => (searchTerm...
frontend/src/components/floating-menus/NodeCatalog.svelte
26
Svelte
0.643
suggestion
276
51
51
false
Make the node catalog, originating from a wire dropped in the graph, filter for valid types
2,423
GraphiteEditor/Graphite
17,935
Rust
0HyperCube
singhutsav5502
Review this pull request change. Language: Svelte File: frontend/src/components/floating-menus/NodeCatalog.svelte PR Title: Make the node catalog, originating from a wire dropped in the graph, filter for valid types BEFORE CODE: .sort((a, b) => a[0].localeCompare(b[0])) .sort((a, b) => { const aIndex = ST...
I'm not quite sure of the UX of having the type as the search term. This prevents the user from further filtering down the options. For example vector data is used by many nodes (and more will be added over time), so the user may wish to further filter them with a keyword.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
[Pivot::Middle, Pivot::End], ) } pub fn compass_rose(&mut self, compass_center: DVec2, angle: f64, show_compass_with_hover_ring: Option<bool>) { const HOVER_RING_OUTER_RADIUS: f64 = COMPASS_ROSE_HOVER_RING_DIAMETER / 2.; const MAIN_RING_OUTER_RADIUS: f64 = COMPASS_ROSE_MAIN_RING_DIAMETER / 2.; const MAIN_...
should this method be renamed to from_rgb_str_srgb?
[Pivot::Middle, Pivot::End], ) } pub fn compass_rose(&mut self, compass_center: DVec2, angle: f64, show_compass_with_hover_ring: Option<bool>) { const HOVER_RING_OUTER_RADIUS: f64 = COMPASS_ROSE_HOVER_RING_DIAMETER / 2.; const MAIN_RING_OUTER_RADIUS: f64 = COMPASS_ROSE_MAIN_RING_DIAMETER / 2.; const MAIN_...
@@ -357,7 +357,10 @@ impl OverlayContext { // Hover ring if show_hover_ring { - let mut fill_color = graphene_std::Color::from_rgb_str(COLOR_OVERLAY_BLUE.strip_prefix('#').unwrap()).unwrap().with_alpha(0.5).rgba_hex(); + let mut fill_color = graphene_std::Color::from_rgb_str(COLOR_OVERLAY_BLUE.strip_prefix(...
editor/src/messages/portfolio/document/overlays/utility_types.rs
26
Rust
0.286
question
51
51
51
false
Refactor many usages of Color to natively store linear not gamma
2,457
GraphiteEditor/Graphite
17,935
Rust
TrueDoctor
Keavon
Review this pull request change. Language: Rust File: editor/src/messages/portfolio/document/overlays/utility_types.rs PR Title: Refactor many usages of Color to natively store linear not gamma BEFORE CODE: [Pivot::Middle, Pivot::End], ) } pub fn compass_rose(&mut self, compass_center: DVec2, angle: f64, sh...
should this method be renamed to from_rgb_str_srgb?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.