What is the difference between KineticJS draw methods?
Asked Answered
P

1

14

What is the difference between KineticJS methods layer.draw(), layer.drawScene() and layer.drawHit()?

Panchromatic answered 6/2, 2013 at 6:17 Comment(1)
KineticJS is discontinued, KonvaJS is supportedHerrah
S
8

Have a look at the source (v4.3.1), l. 3381ff. These are defined on a Kinetic.Container.

    draw: function() {
        this.drawScene();
        this.drawHit();
    },
    drawScene: function(canvas) {
        // do stuff
    },
    drawHit: function() {
        // do stuff
    }

The drawScene is used to draw the shapes onto the drawing canvas.

The drawHit (see example) is used to allow to modify the region where mouse events trigger events. This is done internally using a special Kinetic.HitCanvas.


Update: You can find the code inside their Github repository. draw() can be found in Node.js, the other two inside Container.js

Please be aware that Eric discontinued KineticJS.

Sadirah answered 6/2, 2013 at 7:19 Comment(2)
Please if you can update the links as they are not working anymoreHerrah
@MahdiAlkhatib I've added some links to the GitHub repo.Sadirah

© 2022 - 2024 — McMap. All rights reserved.