diff --git a/lib/kits/core/index.ts b/lib/kits/core/index.ts index 4b47f7aa..fa1078a0 100644 --- a/lib/kits/core/index.ts +++ b/lib/kits/core/index.ts @@ -198,7 +198,7 @@ export interface V2PageDecoration { y1: number; y2: number; rotate: number; - link_embed: boolean; + embed_link: string; link: string; }[] | null; diff --git a/lib/kits/paged-publication/bootstrapper.ts b/lib/kits/paged-publication/bootstrapper.ts index bd358f8d..fe4c20ae 100644 --- a/lib/kits/paged-publication/bootstrapper.ts +++ b/lib/kits/paged-publication/bootstrapper.ts @@ -51,7 +51,7 @@ export default class Bootstrapper { const pageDecorationHotspots: { id: string; type: string; - link_embed: boolean; + embed_link: string; link: string; rotate: number; locations: any; @@ -62,15 +62,15 @@ export default class Bootstrapper { pageDecorationHotspots.push({ id: `page${pageDecoration.page_number}-hotspot-${index}`, type: 'pagedecoration', - link_embed: hotspot.link_embed, + embed_link: hotspot.embed_link, link: hotspot.link, rotate: hotspot.rotate, locations: { [pageDecoration.page_number]: [ - [hotspot.x1, hotspot.y1], - [hotspot.x1, hotspot.y2], - [hotspot.x2, hotspot.y2], - [hotspot.x2, hotspot.y1] + [hotspot.x1 / 100, hotspot.y1 / 100], + [hotspot.x1 / 100, hotspot.y2 / 100], + [hotspot.x2 / 100, hotspot.y2 / 100], + [hotspot.x2 / 100, hotspot.y1 / 100] ] } }); diff --git a/lib/kits/paged-publication/hotspots.ts b/lib/kits/paged-publication/hotspots.ts index 9736eff6..f86334c9 100644 --- a/lib/kits/paged-publication/hotspots.ts +++ b/lib/kits/paged-publication/hotspots.ts @@ -38,6 +38,8 @@ function getPosition(pages: Page[], ratio: number, hotspot: V2Hotspot) { const width = maxX! - minX!; const height = maxY! - minY!; + ratio = hotspot.type === 'pagedecoration' ? 1 : ratio; + return { top: (minY! / ratio) * 100, left: minX! * 100, @@ -69,9 +71,9 @@ function renderHotspot(hotspot, position, contentRect, boundingRect) { if (hotspot.type === 'pagedecoration') { el.className += ' sgn-pagedecoration-hotspot'; - if (hotspot.link_embed) { - el.innerHTML = ``; - } else { + if (hotspot.embed_link) { + el.innerHTML = ``; + } else if (hotspot.link) { el.innerHTML = `