Skip to content

Add shape on double click #10

@pmelchior

Description

@pmelchior

Hi Amit. I'd like to give user the ability to mark an object in an image, ideally by double-clicking at its location, which should then draw a circle around it. I've added this event handler to the API after line 250 of webfits-canvas.js:

this.canvas.ondblclick = function(e) {
        var ctx = _this.canvas.getContext('2d');
        ctx.beginPath();
        ctx.arc(_this.xMouseDown, _this.yMouseDown, 80, 0, 2*Math.PI, true);
        ctx.lineWidth=2;
        ctx.strokeStyle='#FF0000';
        ctx.stroke();
        ctx.closePath();
        return _this.draw();
      };

I verified that the double-click event triggers this function, but I don't see any effect on the canvas. I'm aware that's more an issue of my limited canvas knowledge, but if you have an idea to make this work, it might be useful for other webfits applications, too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions