"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=require("../../constants.js");exports.useDrawEventHandlers=function(a,t){var r=e.useRef({create:null,update:null,delete:null,modeChange:null,selectionChange:null}),l=e.useCallback((function(e){var t=e.map.getMap();r.current.create=function(e){a.onDrawCreate(e)},r.current.update=function(e){a.onDrawUpdate(e)},r.current.delete=function(){a.onDrawDelete()},r.current.modeChange=function(e){a.onModeChange(e)},r.current.selectionChange=function(e){a.onSelectionChange(e)},t.on("draw.create",r.current.create),t.on("draw.update",r.current.update),t.on("draw.delete",r.current.delete),t.on("draw.modechange",r.current.modeChange),t.on("draw.selectionchange",r.current.selectionChange),t.once("idle",(function(){null!=t&&t.getLayer(n.MapConfig.LayerIds.Wells)&&t.moveLayer(n.MapConfig.LayerIds.Wells)}))}),[a]),o=e.useCallback((function(e){var n=e.map.getMap(),a=r.current;a.create&&n.off("draw.create",a.create),a.update&&n.off("draw.update",a.update),a.delete&&n.off("draw.delete",a.delete),a.modeChange&&n.off("draw.modechange",a.modeChange),a.selectionChange&&n.off("draw.selectionchange",a.selectionChange),r.current={create:null,update:null,delete:null,modeChange:null,selectionChange:null},t.current=null}),[t]);return{handlersRef:r,onAdd:l,onRemove:o}};
//# sourceMappingURL=useDrawEventHandlers.js.map
