From 7cbd928f9517108e8594289c5cf2fbf10253a8ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20So=CC=88hnlein?= Date: Mon, 17 Aug 2015 10:46:14 +0200 Subject: [PATCH 1/2] Made flex mode working in IE10. --- src/angular-resizable.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/angular-resizable.js b/src/angular-resizable.js index e995fb1..6ca8a4c 100644 --- a/src/angular-resizable.js +++ b/src/angular-resizable.js @@ -26,7 +26,8 @@ angular.module('angularResizable', []) }, link: function(scope, element, attr) { var flexBasis = 'flexBasis' in document.documentElement.style ? 'flexBasis' : - 'webkitFlexBasis' in document.documentElement.style ? 'webkitFlexBasis' : 'flexBasis'; + 'webkitFlexBasis' in document.documentElement.style ? 'webkitFlexBasis' : + 'msFlexPreferredSize' in document.documentElement.style ? 'msFlexPreferredSize' : 'flexBasis'; // register watchers on width and height attributes if they are set scope.$watch('rWidth', function(value){ From f376a2432bde980ba0a3fb69ea46451f79c688bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20So=CC=88hnlein?= Date: Mon, 17 Aug 2015 10:53:36 +0200 Subject: [PATCH 2/2] Updated build. --- angular-resizable.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-resizable.min.js b/angular-resizable.min.js index a7a9eae..2dc3ccf 100644 --- a/angular-resizable.min.js +++ b/angular-resizable.min.js @@ -1 +1 @@ -angular.module("angularResizable",[]).directive("resizable",function(){function e(e){void 0===t?(t=e,setTimeout(function(){t(),t=void 0},100)):t=e}var t;return{restrict:"AE",scope:{rDirections:"=",rCenteredX:"=",rCenteredY:"=",rWidth:"=",rHeight:"=",rFlex:"=",rGrabber:"@",rDisabled:"@"},link:function(t,r,n){var i="flexBasis"in document.documentElement.style?"flexBasis":"webkitFlexBasis"in document.documentElement.style?"webkitFlexBasis":"flexBasis";t.$watch("rWidth",function(e){r[0].style.width=t.rWidth+"px"}),t.$watch("rHeight",function(e){r[0].style.height=t.rHeight+"px"}),r.addClass("resizable");var a,s,l,o,u,d=window.getComputedStyle(r[0],null),c=t.rDirections,h=t.rCenteredX?2:1,p=t.rCenteredY?2:1,m=t.rGrabber?t.rGrabber:"",g={},b=function(e){g.width=!1,g.height=!1,"x"===u?g.width=parseInt(r[0].style[t.rFlex?i:"width"]):g.height=parseInt(r[0].style[t.rFlex?i:"height"]),g.id=r[0].id,g.evt=e},v=function(n){var d,c="x"===u?l-n.clientX:l-n.clientY;switch(o){case"top":d=t.rFlex?i:"height",r[0].style[d]=s+c*p+"px";break;case"bottom":d=t.rFlex?i:"height",r[0].style[d]=s-c*p+"px";break;case"right":d=t.rFlex?i:"width",r[0].style[d]=a-c*h+"px";break;case"left":d=t.rFlex?i:"width",r[0].style[d]=a+c*h+"px"}b(n),e(function(){t.$emit("angular-resizable.resizing",g)})},f=function(e){b(),t.$emit("angular-resizable.resizeEnd",g),t.$apply(),document.removeEventListener("mouseup",f,!1),document.removeEventListener("mousemove",v,!1),r.removeClass("no-transition")},x=function(e,n){o=n,u="left"===o||"right"===o?"x":"y",l="x"===u?e.clientX:e.clientY,a=parseInt(d.getPropertyValue("width")),s=parseInt(d.getPropertyValue("height")),r.addClass("no-transition"),document.addEventListener("mouseup",f,!1),document.addEventListener("mousemove",v,!1),e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.cancelBubble=!0,e.returnValue=!1,b(e),t.$emit("angular-resizable.resizeStart",g),t.$apply()};c.forEach(function(e){var n=document.createElement("div");n.setAttribute("class","rg-"+e),n.innerHTML=m,r[0].appendChild(n),n.ondragstart=function(){return!1},n.addEventListener("mousedown",function(r){var n="true"===t.rDisabled;n||1!==r.which||x(r,e)},!1)})}}}); \ No newline at end of file +angular.module("angularResizable",[]).directive("resizable",function(){function e(e){void 0===t?(t=e,setTimeout(function(){t(),t=void 0},100)):t=e}var t;return{restrict:"AE",scope:{rDirections:"=",rCenteredX:"=",rCenteredY:"=",rWidth:"=",rHeight:"=",rFlex:"=",rGrabber:"@",rDisabled:"@"},link:function(t,r,n){var i="flexBasis"in document.documentElement.style?"flexBasis":"webkitFlexBasis"in document.documentElement.style?"webkitFlexBasis":"msFlexPreferredSize"in document.documentElement.style?"msFlexPreferredSize":"flexBasis";t.$watch("rWidth",function(e){r[0].style.width=t.rWidth+"px"}),t.$watch("rHeight",function(e){r[0].style.height=t.rHeight+"px"}),r.addClass("resizable");var a,s,l,o,d,u=window.getComputedStyle(r[0],null),c=t.rDirections,h=t.rCenteredX?2:1,m=t.rCenteredY?2:1,p=t.rGrabber?t.rGrabber:"",g={},f=function(e){g.width=!1,g.height=!1,"x"===d?g.width=parseInt(r[0].style[t.rFlex?i:"width"]):g.height=parseInt(r[0].style[t.rFlex?i:"height"]),g.id=r[0].id,g.evt=e},x=function(n){var u,c="x"===d?l-n.clientX:l-n.clientY;switch(o){case"top":u=t.rFlex?i:"height",r[0].style[u]=s+c*m+"px";break;case"bottom":u=t.rFlex?i:"height",r[0].style[u]=s-c*m+"px";break;case"right":u=t.rFlex?i:"width",r[0].style[u]=a-c*h+"px";break;case"left":u=t.rFlex?i:"width",r[0].style[u]=a+c*h+"px"}f(n),e(function(){t.$emit("angular-resizable.resizing",g)})},b=function(e){f(),t.$emit("angular-resizable.resizeEnd",g),t.$apply(),document.removeEventListener("mouseup",b,!1),document.removeEventListener("mousemove",x,!1),r.removeClass("no-transition")},v=function(e,n){o=n,d="left"===o||"right"===o?"x":"y",l="x"===d?e.clientX:e.clientY,a=parseInt(u.getPropertyValue("width")),s=parseInt(u.getPropertyValue("height")),r.addClass("no-transition"),document.addEventListener("mouseup",b,!1),document.addEventListener("mousemove",x,!1),e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.cancelBubble=!0,e.returnValue=!1,f(e),t.$emit("angular-resizable.resizeStart",g),t.$apply()};c.forEach(function(e){var n=document.createElement("div");n.setAttribute("class","rg-"+e),n.innerHTML=p,r[0].appendChild(n),n.ondragstart=function(){return!1},n.addEventListener("mousedown",function(r){var n="true"===t.rDisabled;n||1!==r.which||v(r,e)},!1)})}}}); \ No newline at end of file