Skip to content

Commit

Permalink
[sailfish-office] Add a rotation command in the UI.
Browse files Browse the repository at this point in the history
  • Loading branch information
dcaliste committed Mar 30, 2018
1 parent 434c1af commit 521c410
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions plugin/PDFDocumentPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ DocumentPage {
id: row
property bool active: pageCount.highlighted
|| linkBack.visible
|| rotateButton.highlighted
|| search.highlighted
|| !search.iconized
|| textButton.highlighted
Expand Down Expand Up @@ -390,6 +391,22 @@ DocumentPage {
toolbar.hide()
}
}
BackgroundItem {
id: rotateTool

width: row.itemWidth
height: parent.height
highlighted: pressed || rotateButton.pressed
onClicked: view.rotate()
IconButton {
id: rotateButton
anchors.centerIn: parent
highlighted: pressed || row.activeItem === rotateTool
icon.source: row.activeItem === rotateTool ? "image://theme/icon-m-rotate-right-selected"
: "image://theme/icon-m-rotate-right"
onClicked: view.rotate()
}
}
BackgroundItem {
id: pageCount
width: screen.sizeCategory <= Screen.Medium
Expand Down
4 changes: 4 additions & 0 deletions plugin/PDFView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ SilicaFlickable {
return Math.max(width, Math.min(value, maximumZoom))
}

function rotate() {
pdfCanvas.rotate(true)
}

function zoom(amount, center) {
var oldWidth = pdfCanvas.width
var oldHeight = pdfCanvas.height
Expand Down

0 comments on commit 521c410

Please sign in to comment.