mirror of https://github.com/luileito/jsketch.git
Fixed reading graphics options while drawing
This commit is contained in:
parent
f182258713
commit
3eb5c49de3
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -610,14 +610,15 @@
|
||||||
var lineColor, lineWidth;
|
var lineColor, lineWidth;
|
||||||
if (data.sketch.isDrawing) {
|
if (data.sketch.isDrawing) {
|
||||||
// Style for regular, pendown strokes.
|
// Style for regular, pendown strokes.
|
||||||
lineColor = options.strokeStyle;
|
lineColor = options.graphics.strokeStyle;
|
||||||
lineWidth = options.lineWidth;
|
lineWidth = options.graphics.lineWidth;
|
||||||
} else if (options.mouseupMovements) {
|
} else if (options.mouseupMovements) {
|
||||||
// Style for penup strokes.
|
// Style for penup strokes.
|
||||||
lineColor = options.mouseupMovements.strokeStyle || '#DDD';
|
lineColor = options.mouseupMovements.strokeStyle || '#DDD';
|
||||||
lineWidth = options.mouseupMovements.lineWidth || 1;
|
lineWidth = options.mouseupMovements.lineWidth || 1;
|
||||||
}
|
}
|
||||||
data.sketch.lineStyle(lineColor, lineWidth)
|
data.sketch
|
||||||
|
.lineStyle(lineColor, lineWidth)
|
||||||
.line(last[0], last[1], p.x, p.y)
|
.line(last[0], last[1], p.x, p.y)
|
||||||
.stroke();
|
.stroke();
|
||||||
}
|
}
|
||||||
|
|
@ -726,8 +727,8 @@
|
||||||
var lc, lw;
|
var lc, lw;
|
||||||
if (isDrawing) {
|
if (isDrawing) {
|
||||||
// Style for regular, pendown strokes.
|
// Style for regular, pendown strokes.
|
||||||
lc = options.strokeStyle;
|
lc = options.graphics.strokeStyle;
|
||||||
lw = options.lineWidth;
|
lw = options.graphics.lineWidth;
|
||||||
} else if (options.mouseupMovements) {
|
} else if (options.mouseupMovements) {
|
||||||
// Style for penup strokes.
|
// Style for penup strokes.
|
||||||
lc = options.mouseupMovements.strokeStyle || '#DDD';
|
lc = options.mouseupMovements.strokeStyle || '#DDD';
|
||||||
|
|
|
||||||
|
|
@ -607,15 +607,20 @@
|
||||||
var coords = data.coords[idx];
|
var coords = data.coords[idx];
|
||||||
var last = coords[coords.length - 1];
|
var last = coords[coords.length - 1];
|
||||||
if (last) {
|
if (last) {
|
||||||
var brush = data.sketch;
|
var lineColor, lineWidth;
|
||||||
if (data.sketch.isDrawing) {
|
if (data.sketch.isDrawing) {
|
||||||
// Style for regular, pendown strokes.
|
// Style for regular, pendown strokes.
|
||||||
brush.lineStyle(options.graphics.strokeStyle, options.graphics.lineWidth);
|
lineColor = options.graphics.strokeStyle;
|
||||||
|
lineWidth = options.graphics.lineWidth;
|
||||||
} else if (options.mouseupMovements) {
|
} else if (options.mouseupMovements) {
|
||||||
// Style for penup strokes.
|
// Style for penup strokes.
|
||||||
brush.lineStyle(options.mouseupMovements.strokeStyle || '#DDD', options.mouseupMovements.lineWidth || 1);
|
lineColor = options.mouseupMovements.strokeStyle || '#DDD';
|
||||||
|
lineWidth = options.mouseupMovements.lineWidth || 1;
|
||||||
}
|
}
|
||||||
brush.line(last[0], last[1], p.x, p.y).stroke();
|
data.sketch
|
||||||
|
.lineStyle(lineColor, lineWidth)
|
||||||
|
.line(last[0], last[1], p.x, p.y)
|
||||||
|
.stroke();
|
||||||
}
|
}
|
||||||
|
|
||||||
saveMousePos(idx, data, p);
|
saveMousePos(idx, data, p);
|
||||||
|
|
@ -720,8 +725,8 @@
|
||||||
var lc, lw;
|
var lc, lw;
|
||||||
if (isDrawing) {
|
if (isDrawing) {
|
||||||
// Style for regular, pendown strokes.
|
// Style for regular, pendown strokes.
|
||||||
lc = options.strokeStyle;
|
lc = options.graphics.strokeStyle;
|
||||||
lw = options.lineWidth;
|
lw = options.graphics.lineWidth;
|
||||||
} else if (options.mouseupMovements) {
|
} else if (options.mouseupMovements) {
|
||||||
// Style for penup strokes.
|
// Style for penup strokes.
|
||||||
lc = options.mouseupMovements.strokeStyle || '#DDD';
|
lc = options.mouseupMovements.strokeStyle || '#DDD';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue