wPaint
wPaint copied to clipboard
Width of the line fail
In case that the line is completely horizontal or vertical fail the width of the draw.
if modified one line of the function _drawShapeMove of the file wPaintMin.js the problem was solved:
_drawShapeMove: function(b, c) { var d = this.canvasTempLeftOriginal, e = this.canvasTempTopOriginal; c = c || 2, b.left = b.pageX < d ? b.pageX : d, b.top = b.pageY < e ? b.pageY : e, b.width = Math.abs(b.pageX - d), b.height = Math.abs(b.pageY - e), b.x = this.options.lineWidth / 2 * c, b.y = this.options.lineWidth / 2 * c, b.w = b.width - this.options.lineWidth * c, b.h = b.height - this.options.lineWidth * c, a(this.canvasTemp).css({left: b.left, top: b.top}).attr("width", b.width).attr("height", b.height), this.canvasTempLeftNew = b.left, this.canvasTempTopNew = b.top, c = c || 2, this.ctxTemp.fillStyle = this.options.fillStyle, this.ctxTemp.strokeStyle = this.options.strokeStyle,
// this lines must be change this.ctxTemp.lineWidth = this.options.lineWidth * c // for this (without "* c") this.ctxTemp.lineWidth = this.options.lineWidth }
Hi. I removed "*c". but i does not work. Please help me.
modify
b.width = Math.abs(b.pageX - d),
b.height = Math.abs(b.pageY - e),
to
b.width = Math.max(this.options.lineWidth, Math.abs(b.pageX - d)),
b.height = Math.max(this.options.lineWidth, Math.abs(b.pageY - e)),