How to use the @antv/dom-util.getHeight function in @antv/dom-util

To help you get started, we’ve selected a few @antv/dom-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / G2 / packages / component / src / tooltip / canvas.ts View on Github external
public setPosition(oldx: number, oldy: number, target?: any) {
    // todo
    let x = oldx;
    let y = oldy;
    const container = this.get('container');
    const outterNode = this.get('canvas').get('el');
    const viewWidth = domUtil.getWidth(outterNode);
    const viewHeight = domUtil.getHeight(outterNode);
    const bbox = container.getBBox();
    const containerWidth = bbox.width;
    const containerHeight = bbox.height;

    let endx = x;
    let endy = y;

    let position;
    if (this.get('position')) {
      position = defaultPosition(x, y, this.get('position'), containerWidth, containerHeight, target);
      x = position[0];
      y = position[1];
    } else {
      position = constraintPositionInBoundary(x, y, containerWidth, containerHeight, viewWidth, viewHeight);
      x = position[0];
      y = position[1];
github antvis / G2 / packages / component / src / tooltip / html.ts View on Github external
public setPosition(oldx: number, oldy: number, target?: any) {
    // todo any 是 Shape
    let x = oldx;
    let y = oldy;
    const container = this.get('container');
    const outterNode = this.get('canvas').get('el');
    const viewWidth = domUtil.getWidth(outterNode);
    const viewHeight = domUtil.getHeight(outterNode);
    let containerWidth = container.clientWidth;
    let containerHeight = container.clientHeight;

    let endx = x;
    let endy = y;

    let position;
    const prePosition = this.get('prePosition') || { x: 0, y: 0 };

    // @2019-01-30 by blue.lb 由于display:none的元素获取clientWidth和clientHeight的值为0,这里强制显隐一下,其实直接在show和hide中去掉display设置最好,猜测为了更好的兼容浏览器
    if (!containerWidth) {
      container.style.display = 'block';
      containerWidth = container.clientWidth;
      containerHeight = container.clientHeight;
      container.style.display = 'none';
    }