All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.dominokit.domino.ui.popover.PopupPositionLeft Maven / Gradle / Ivy

There is a newer version: 1.0.139
Show newest version
package org.dominokit.domino.ui.popover;

import elemental2.dom.ClientRect;
import elemental2.dom.DomGlobal;
import elemental2.dom.HTMLElement;

import static elemental2.dom.DomGlobal.*;

public class PopupPositionLeft implements PopupPosition {
    @Override
    public void position(HTMLElement tooltip, HTMLElement target) {
        ClientRect targetRect = target.getBoundingClientRect();
        ClientRect tooltipRect = tooltip.getBoundingClientRect();
        tooltip.style.setProperty("top", (targetRect.top+ window.pageYOffset)+((targetRect.height-tooltipRect.height)/2)+"px");
        tooltip.style.setProperty("left", targetRect.left-window.pageXOffset-tooltipRect.width+"px");
    }

    @Override
    public String getDirectionClass() {
        return "left";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy