39 lines
1.0 KiB
HTML
39 lines
1.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<style>
|
|
img {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<img src="../resources/green-400x400.png"></img>
|
|
<script>
|
|
addEventListener("load", () => {
|
|
const image = document.querySelector("img");
|
|
internals.installImageOverlay(image, [
|
|
{
|
|
topLeft : new DOMPointReadOnly(0, 0),
|
|
topRight : new DOMPointReadOnly(1, 0),
|
|
bottomRight : new DOMPointReadOnly(1, 0.5),
|
|
bottomLeft : new DOMPointReadOnly(0, 0.5),
|
|
children: [
|
|
{
|
|
text : "hello",
|
|
topLeft : new DOMPointReadOnly(0, 0),
|
|
topRight : new DOMPointReadOnly(1, 0),
|
|
bottomRight : new DOMPointReadOnly(1, 0.5),
|
|
bottomLeft : new DOMPointReadOnly(0, 0.5),
|
|
}
|
|
],
|
|
}
|
|
]);
|
|
|
|
getSelection().selectAllChildren(internals.shadowRoot(image).querySelector(".image-overlay-text"));
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |