42 lines
1023 B
Java
42 lines
1023 B
Java
package org.openautonomousconnection.luascript.hosts;
|
|
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* Layout and scrolling related accessors.
|
|
*
|
|
* <p>All results are plain maps to keep dependencies minimal.</p>
|
|
*/
|
|
public interface GeometryHost {
|
|
|
|
/**
|
|
* Returns bounding client rect of an element.
|
|
*
|
|
* @param elementId element id
|
|
* @return map: x,y,width,height,top,left,right,bottom
|
|
*/
|
|
Map<String, Object> getBoundingClientRect(String elementId);
|
|
|
|
/**
|
|
* Returns viewport metrics.
|
|
*
|
|
* @return map: width,height,devicePixelRatio,scrollX,scrollY
|
|
*/
|
|
Map<String, Object> getViewport();
|
|
|
|
/**
|
|
* Scrolls the document to coordinates.
|
|
*
|
|
* @param x scroll x
|
|
* @param y scroll y
|
|
*/
|
|
void scrollTo(double x, double y);
|
|
|
|
/**
|
|
* Scrolls an element into view.
|
|
*
|
|
* @param elementId element id
|
|
* @param align one of: "start","center","end","nearest" (null => "nearest")
|
|
*/
|
|
void scrollIntoView(String elementId, String align);
|
|
} |