diff options
| author | pliablepixels <pliablepixels@gmail.com> | 2016-03-27 23:25:13 -0400 |
|---|---|---|
| committer | pliablepixels <pliablepixels@gmail.com> | 2016-03-27 23:25:13 -0400 |
| commit | 20c2cebd8c2408de22f74065a5d98d827ccba311 (patch) | |
| tree | 6a771bb7a95da3c0e2b9b79f44a0a65f80056204 /www/js | |
| parent | a6978ecc04f36575a57c43fa4078979bedb2dd67 (diff) | |
more packery tweaking
Former-commit-id: 5feb928a45c1dcb294f42053cc9149bd132e4ed9
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/MontageCtrl.js | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index 2179a347..6c26b124 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -354,12 +354,27 @@ function initPackery() $scope.saveReorder = function() { - console.log (">>>>>>>>>> SAVING"); + ZMDataModel.zmDebug ("Saving monitor hide/unhide and sizes"); $scope.MontageMonitors = $scope.copyMontage; $scope.modal.remove(); $timeout( function() {pckry.reloadItems();},400); $timeout( function() { + + draggies.forEach(function (drag) { + drag.destroy(); + }); + draggies = []; + + pckry.once( 'layoutComplete', function() { + console.log('Saving packery order now, layout rendered'); + $timeout(function() {var positions = pckry.getShiftPositions('data-item-id'); + ZMDataModel.zmDebug ("POSITIONS MAP " + JSON.stringify(positions)); + var ld = ZMDataModel.getLogin(); + ld.packeryPositions = JSON.stringify(positions); + ZMDataModel.setLogin(ld);}); + }); + pckry.getItemElements().forEach(function (itemElem) { draggie = new Draggabilly(itemElem); pckry.bindDraggabillyEvents(draggie); @@ -816,10 +831,17 @@ function initPackery() $scope.$on('$ionicView.afterEnter', function () { console.log("**VIEW ** Montage Ctrl AFTER ENTER"); + window.addEventListener("resize", orientationChanged, false); $timeout ( function () {initPackery(); },500); }); + function orientationChanged() + { + ZMDataModel.zmDebug ("Detected orientation change, redoing packery resize"); + $timeout(function(){pckry.onresize();}); + } + $scope.$on('$ionicView.beforeLeave', function () { // console.log("**VIEW ** Montage Ctrl Left, force removing modal"); @@ -827,6 +849,7 @@ function initPackery() console.log ("beforeLeave:Cancelling timer"); $interval.cancel($rootScope.intervalHandle); pckry.destroy(); + window.removeEventListener("resize", orientationChanged, false); // make sure this is applied in scope digest to stop network pull |
