From fa1a8b2dde7b68e9000ae4b93c8bda111e38a25d Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Thu, 16 May 2013 02:49:29 -0400 Subject: [PATCH 1/2] Fix Drawer event emission Drawer tries to emit events on the parent Viewer object but doesn't have a reference to it. Add a reference when constructing the Drawer. --- src/drawer.js | 1 + src/viewer.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/drawer.js b/src/drawer.js index 60a85890..72c932d5 100644 --- a/src/drawer.js +++ b/src/drawer.js @@ -94,6 +94,7 @@ $.Drawer = function( options ) { $.extend( true, this, { //internal state properties + viewer: null, downloading: 0, tilesMatrix: {}, tilesLoaded: [], diff --git a/src/viewer.js b/src/viewer.js index 8be9ec48..6eed9106 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1047,6 +1047,7 @@ function openTileSource( viewer, source ) { _this.source.overlays = _this.source.overlays || []; _this.drawer = new $.Drawer({ + viewer: _this, source: _this.source, viewport: _this.viewport, element: _this.canvas, From 771b5443da7268853aaf28e46b8912a478b9d8cc Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Fri, 17 May 2013 01:26:21 -0400 Subject: [PATCH 2/2] test: Drop workaround for broken Drawer event emission --- test/formats.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/formats.js b/test/formats.js index 23ef1cc4..3505975b 100644 --- a/test/formats.js +++ b/test/formats.js @@ -23,7 +23,6 @@ var openHandler = function(eventSender, eventData) { viewer.removeHandler('open', openHandler); ok(true, 'Open event was sent'); - viewer.drawer.viewer = viewer; viewer.addHandler('tile-drawn', tileDrawnHandler); };