-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix image/video height when showing large images
- Loading branch information
Showing
4 changed files
with
203 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import QtQuick 2.0 | ||
import Sailfish.Silica 1.0 | ||
|
||
Component { | ||
BackgroundItem { | ||
id: root; | ||
anchors { left: parent.left; right: parent.right; } | ||
|
||
height: image.height; | ||
|
||
property int start_x; | ||
property int start_y; | ||
|
||
AnimatedImage { | ||
id: image; | ||
anchors { left: parent.left; right: parent.right; } | ||
asynchronous: true; | ||
|
||
fillMode: Image.PreserveAspectFit; | ||
source: (deviceOrientation === Orientation.Landscape || deviceOrientation === Orientation.LandscapeInverted) ? link_original : link; | ||
width: parent.width; | ||
playing: settings.autoplayAnim; | ||
paused: false; | ||
onStatusChanged: playing; | ||
smooth: false; | ||
|
||
PinchArea { | ||
anchors.fill: parent; | ||
pinch.target: parent; | ||
pinch.minimumScale: 1; | ||
pinch.maximumScale: 4; | ||
} | ||
} | ||
|
||
BusyIndicator { | ||
id: loadingImageIndicator; | ||
anchors.horizontalCenter: parent.horizontalCenter; | ||
running: image.status != AnimatedImage.Ready || savingInProgress; | ||
size: BusyIndicatorSize.Medium; | ||
} | ||
|
||
Image { | ||
id: playIcon; | ||
anchors { centerIn: image; } | ||
visible: animated && !image.playing; | ||
width: Theme.itemSizeSmall; | ||
height: Theme.itemSizeSmall; | ||
source: constant.iconPlay; | ||
} | ||
|
||
onClicked: { | ||
//console.log("ready=" + AnimatedImage.Ready + "; frames=" + image.frameCount +"; | ||
//playing=" + image.playing + "; paused=" + image.paused); | ||
if (animated) { | ||
if (!image.playing) { | ||
image.playing = true; | ||
image.paused = false; | ||
playIcon.visible = false; | ||
} | ||
if (image.paused) { | ||
image.paused = false; | ||
playIcon.visible = false; | ||
} else { | ||
image.paused = true; | ||
playIcon.visible = true; | ||
} | ||
//console.log("playing=" + image.playing + "; paused=" + image.paused); | ||
} | ||
} | ||
|
||
onPressAndHold: { | ||
imageColumn.height = (imageColumn.height < drawerContextMenu.height) ? drawerContextMenu.height : imageColumn.height; | ||
drawer.open = true; | ||
} | ||
|
||
onPressed: { | ||
start_x = mouseX; | ||
start_y = mouseY; | ||
} | ||
|
||
onPositionChanged: { | ||
var x_diff = mouseX - start_x; | ||
var y_diff = mouseY - start_y; | ||
|
||
var abs_x_diff = Math.abs(x_diff); | ||
var abs_y_diff = Math.abs(y_diff); | ||
|
||
if (abs_x_diff != abs_y_diff) { | ||
if (abs_x_diff > abs_y_diff) { | ||
if (abs_x_diff > 50) { | ||
if (x_diff > 0) { | ||
if (prevEnabled) { galleryNavigation.previous(); } | ||
} else if (x_diff < 0) { | ||
galleryNavigation.next(); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.