Commit 4599b3c0 authored by Christian Winter's avatar Christian Winter

brush now also storing line thickness

parent 159cef86
Pipeline #5143730 passed with stage
in 1 minute
......@@ -265,9 +265,9 @@
GUI.lineColor.value = Application.currentBrush.lineColor.toHexString();
if (thickness != undefined)
currentLineThickness = thickness;
Application.currentBrush.lineThickness = thickness;
GUI.lineThickness.value = currentLineThickness;
GUI.lineThickness.value = Application.currentBrush.lineThickness;
if (alpha != undefined)
Application.currentBrush.lineColor.a = alpha;
......@@ -279,14 +279,14 @@
for (let line of this.currentView.selection.data.lines.concat(this.currentView.selection.data.partialLines))
line.thickness += delta;
currentLineThickness = Math.max(1, currentLineThickness + delta);
Application.currentBrush.lineThickness = Math.max(1, Application.currentBrush.lineThickness + delta);
GUI.lineThickness.value = currentLineThickness;
GUI.lineThickness.value = Application.currentBrush.lineThickness;
Application.redrawAllViews();
}
setCurrentLineThickness(thickness) {
currentLineThickness = thickness;
Application.currentBrush.lineThickness = thickness;
for (let line of this.currentView.selection.data.lines.concat(this.currentView.selection.data.partialLines))
line.thickness = thickness;
......
......@@ -264,7 +264,7 @@ Utilities = new class {
end = end.addVector(direction.multiply(overshoot));
}
Application.file.currentLayer.data.lines.push(new Line(start, end, Application.currentBrush.lineColor, currentLineThickness));
Application.file.currentLayer.data.lines.push(new Line(start, end, Application.currentBrush.lineColor, Application.currentBrush.lineThickness));
}
Application.file.updateStats();
......
......@@ -341,11 +341,11 @@
if (e.ctrlKey) {
let step = 1;
let newThickness = currentLineThickness;
let newThickness = Application.currentBrush.lineThickness;
if (e.deltaY < 0)
newThickness += step;
else if (e.deltaY > 0)
newThickness = Math.max(currentLineThickness - step, 1);
newThickness = Math.max(Application.currentBrush.lineThickness - step, 1);
if (e.deltaY != 0)
Application.increaseCurrentLineThickness(e.deltaY < 0 ? step : -step);
......
......@@ -5,14 +5,14 @@
this.end = new LineEnding(y1.x, y1.y, this);
this.color = (x2) ? x2: Application.currentBrush.lineColor.copy();
this._thickness = (y2) ? y2: currentLineThickness;
this._thickness = (y2) ? y2: Application.currentBrush.lineThickness;
}
else {
this.start = new LineEnding(x1, y1, this);
this.end = new LineEnding(x2, y2, this);
this.color = (color) ? color : Application.currentBrush.lineColor.copy();
this._thickness = (_thickness) ? _thickness : currentLineThickness;
this._thickness = (_thickness) ? _thickness : Application.currentBrush.lineThickness;
}
}
......
......@@ -5,8 +5,6 @@ var offscreenContext;
let toolbar;
let currentLineThickness = 1;
let drawPolyLine;
let waitingForStart = [];
......
......@@ -616,13 +616,13 @@
if (this.view.logic.currentState instanceof DrawingState) {
let start = this.view.logic.currentState.startPos;
let end = Application.cursor.currentPosition;
this.drawLineFromTo(start, end, currentLineThickness, Application.currentBrush.lineColor, false);
this.drawLineFromTo(start, end, Application.currentBrush.lineThickness, Application.currentBrush.lineColor, false);
} else if (this.view.logic.currentState instanceof MeasureState) {
if (this.view.logic.currentState.startPosLMB && !this.view.logic.currentState.stoppedLMB) {
let start = this.view.logic.currentState.startPosLMB;
let end = this.view.logic.currentState.currentPosLMB;
this.view.context.setLineDash([Settings.guideDashSize * this.view.camera.zoom, Settings.guideDashSize * this.view.camera.zoom]);
this.drawLineFromTo(start, end, currentLineThickness, 'black', false);
this.drawLineFromTo(start, end, Application.currentBrush.lineThickness, 'black', false);
this.view.context.setLineDash([]);
}
}
......@@ -638,7 +638,7 @@
}
this.drawRealCircle(Application.cursor.currentPosition, currentLineThickness * 0.5, 1, Application.currentBrush.lineColor.toString(), false, true, true);
this.drawRealCircle(Application.cursor.currentPosition, Application.currentBrush.lineThickness * 0.5, 1, Application.currentBrush.lineColor.toString(), false, true, true);
this.drawRealCircle(Application.cursor.position, Application.cursor.range, 2, Settings.selectionColor, false, true);
if (this.view.logic.currentState instanceof BrushSelectionState)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment