diff --git a/.epub/example/OEBPS/scripts/ipub.js b/.epub/example/OEBPS/scripts/ipub.js index 884b6aa..7dbe184 100644 --- a/.epub/example/OEBPS/scripts/ipub.js +++ b/.epub/example/OEBPS/scripts/ipub.js @@ -143,10 +143,14 @@ class IPUBImage extends IPUBElement { static elementName = "ipub-image"; } +class IPUBInteraction extends IPUBElement { + static elementName = "ipub-interaction"; +} + globalThis.addEventListener("load", () => { console.info("IPUB: STARTING DEFINITIONS"); - [IPUBBackground, IPUBContent, IPUBImage].forEach((e) => { + [IPUBBackground, IPUBContent, IPUBImage, IPUBInteraction].forEach((e) => { console.info(`IPUB: Defining custom element <${e.elementName}>`); globalThis.customElements.define(e.elementName, e); }); diff --git a/.epub/example/OEBPS/sections/section0001.xhtml b/.epub/example/OEBPS/sections/section0001.xhtml index 7696f03..e6358d7 100644 --- a/.epub/example/OEBPS/sections/section0001.xhtml +++ b/.epub/example/OEBPS/sections/section0001.xhtml @@ -16,55 +16,15 @@ + + + + + + -
- - - - - - - - Go to "Krita | Digital Paiting. Creative Freedom" - - - - Go to page "page03" - -
diff --git a/.epub/example/OEBPS/styles/stylesheet.css b/.epub/example/OEBPS/styles/stylesheet.css index 8aaa478..6c758bd 100644 --- a/.epub/example/OEBPS/styles/stylesheet.css +++ b/.epub/example/OEBPS/styles/stylesheet.css @@ -110,6 +110,43 @@ ipub-image { } } +ipub-interaction { + position: absolute; + + --ipub-x: 0px; + --ipub-y: 0px; + --ipub-size: 10%; + --ipub-width: var(--ipub-size, unset); + --ipub-height: unset; + --ipub-ratio: 1/1; + + left: var(--ipub-x); + top: var(--ipub-y); + + width: var(--ipub-width); + height: var(--ipub-height); + aspect-ratio: var(--ipub-ratio, unset); + transform: translate(var(--ipub-offset-x, -50%), var(--ipub-offset-y, -50%)); + + & > * { + display: block; + width: 100%; + height: 100%; + + border-radius: var(--ipub-radius, unset); + + /* + * The opacity would be, by default, zero. Here it is 0.3 for easier debugging and + * showing of the example ebook + */ + background-color: red; + opacity: 0.3; + } + &[circle] { + --ipub-radius: 100%; + } +} + [data-ipub-element="image"] { width: var(--ipub-width, unset); height: var(--ipub-height, unset);