diff --git a/src/plugins/vis_type_vega/public/vega_view/vega_base_view.d.ts b/src/plugins/vis_type_vega/public/vega_view/vega_base_view.d.ts index b0ccdbba021ed..8f5770500253f 100644 --- a/src/plugins/vis_type_vega/public/vega_view/vega_base_view.d.ts +++ b/src/plugins/vis_type_vega/public/vega_view/vega_base_view.d.ts @@ -34,6 +34,7 @@ export class VegaBaseView { destroy(): Promise; _$container: any; + _$controls: any; _parser: any; _vegaViewConfig: any; _serviceSettings: VegaViewParams['serviceSettings']; diff --git a/src/plugins/vis_type_vega/public/vega_view/vega_map_view/layers/vega_layer.test.ts b/src/plugins/vis_type_vega/public/vega_view/vega_map_view/layers/vega_layer.test.ts index da4c14c77bc98..53337388dc190 100644 --- a/src/plugins/vis_type_vega/public/vega_view/vega_map_view/layers/vega_layer.test.ts +++ b/src/plugins/vis_type_vega/public/vega_view/vega_map_view/layers/vega_layer.test.ts @@ -36,6 +36,7 @@ describe('vega_map_view/tms_raster_layer', () => { vegaView: ({ initialize: jest.fn(), } as unknown) as View, + vegaControls: 'element', updateVegaView: jest.fn(), }; }); diff --git a/src/plugins/vis_type_vega/public/vega_view/vega_map_view/layers/vega_layer.ts b/src/plugins/vis_type_vega/public/vega_view/vega_map_view/layers/vega_layer.ts index a3efba804b454..8972b80cb99c5 100644 --- a/src/plugins/vis_type_vega/public/vega_view/vega_map_view/layers/vega_layer.ts +++ b/src/plugins/vis_type_vega/public/vega_view/vega_map_view/layers/vega_layer.ts @@ -13,12 +13,13 @@ import type { LayerParameters } from './types'; export interface VegaLayerContext { vegaView: View; updateVegaView: (map: Map, view: View) => void; + vegaControls: any; } export function initVegaLayer({ id, map: mapInstance, - context: { vegaView, updateVegaView }, + context: { vegaView, vegaControls, updateVegaView }, }: LayerParameters) { const vegaLayer: CustomLayerInterface = { id, @@ -34,7 +35,7 @@ export function initVegaLayer({ vegaContainer.style.height = mapCanvas.style.height; mapContainer.appendChild(vegaContainer); - vegaView.initialize(vegaContainer); + vegaView.initialize(vegaContainer, vegaControls); }, render() { updateVegaView(mapInstance, vegaView); diff --git a/src/plugins/vis_type_vega/public/vega_view/vega_map_view/view.ts b/src/plugins/vis_type_vega/public/vega_view/vega_map_view/view.ts index b1ec79e6b8310..61ae1ce4e5d78 100644 --- a/src/plugins/vis_type_vega/public/vega_view/vega_map_view/view.ts +++ b/src/plugins/vis_type_vega/public/vega_view/vega_map_view/view.ts @@ -175,6 +175,7 @@ export class VegaMapView extends VegaBaseView { map: mapBoxInstance, context: { vegaView, + vegaControls: this._$controls.get(0), updateVegaView, }, });