diff --git a/src/main.styl b/src/main.styl index 5699d95c71..c424fb567a 100644 --- a/src/main.styl +++ b/src/main.styl @@ -32,7 +32,8 @@ height 100% pointer-events none &.active - pointer-events auto + > * + pointer-events auto .geo-tile-layer transform-origin 0px 0px diff --git a/src/sceneObject.js b/src/sceneObject.js index b62562a71f..eb9c3f4160 100644 --- a/src/sceneObject.js +++ b/src/sceneObject.js @@ -179,7 +179,7 @@ var sceneObject = function (arg) { */ this._exit = function () { m_children = []; - delete m_this.parent; + m_parent = null; s_exit(); }; diff --git a/tests/cases/annotation.js b/tests/cases/annotation.js index 07896f31cf..0c0cb20d95 100644 --- a/tests/cases/annotation.js +++ b/tests/cases/annotation.js @@ -151,6 +151,10 @@ describe('geo.annotation', function () { expect(ann.layer()).toBe(layer); }); it('state', function () { + map = createMap(); + layer = map.createLayer('annotation', { + annotations: geo.listAnnotations() + }); var ann = geo.annotation.annotation('test', {layer: layer}); map.geoOn(geo.event.annotation.state, function (evt) { stateEvent += 1; diff --git a/tests/cases/widget.js b/tests/cases/widget.js index 60e105aeec..63bbc8e9f1 100644 --- a/tests/cases/widget.js +++ b/tests/cases/widget.js @@ -249,4 +249,26 @@ describe('widget api', function () { domWidget._exit(); expect($(o.uiLayer.canvas()).children().length).toBe(widgetCount - 1); }); + it('widgets on two layers should both be clickable', function () { + var o = makeMap(), + offset = o.map.node().offset(), + uiLayer2 = o.map.createLayer('ui'), + clickCount = 0, clickCount2 = 0, + widget = o.uiLayer.createWidget('dom', { + position: {top: 0, left: 0, width: '20px', height: '20px'} + }), + widget2 = uiLayer2.createWidget('dom', { + position: {top: 0, left: 30, width: '20px', height: '20px'} + }); + $(widget.canvas()).on('click', function () { + clickCount += 1; + }); + $(widget2.canvas()).on('click', function () { + clickCount2 += 1; + }); + document.elementFromPoint(offset.left + 10, offset.top + 10).click(); + document.elementFromPoint(offset.left + 40, offset.top + 10).click(); + expect(clickCount).toBe(1); + expect(clickCount2).toBe(1); + }); });