GithubHelp home page GithubHelp logo

luileito / jsketch Goto Github PK

View Code? Open in Web Editor NEW
31.0 4.0 6.0 327 KB

A lightweight JavaScript library for drawing facilities on HTML5 canvas.

Home Page: https://luis.leiva.name/jsketch/

License: MIT License

JavaScript 100.00%
html-canvas html5-canvas-js sketching drawing-on-canvas

jsketch's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jsketch's Issues

How to change the line color?

the jquery option

graphics: {
strokeStyle: '#000',
},

has no effect! he still drawing in #F0F

Just the loaded strokes has change their color.

Can you help me??

[SVG Plugin]: SVG exporting does not carry over path specific stokeStyles

@luileito thanks for a great plugin. Super easy to use.

I have the following code in the mousedownBefore event.

mousedownBefore: function (elem, data, evt) {
    var brushType = getBrushType();
    if (brushType == 'eraser') {
        // There is a method to set the brush in eraser mode.
        data.options.graphics.lineWidth = 20;
        data.sketch.eraser();
    } else if (brushType == 'pencil') {

        const color = getBrushColor() ?? "black";

        // There is a method to get the default mode (pencil) back.
        data.options.graphics.lineWidth = 2;
        data.options.graphics.strokeStyle = color;

        data.sketch.saveGraphics(data.options.graphics);
        data.sketch.pencil();
    }
}

The function named getBrushColor is similar to your getBrushType function. It returns a HEX color of the color selected on the page.

Example UI:

image

However, when I execute the "svg.create" method the contents returned only use black.

test

Am I doing something wrong? Is this supported?

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.