wPaint icon indicating copy to clipboard operation
wPaint copied to clipboard

Width of the line fail

Open enmonie opened this issue 11 years ago • 2 comments

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 }

enmonie avatar Dec 17 '13 15:12 enmonie

Hi. I removed "*c". but i does not work. Please help me.

Arnpd avatar Jan 12 '17 08:01 Arnpd

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)),

nakazawaken1 avatar May 17 '18 06:05 nakazawaken1