Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing stroke width also changes all older eraser paths #1

Open
ugre opened this issue Sep 2, 2022 · 5 comments
Open

Changing stroke width also changes all older eraser paths #1

ugre opened this issue Sep 2, 2022 · 5 comments

Comments

@ugre
Copy link

ugre commented Sep 2, 2022

While drawing paths in Canvas, when eraseMode is true, it should also use property.strokeWidth (and others) but NOT currentPathProperty.*
Simple bug and simple fix ;)

@SmartToolFactory
Copy link
Owner

Sure, i will add update it with this fix. I will probably rewrite drawing app from scratch when i have time with some Event logic to capture, time, properties and action to save them to database for persistence and undo/redo logic.

@ugre
Copy link
Author

ugre commented Nov 7, 2022

Either way, thank you for this, it does the job for me now. Hopefully, you find the time to build it more robust and customizable. I will also try to find the time to do it myself meanwhile...

@myuksektepe
Copy link

Hello,
@ugre and @SmartToolFactory i faced same issue, did you find the solution for this one?

@myuksektepe
Copy link

I find the solution. Just change "currentPathProperty" to "property" at 218, 219 and 220th lines in DrawingApp.kt

  paths.forEach {
      val path = it.first
      val property = it.second

      if (!property.eraseMode) {
          drawPath(
              color = property.color,
              path = path,
              style = Stroke(
                  width = property.strokeWidth,
                  cap = property.strokeCap,
                  join = property.strokeJoin
              )
          )
      } else {
          // Source
          drawPath(
              color = Color.Transparent,
              path = path,
              style = Stroke(
                  width = **property**.strokeWidth, // <--- 
                  cap = **property**.strokeCap, // <--- 
                  join = **property**.strokeJoin // <--- 
              ),
              blendMode = BlendMode.Clear
          )
      }
  }

@SmartToolFactory
Copy link
Owner

can you open a PR for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants