Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

fix(DragAndResize): Prevent UI flicker when dragging and resizing eve…

…nts. Closes #209
  • Loading branch information...
Matt Lewis
Matt Lewis committed Nov 23, 2015
1 parent aa7bcba commit 38c2d291ba41e4f9e07015877ee3994e0dab2951
Showing with 18 additions and 14 deletions.
  1. +7 −5 src/directives/mwlDraggable.js
  2. +11 −9 src/directives/mwlResizable.js
@@ -4,7 +4,7 @@ var angular = require('angular');

angular
.module('mwl.calendar')
.controller('MwlDraggableCtrl', function($element, $scope, $window, $parse, $attrs, interact) {
.controller('MwlDraggableCtrl', function($element, $scope, $window, $parse, $attrs, $timeout, interact) {

if (!interact) {
return;
@@ -108,10 +108,12 @@ angular
$scope.$apply();
}

translateElement(elm, '')
.removeAttr('data-x')
.removeAttr('data-y')
.removeClass('dragging-active');
$timeout(function() {
translateElement(elm, '')
.removeAttr('data-x')
.removeAttr('data-y')
.removeClass('dragging-active');
});
}

}
@@ -4,7 +4,7 @@ var angular = require('angular');

angular
.module('mwl.calendar')
.controller('MwlResizableCtrl', function($element, $scope, $parse, $attrs, interact) {
.controller('MwlResizableCtrl', function($element, $scope, $parse, $attrs, $timeout, interact) {

if (!interact) {
return;
@@ -102,14 +102,16 @@ angular
var elm = angular.element(event.target);
var unitsResized = getUnitsResized(resizeEdge, elm, snapGridDimensions);

elm
.data('x', null)
.data('y', null)
.css({
transform: '',
width: originalDimensionsStyle.width,
height: originalDimensionsStyle.height
});
$timeout(function() {
elm
.data('x', null)
.data('y', null)
.css({
transform: '',
width: originalDimensionsStyle.width,
height: originalDimensionsStyle.height
});
});

if ($attrs.onResizeEnd) {
$parse($attrs.onResizeEnd)($scope, unitsResized);

0 comments on commit 38c2d29

Please sign in to comment.
You can’t perform that action at this time.