+ Flickable {
+ id: flickableFront
+ //anchors.fill: screen;
+ height: articlePage.height;
+ width: articlePage.width;
+ contentWidth: boundsRecFront.width
+ contentHeight: boundsRecFront.height
+ boundsBehavior: Flickable.StopAtBounds
+ //contentWidth: childrenRect.width; contentHeight: childrenRect.height
+ //interactive: parent.vertPanningEnabled;
+
+ flickDeceleration: 2500;
+ //flickableDirection: Flickable.VerticalFlick
+
+ property bool contentIsReady: false
+ Rectangle {
+ id: boundsRecFront
+ color: "white"
+ width: webViewFront.html == "" ? articlePage.width : webViewFront.width*webViewFront.scale + 2*buffer
+ height: Math.max(articlePage.height,webViewFront.height*webViewFront.scale)
+
+ WebView {
+ id: webViewFront
+ anchors.horizontalCenter: parent.horizontalCenter
+ //url: flipItem.url;
+ preferredWidth: articlePage.width
+ //preferredHeight: articleView.height
+ //scale: 1.25;
+ transformOrigin: Item.TopLeft
+ //scale: slider.value;
+ settings.defaultFontSize: articlePage.webviewFontSize
+
+ onLoadFinished: {
+ flickableFront.contentX = buffer
+ controller.setEntryRead(articlePage.feedid, articlePage.mainArticleId)
+ //flickable.width/2
+ flickableFront.contentIsReady = true
+ }
+
+
+ }
+
+ }
+
+ state: "visible"
+
+ states: [ State {
+ name: "visible";
+ PropertyChanges { target: flickableFront; x: 0; }
+ }, State {
+ name: "toRight";
+ PropertyChanges { target: flickableFront; x: boundsRecBack.width; }
+ }, State {
+ name: "toLeft";
+ PropertyChanges { target: flickableFront; x: -boundsRecFront.width; }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "visible";
+ PropertyAnimation { target: flickableFront
+ easing.type: Easing.InOutSine
+ properties: "x"; duration: 1000 }
+ },
+ Transition {
+ to: "visible";
+ PropertyAnimation { target: flickableFront
+ easing.type: Easing.InOutSine
+ properties: "x"; duration: 1000 }
+ }
+ ]
+
+ function moveFromLeft() {
+ flickableFront.contentIsReady = false
+ articlePage.mainArticleId = controller.getPreviousId(articlePage.feedid,articlePage.mainArticleId)
+ webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
+ state = "toLeft"
+ state = "visible"
+ flickableBack.state = "toRight"
+ }
+
+ function moveFromRight() {
+ flickableFront.contentIsReady = false
+ articlePage.mainArticleId = controller.getNextId(articlePage.feedid,articlePage.mainArticleId)
+ webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
+ state = "toRight"
+ state = "visible"
+ flickableBack.state = "toLeft"
+ }
+
+ Behavior on contentX {
+ id: contentXBehavior
+ enabled: flickableFront.contentIsReady
+ NumberAnimation { duration: 200 }
+ }
+ onMovingHorizontallyChanged: {
+ if (!movingHorizontally && (!atXBeginning || !atXEnd)) {
+ flickableFront.contentX = buffer //flickable.width/2
+ }
+ }
+
+ onAtXBeginningChanged: {
+ if (atXBeginning && contentIsReady) {
+ flickableBack.moveFromLeft()
+ }
+ }