Переглянути джерело

optimize mousemove listener. fixes #1328

Igor Vaynberg 12 роки тому
батько
коміт
70f1b29882
1 змінених файлів з 3 додано та 2 видалено
  1. 3 2
      select2.js

+ 3 - 2
select2.js

@@ -47,7 +47,7 @@ the specific language governing permissions and limitations under the Apache Lic
     }
 
     var KEY, AbstractSelect2, SingleSelect2, MultiSelect2, nextUid, sizer,
-        lastMousePosition, $document, scrollBarDimensions,
+        lastMousePosition={x:0,y:0}, $document, scrollBarDimensions,
 
     KEY = {
         TAB: 9,
@@ -172,7 +172,8 @@ the specific language governing permissions and limitations under the Apache Lic
     }
 
     $document.on("mousemove", function (e) {
-        lastMousePosition = {x: e.pageX, y: e.pageY};
+        lastMousePosition.x = e.pageX;
+        lastMousePosition.y = e.pageY;
     });
 
     /**