Colibrio Reader Framework API - Cloud license
    Preparing search index...

    Interface IReaderViewVisibleContentExperimental

    Contains information about the content currently visible in the ReaderView.

    Obtain an instance using IReaderView.getVisibleContent.

    This API is experimental and might be subject to changes in future releases.

    interface IReaderViewVisibleContent {
        ongoingChanges: readonly VisibleContentChangeType[];
        getContentRectsContainedInArea(
            type: VisibleContentAreaType,
        ): IVisibleContentAreaRectsResult;
        getContentRectsIntersectingArea(
            type: VisibleContentAreaType,
        ): IVisibleContentAreaRectsResult;
        getResolvedAreaRect(type: VisibleContentAreaType): DOMRect;
        getSpecifiedAreaRect(type: VisibleContentAreaType): DOMRect;
    }

    Properties

    ongoingChanges: readonly VisibleContentChangeType[]

    The changes going on in the visible content in this snapshot, or an empty list when nothing is changing.

    While any change is ongoing, some or all rects in this snapshot may not match what is on screen. See VisibleContentChangeType for what each change means for the rects.

    The order of the changes is not specified.

    Methods

    • Experimental

      Get all content rects whose content is fully contained within the given named area.

      The content within a named area is determined by spatial containment, not by a contiguous document range. The result may therefore hold several continuous runs of content, even from the same ReaderDocument. This happens when the visual order of content differs from its order in the source document. IVisibleContentAreaRectsResult.ranges lists the runs.

      Note that the result's rects may be empty even if there is visible content, for example when the user has zoomed in far enough that no content rect fits entirely within the area. In such cases, getContentRectsIntersectingArea can be used instead to find content that partially overlaps with the area.

      Containment is tested against each rect's unclipped clientRect, so the result includes content that a publication element clips away. To drop the rects that clipping hides entirely, skip the rects whose IVisibleContentRect.clippedState is FULLY_CLIPPED.

      The contentLocation of a PARTIALLY_CLIPPED rect includes the text that the clipping element hides.

      Parameters

      Returns IVisibleContentAreaRectsResult

      The content rects fully contained within the area, grouped into runs, and every clipping element in this snapshot.

    • Experimental

      Get all IVisibleContentRect objects that spatially intersect with the given named area.

      A rect that only touches the area at an edge does not intersect it.

      The result may hold several continuous runs of content, listed in IVisibleContentAreaRectsResult.ranges, when non-contiguous document ranges fall within the area.

      Intersection is tested against each rect's unclipped clientRect, so the result includes content that a publication element clips away. To drop the rects that clipping hides entirely, skip the rects whose IVisibleContentRect.clippedState is FULLY_CLIPPED.

      The contentLocation of a PARTIALLY_CLIPPED rect includes the text that the clipping element hides.

      The clippedClientRect of a rect that is not FULLY_CLIPPED can extend partly or wholly outside the area. To get only the unclipped part inside the area, intersect clippedClientRect with the rect from getResolvedAreaRect.

      Parameters

      Returns IVisibleContentAreaRectsResult

      The content rects intersecting the area, grouped into runs, and every clipping element in this snapshot.

    • Experimental

      Get the rectangle describing a named area in the ReaderView after renderer specific rules have been resolved. Coordinates are in application viewport coordinate space.

      getContentRectsContainedInArea and getContentRectsIntersectingArea always test content against the resolved area rectangle.

      The resolved area rectangle may be different than the specified area rectangle. For example:

      • A paginated renderer showing spreads may only show a single page at the start and the end of the publication. The resolved area rect will reflect this.
      • The resolved Reading Area will grow in scrolling renderers when scrolled to the very start or end of the content in order to make sure that all content can fit in the Reading Area

      Parameters

      Returns DOMRect

      The rectangle describing the named area.

    • Experimental

      Get the rectangle describing a named area in the ReaderView, as specified by ReaderView options and Renderer options. Coordinates are in application viewport coordinate space.

      Parameters

      Returns DOMRect

      The rectangle describing the named area.