diff --git a/src/pixelmapLayer.js b/src/pixelmapLayer.js index cb4c17c823..230e23d41d 100644 --- a/src/pixelmapLayer.js +++ b/src/pixelmapLayer.js @@ -120,7 +120,9 @@ var pixelmapLayer = function (arg) { ['modified', 'geoOn', 'geoOff', 'geoOnce'].forEach((funcName) => { const superFunc = m_this[funcName]; m_this[funcName] = function () { - m_pixelmapFeature[funcName].apply(this, arguments); + if (!Array.isArray(arguments[0])) { + m_pixelmapFeature[funcName].apply(this, arguments); + } return superFunc.apply(this, arguments); }; }); diff --git a/tests/gl-cases/pixelmapLayer.js b/tests/gl-cases/pixelmapLayer.js index ed17d8d9ad..0d3cd42d94 100644 --- a/tests/gl-cases/pixelmapLayer.js +++ b/tests/gl-cases/pixelmapLayer.js @@ -89,6 +89,25 @@ describe('webglPixelmapLayer', function () { done(); }); }); + it('geoOn and geoOff from array', function (done) { + createPixelmap(); + var click = 0; + layer.geoOn([geo.event.feature.mouseclick], () => { + click += 1; + }); + // wait for the tiles to be available + map.onIdle(() => { + expect(click).toEqual(0); + map.interactor().simulateEvent('mousedown', {map: {x: 390, y: 200}}); + map.interactor().simulateEvent('mouseup', {map: {x: 390, y: 200}}); + expect(click).toEqual(1); + layer.geoOff([geo.event.feature.mouseclick]); + map.interactor().simulateEvent('mousedown', {map: {x: 390, y: 200}}); + map.interactor().simulateEvent('mouseup', {map: {x: 390, y: 200}}); + expect(click).toEqual(1); + done(); + }); + }); it('geospatial', function (done) { map = geo.map({node: '#map'}); layer = map.createLayer('pixelmap', {