From 9e142313d6b7e7da45c410fb387640a770fcb15d Mon Sep 17 00:00:00 2001 From: Grant Echols Date: Tue, 11 Aug 2015 09:24:05 -0600 Subject: [PATCH] Added small checks around code to make m2 sample work locally. --- test/demo/m2/js/main.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/test/demo/m2/js/main.js b/test/demo/m2/js/main.js index dd3bc48f..da36c8ff 100644 --- a/test/demo/m2/js/main.js +++ b/test/demo/m2/js/main.js @@ -464,18 +464,22 @@ var page = this.pages[this.pageIndex]; var box = page.getBounds(); - this.highlight - .style('opacity', 1) - .attr("x", box.x) - .attr("width", box.width) - .attr("y", box.y) - .attr("height", box.height); + if (this.highlight) { + this.highlight + .style('opacity', 1) + .attr("x", box.x) + .attr("width", box.width) + .attr("y", box.y) + .attr("height", box.height); + } }, // ---------- updateHover: function(pageIndex) { if (pageIndex === -1 || this.mode !== 'thumbs') { - this.hover.style('opacity', 0); + if (this.hover) { + this.hover.style('opacity', 0); + } this.$scrollCover.css({ 'cursor': 'default' }); @@ -490,12 +494,14 @@ var page = this.pages[pageIndex]; var box = page.getBounds(); - this.hover - .style('opacity', 0.3) - .attr("x", box.x) - .attr("width", box.width) - .attr("y", box.y) - .attr("height", box.height); + if (this.hover) { + this.hover + .style('opacity', 0.3) + .attr("x", box.x) + .attr("width", box.width) + .attr("y", box.y) + .attr("height", box.height); + } }, // ----------