Skip to content

Commit

Permalink
bug fixes + improvements in whiteboard application
Browse files Browse the repository at this point in the history
  • Loading branch information
ppodhajski committed Oct 26, 2016
1 parent e63633a commit d81a2f2
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 29 deletions.
80 changes: 51 additions & 29 deletions apps/Whiteboard/qml/whiteboard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ Item {
width: viewColor.model.count * (viewColor.buttonWidth + colorTools.spacing)
height: 75
anchors.rightMargin: 75

ListView {
anchors.fill: parent
id: viewColor
model: colorModel
delegate: colorDelegate
spacing: 5
boundsBehavior: Flickable.StopAtBounds
property int buttonWidth: 75
orientation: ListView.Horizontal
highlight: Rectangle {
Expand All @@ -196,6 +196,7 @@ Item {
model: brushModel
delegate: brushDelegate
spacing: 5
boundsBehavior: Flickable.StopAtBounds
property int buttonWidth: 75
orientation: ListView.Horizontal
highlight: Rectangle {
Expand Down Expand Up @@ -236,6 +237,16 @@ Item {
anchors.bottom: parent.bottom
width: root.width
height: root.height - headerHeight
Rectangle {
id: freezePane
anchors.fill: parent
anchors.topMargin: saveMenu.height
color: "lightsteelblue"
visible: false
opacity: 0.5
z: 99
}

Text {
id: infoBox
text: ""
Expand Down Expand Up @@ -270,8 +281,9 @@ Item {
ctx.lineWidth = singleCurve[2]

if (singleCurve[0].length < 4) {
ctx.arc(singleCurve[0][0][0], singleCurve[0][0][1], 1,
0, Math.PI * 2, false)
ctx.arc(singleCurve[0][0][0] + singleCurve[3][0],
singleCurve[0][0][1] + singleCurve[3][1], 1, 0,
Math.PI * 2, false)
} else {
for (var i = 0; i < singleCurve[0].length - 1; i++) {
ctx.moveTo(singleCurve[0][i][0] + singleCurve[3][0],
Expand All @@ -286,37 +298,40 @@ Item {
}
}


MultiPointTouchArea {
id: area
enabled: true
anchors.fill: parent
property var paths: []
touchPoints: TouchPoint {
id: point1
}

touchPoints: [
TouchPoint {
id: point0
}
]
onPressed: {
singleLine = new Array(0)
lastX = point1.x
lastY = point1.y
singleLine.push([point1.x, point1.y])
if (touchPoints[0] === point0) {
singleLine = new Array(0)
lastX = point0.x
lastY = point0.y
singleLine.push([point0.x, point0.y])
}
}
onTouchUpdated: {
singleLine.push([point1.x, point1.y])
onUpdated: {
singleLine.push([point0.x, point0.y])
canvasTmp.requestPaint()
}
onReleased: {
var singleCurve = new Array(0)
singleCurve.push(singleLine)
singleCurve.push(brushColor)
singleCurve.push(brushSize)
singleCurve.push([0, 0])

allCurves.push(singleCurve)
canvas.requestPaint()

paths = []
canvasTmp.getContext("2d").reset()
if (touchPoints[0] === point0) {
var singleCurve = new Array(0)
singleCurve.push(singleLine)
singleCurve.push(brushColor)
singleCurve.push(brushSize)
singleCurve.push([0, 0])
allCurves.push(singleCurve)
canvas.requestPaint()
paths = []
canvasTmp.getContext("2d").reset()
}
}
}

Expand All @@ -330,8 +345,8 @@ Item {
ctx2.strokeStyle = brushColor
ctx2.beginPath()
ctx2.moveTo(lastX, lastY)
lastX = point1.x
lastY = point1.y
lastX = point0.x
lastY = point0.y
ctx2.lineTo(lastX, lastY)
ctx2.stroke()
ctx2.closePath()
Expand All @@ -342,10 +357,17 @@ Item {
Rectangle {
color: "#e7edf5"
function toggle() {
if (saveMenu.state == "on")
if (saveMenu.state == "on") {
saveMenu.state = "off"
else
area.enabled = true
freezePane.visible = false

} else {
saveMenu.state = "on"
area.enabled = false
freezePane.visible = true

}
}
id: saveMenu
width: root.width
Expand Down
2 changes: 2 additions & 0 deletions doc/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Changelog {#changelog}

# Release 1.2 (git master)

* [96](https://github.com/BlueBrain/Tide/pull/96):
Bug fixes in Whiteboard application
* [95](https://github.com/BlueBrain/Tide/pull/95):
More consistent and intuitive user experience:
- Double-tap a window to make it fullscreen
Expand Down

0 comments on commit d81a2f2

Please sign in to comment.