/** * DOM utilities used internally. * Learned a lot from Leaflet.DomUtil * @class * @category core */ import Point from '../../geo/Point'; import Size from '../../geo/Size'; /** * Vendor-prefixed fransform style name (e.g. `'webkitTransform'` for WebKit). * @property {String} TRANSFORM */ export declare const TRANSFORM: string; /** * Vendor-prefixed tfransform-origin name (e.g. `'webkitTransformOrigin'` for WebKit). * @property {String} TRANSFORMORIGIN */ export declare const TRANSFORMORIGIN: string; /** * Vendor-prefixed transition name (e.g. `'WebkitTransition'` for WebKit). * @property {String} TRANSITION */ export declare const TRANSITION: string; /** * Vendor-prefixed filter name (e.g. `'WebkitFilter'` for WebKit). * @property {String} FILTER */ export declare const CSSFILTER: string; /** * Create a html element. * @param tagName * @param className * @returns */ export declare function createEl(tagName: string, className?: string): HTMLElement; /** * Create a html element on the specified container * @param tagName * @param style - css styles * @param container * @return */ export declare function createElOn(tagName: string, style: string, container: HTMLElement): HTMLElement; /** * Removes a html element. * @param node */ export declare function removeDomNode(node?: HTMLElement): any; /** * Adds a event listener to the dom element. * @param obj - dom element to listen on * @param typeArr - event types, seperated by space * @param handler - listener function * @param context - function context */ export declare function addDomEvent(obj: HTMLElement | Document, typeArr: string, handler: Function, context?: Object): any; /** * Removes event listener from a dom element * @param obj - dom element * @param typeArr - event types, separated by space * @param handler - listening function */ export declare function removeDomEvent(obj: HTMLElement | Document, typeArr: string, handler: Function): any; /** * Check if event type of the dom is listened by the handler * @param obj - dom element to check * @param typeArr - event * @param handler - the listening function * @return {Number} - the handler's index in the listener chain, returns -1 if not. */ export declare function listensDomEvent(obj: HTMLElement | Document, type: string, handler: Function): number; /** * Prevent default behavior of the browser.
* preventDefault Cancels the event if it is cancelable, without stopping further propagation of the event. * @param {Event} event - browser event */ export declare function preventDefault(event: Event): any; /** * Stop browser event propagation * @param e - browser event. */ export declare function stopPropagation(e: Event): any; export declare function preventSelection(dom: any): any; /** * Get the dom element's current position or offset its position by offset * @param dom - HTMLElement * @param offset - position to set. * @return dom element's current position if offset is null. */ export declare function offsetDom(dom: HTMLElement, offset?: Point): Point; /** * Compute dom's position * @param dom * @return */ export declare function computeDomPosition(dom: HTMLElement): number[]; /** * Get event's position from the top-left corner of the dom container * @param ev event * @return */ export declare function getEventContainerPoint(ev: MouseEvent | TouchEvent, dom: HTMLElement): Point; /** * set css style to the dom element * @param dom dom element * @param strCss css text */ export declare function setStyle(dom: HTMLElement, strCss: string): any; /** * Whether the dom has the given css class. * @param el HTML Element * @param name css class */ export declare function hasClass(el: HTMLElement, name: string): boolean; /** * add css class to dom element * @param el HTML Element * @param name css class */ export declare function addClass(el: HTMLElement, name: string): any; /** * Set dom's css class * @param el HTML Element * @param name css class */ export declare function setClass(el: HTMLElement, name: string): any; /** * Get dom's css class * @param name css class * @retrun class字符串 */ export declare function getClass(el: HTMLElement): string; export declare function setOpacity(el: HTMLElement, value: string): any; /** * Resets the 3D CSS transform of `el` so it is translated by `offset` pixels * @param el * @param offset */ export declare function setTransform(el: HTMLElement, offset: Point): any; export declare function setTransformMatrix(el: any, m: any): any; export declare function removeTransform(el: any): any; export declare function isHTML(str: string): boolean; export declare function measureDom(parentTag: any, dom: any): Size; export declare function getDomRuler(tag: any): any; /** * Alias for [addDomEvent]{@link DomUtil.addDomEvent} * @param {HTMLElement} obj - dom element to listen on * @param {String} typeArr - event types, seperated by space * @param {Function} handler - listener function * @param {Object} context - function context * @static * @function * @return {DomUtil} */ export declare const on: typeof addDomEvent; /** * Alias for [removeDomEvent]{@link DomUtil.removeDomEvent} * @param {HTMLElement} obj - dom element * @param {String} typeArr - event types, separated by space * @param {Function} handler - listening function * @static * @function * @return {DomUtil} */ export declare const off: typeof removeDomEvent; export declare function isMoveEvent(type?: string): boolean; export declare const MOUSEMOVE_THROTTLE_TIME = 48; export declare function isMousemoveEventBlocked(target: HTMLElement | any, mousemoveThrottleTime: number): boolean; //# sourceMappingURL=dom.d.ts.map