我有一个HTML5画布元素的问题。我使用sketch.js,以便客户可以在网页上绘制图画。客户的要求之一是他可以用数字添加“邮票”。所以我对JS进行了一些修改,使之成为可能。它的作品,它可以添加邮票。但是,当用户切换回钢笔工具并再次开始绘制时,数字消失。html5画布filltext消失与sketch.js
我添加使用fillText方法()邮票
$.sketch.tools.text = {
onEvent: function(e) {
switch (e.type) {
case 'mousedown':
case 'touchstart':
this.context.font="16px Verdana";
this.context.fillText(this.stamp, e.pageX - this.canvas.offset().left, e.pageY - this.canvas.offset().top);
break;
}
return true;
},
draw: function(action) {
return true;
}
};
在这里看到一个演示: http://jsfiddle.net/brixion/m5dpwvx5/2/
希望有人能帮助我