From d482e14b6dbd2fc8cccf0ee49de851850b3ce026 Mon Sep 17 00:00:00 2001 From: Chris Soh Date: Mon, 22 Jan 2018 12:28:26 +0100 Subject: [PATCH 1/2] Cleanup jQuery event shorthand methods Removed usage of jQuery event shorthand method since it is marked as deprecated in 3.3.1 onward and will be removed from slim builds eventually --- src/interact.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/interact.js b/src/interact.js index 25b338f..56734ec 100644 --- a/src/interact.js +++ b/src/interact.js @@ -24,9 +24,9 @@ var $canvas = $(canvas.canvas); this.canvas = canvas; this.$canvas = $canvas; - $canvas.mouseenter($.proxy(this.mouseenter, this)); - $canvas.mouseleave($.proxy(this.mouseleave, this)); - $canvas.click($.proxy(this.mouseclick, this)); + $canvas.on('mouseenter', $.proxy(this.mouseenter, this)); + $canvas.on('mouseleave', $.proxy(this.mouseleave, this)); + $canvas.on('click', $.proxy(this.mouseclick, this)); }, reset: function (removeTooltip) { From fb86aa4a857cb5733670e3a182080dc407806b0a Mon Sep 17 00:00:00 2001 From: Chris Soh Date: Mon, 22 Jan 2018 13:33:55 +0100 Subject: [PATCH 2/2] Cleanup jQuery proxy Removed usage of jQuery proxy since it is marked as deprecated in 3.3.1 onward and will be removed from slim builds eventually --- src/interact.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/interact.js b/src/interact.js index 56734ec..2f2d7a8 100644 --- a/src/interact.js +++ b/src/interact.js @@ -24,9 +24,9 @@ var $canvas = $(canvas.canvas); this.canvas = canvas; this.$canvas = $canvas; - $canvas.on('mouseenter', $.proxy(this.mouseenter, this)); - $canvas.on('mouseleave', $.proxy(this.mouseleave, this)); - $canvas.on('click', $.proxy(this.mouseclick, this)); + $canvas.on('mouseenter', this.mouseenter.bind(this)); + $canvas.on('mouseleave', this.mouseleave.bind(this)); + $canvas.on('click', this.mouseclick.bind(this)); }, reset: function (removeTooltip) { @@ -46,7 +46,7 @@ mouseenter: function (e) { $(document.body).unbind('mousemove.jqs'); - $(document.body).bind('mousemove.jqs', $.proxy(this.mousemove, this)); + $(document.body).bind('mousemove.jqs', this.mousemove.bind(this)); this.over = true; this.currentPageX = e.pageX; this.currentPageY = e.pageY; @@ -166,7 +166,7 @@ this.offsetTop = offset.top; this.hidden = true; $(window).unbind('resize.jqs scroll.jqs'); - $(window).bind('resize.jqs scroll.jqs', $.proxy(this.updateWindowDims, this)); + $(window).bind('resize.jqs scroll.jqs', this.updateWindowDims.bind(this)); this.updateWindowDims(); },