Consistent default stroke line width
This commit is contained in:
parent
8370759608
commit
ffdd7b19e2
1 changed files with 15 additions and 11 deletions
|
@ -21,10 +21,14 @@ import Sailfish.Silica 1.0
|
||||||
|
|
||||||
Page {
|
Page {
|
||||||
|
|
||||||
property int startX;
|
property int startX
|
||||||
property int startY;
|
property int startY
|
||||||
property int finishX;
|
property int finishX
|
||||||
property int finishY;
|
property int finishY
|
||||||
|
|
||||||
|
readonly property real defaultStrokeSize: 5
|
||||||
|
readonly property string defaultStrokeColor: "#000000"
|
||||||
|
readonly property string defaultFillColor: "#ffffff"
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -44,10 +48,10 @@ Page {
|
||||||
property real prevLineWidth: 20;
|
property real prevLineWidth: 20;
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (canvas.strokeStyle === "#000000") {
|
if (canvas.strokeStyle === defaultStrokeColor) {
|
||||||
canvas.strokeStyle = "#ffffff";
|
canvas.strokeStyle = defaultFillColor;
|
||||||
} else {
|
} else {
|
||||||
canvas.strokeStyle = "#000000";
|
canvas.strokeStyle = defaultStrokeColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentLineWidth = size.value;
|
var currentLineWidth = size.value;
|
||||||
|
@ -61,7 +65,7 @@ Page {
|
||||||
minimumValue: 1
|
minimumValue: 1
|
||||||
maximumValue: 30
|
maximumValue: 30
|
||||||
stepSize: 1
|
stepSize: 1
|
||||||
value: 5
|
value: defaultStrokeSize
|
||||||
valueText: value
|
valueText: value
|
||||||
width: 400
|
width: 400
|
||||||
// Workaround: we don't want the Slider animation!
|
// Workaround: we don't want the Slider animation!
|
||||||
|
@ -91,8 +95,8 @@ Page {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
|
|
||||||
property real lineWidth: 1
|
property real lineWidth: defaultStrokeSize
|
||||||
property string strokeStyle: "#000000"
|
property string strokeStyle: defaultStrokeColor
|
||||||
|
|
||||||
onLineWidthChanged: requestPaint()
|
onLineWidthChanged: requestPaint()
|
||||||
|
|
||||||
|
@ -105,7 +109,7 @@ Page {
|
||||||
|
|
||||||
onPaint: {
|
onPaint: {
|
||||||
var ctx = getContext("2d");
|
var ctx = getContext("2d");
|
||||||
ctx.fillStyle = "#ffffff";
|
ctx.fillStyle = defaultFillColor;
|
||||||
ctx.lineCap = "round";
|
ctx.lineCap = "round";
|
||||||
ctx.lineJoin = "round";
|
ctx.lineJoin = "round";
|
||||||
ctx.lineWidth = lineWidth;
|
ctx.lineWidth = lineWidth;
|
||||||
|
|
Loading…
Reference in a new issue