Code Monkey home page Code Monkey logo

Comments (2)

adrian1001 avatar adrian1001 commented on September 4, 2024

For long pencil strokes deleting the entire object is usually a bit too much.
Boils down to what is already mentioned in the eraser.js //TODO: add the ability to erase only some points in a line.

Thoughts:

  • Add function to boolean-subtract a shape from the drawing (there must be many libraries, e.g. https://github.com/w8r/GreinerHormann, or https://sourceforge.net/p/jsclipper/wiki/Home%206/)
  • Add rectangle-eraser: click to mark corner of rectangle, drag to diagonal corner, upon release clip the drawing against rectangle
  • Add a pen-like eraser:
    • option1: At every position, clip drawing against a circle-like polygon around cursor position
    • option2 (optimized): Tool draws a white shape to give user feedback; upon release, the shape is used to clip the drawing

Potential issues:

  • performance: clipping a large drawing might require good algorithms (partitioning)
  • cutting a line into segments will not look nice for thick lines because the end points have no information about at what angle the line was cut. (Draw line as polygon?)

from whitebophir.

lovasoa avatar lovasoa commented on September 4, 2024

Yes, these are good ideas. But all of them require a significant refactoring of the existing code. There is currently no spacial index of the shapes.

from whitebophir.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.