diff options
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/ModalCtrl.js | 16 | ||||
| -rw-r--r-- | www/js/app.js | 36 |
2 files changed, 36 insertions, 16 deletions
diff --git a/www/js/ModalCtrl.js b/www/js/ModalCtrl.js index 5093f100..1e3a8e80 100644 --- a/www/js/ModalCtrl.js +++ b/www/js/ModalCtrl.js @@ -4,7 +4,7 @@ /* global saveAs, cordova,StatusBar,angular,console,ionic, moment */ -angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootScope', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$q', '$sce', 'stopOrPlay', function ($scope, $rootScope, zm, ZMDataModel, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $q, $sce, stopOrPlay) { +angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootScope', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$q', '$sce', 'carouselUtils', function ($scope, $rootScope, zm, ZMDataModel, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $q, $sce, carouselUtils) { // from parent scope @@ -616,23 +616,23 @@ angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootSco case "super": $scope.eventSpeed = 20/$scope.event.Event.Frames; - stopOrPlay.setDuration($scope.eventSpeed); + carouselUtils.setDuration($scope.eventSpeed); break; case "normal": $scope.eventSpeed = $scope.event.Event.Length/$scope.event.Event.Frames; //$scope.eventSpeed = 5; - stopOrPlay.setDuration($scope.eventSpeed); + carouselUtils.setDuration($scope.eventSpeed); break; case "faster": $scope.eventSpeed = $scope.eventSpeed / 2; if ($scope.eventSpeed <20/$scope.event.Event.Frames) $scope.eventSpeed = 10/$scope.event.Event.Frames; - stopOrPlay.setDuration($scope.eventSpeed); + carouselUtils.setDuration($scope.eventSpeed); break; case "slower": $scope.eventSpeed = $scope.eventSpeed * 2; - stopOrPlay.setDuration($scope.eventSpeed); + carouselUtils.setDuration($scope.eventSpeed); break; default: @@ -1064,7 +1064,7 @@ angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootSco { $scope.$watch('ionRange.index', function () { // - if (stopOrPlay.get() == true) + if (carouselUtils.getStop() == true) return; $scope.mycarousel.index = parseInt($scope.ionRange.index) - 1; // console.log ("***ION RANGE CHANGED TO " + $scope.mycarousel.index); @@ -1091,13 +1091,13 @@ angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootSco if (!$scope.modal || $scope.modal.isShown()==false) { console.log ("quick scrub playback over"); - stopOrPlay.set(true); + carouselUtils.setStop(true); $scope.ionRange.index = 0; $scope.mycarousel.index = 1; } } - if (stopOrPlay.get() == true) + if (carouselUtils.getStop() == true) return; $scope.ionRange.index = ($scope.mycarousel.index + 1).toString(); // console.log ("***IONRANGE RANGE CHANGED TO " + $scope.ionRange.index); diff --git a/www/js/app.js b/www/js/app.js index 1d81f958..d9df6594 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -1,6 +1,6 @@ /* jshint -W041 */ /* jslint browser: true*/ -/* global cordova,StatusBar,angular,console,alert,PushNotification, moment */ +/* global cordova,StatusBar,angular,console,alert,PushNotification, moment ,ionic */ var appVersion = "0.0.0"; @@ -135,8 +135,8 @@ angular.module('zmApp', [ // This directive is adapted from https://github.com/paveisistemas/ionic-image-lazy-load // I've removed lazyLoad and only made it show a spinner when an image is loading //-------------------------------------------------------------------------------------------- -.directive('imageSpinnerSrc', ['$document', '$compile', 'imageLoadingDataShare', - function ($document, $compile, imageLoadingDataShare) { +.directive('imageSpinnerSrc', ['$document', '$compile', 'imageLoadingDataShare', '$timeout', + function ($document, $compile, imageLoadingDataShare, $timeout) { return { restrict: 'A', scope: { @@ -164,22 +164,40 @@ angular.module('zmApp', [ $element.bind('error', function () { // console.log ("DIRECTIVE: IMAGE ERROR"); loader.remove(); - imageLoadingDataShare.set(0); + var url = 'img/novideo.png'; $element.prop('src', url); + imageLoadingDataShare.set(0); }); + + function waitForFrame1() + { + ionic.DomUtil.requestAnimationFrame ( + function () {imageLoadingDataShare.set(0); + //console.log ("IMAGE LOADED"); + }); + + } function loadImage() { $element.bind("load", function (e) { if ($attributes.imageSpinnerLoader) { - // console.log ("DIRECTIVE: IMAGE LOADED"); + //console.log ("DIRECTIVE: IMAGE LOADED"); loader.remove(); - imageLoadingDataShare.set(0); + //imageLoadingDataShare.set(0); + //console.log ("rendered"); + + // lets wait for 2 frames for animation + // to render - hoping this will improve tear + // of images + ionic.DomUtil.requestAnimationFrame ( + function () {waitForFrame1();}); + } }); - + if ($scope.imageSpinnerBackgroundImage == "true") { @@ -189,7 +207,9 @@ angular.module('zmApp', [ loader.remove(); } // set style attribute on element (it will load image) - $element[0].style.backgroundImage = 'url(' + $attributes.imageSpinnerSrc + ')'; + if (imageLoadingDataShare.get() != 1) + + $element[0].style.backgroundImage = 'url(' + $attributes.imageSpinnerSrc + ')'; }; bgImg.src = $attributes.imageSpinnerSrc; |
