Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
153 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...