Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequence web component #191

Closed
stephenwf opened this issue Aug 3, 2022 · 0 comments
Closed

Sequence web component #191

stephenwf opened this issue Aug 3, 2022 · 0 comments
Milestone

Comments

@stephenwf
Copy link
Member

stephenwf commented Aug 3, 2022

Using the work from:
IIIF-Commons/iiif-helpers#6

This component would act similarly to <canvas-panel /> but instead of working with individual canvases, it would work with a sequence.

<canvas-sequence id="seq" manifest="https://.." sequence-index="0" />

<script>
  const $seq = document.getElementById('seq');

  const availableSequences = await $seq.getFullSequence();
  // [ 
  //    [ { id: 'https://.../canvas-0' } ], 
  //    [  id: 'https://.../canvas-1' },  id: 'https://.../canvas-2' } ], 
  //    [  id: 'https://.../canvas-3' },  id: 'https://.../canvas-4' } ], 
  //    ....
  // ]
  
  const currentSeq = await $seq.getCurrentSequence();
  const canvases = $seq.vault.get(currentSeq); // resolves full canvases to grab labels/metadata for visible canvases

  $seq.setAttribute('sequence-index', "1"); // Manually change sequence index (so show canvas-1 and canvas-2)
  $seq.setSequenceIndex(1); // Alternative API
  $seq.setCanvasId('https://../canvas-3'); // Finds the correct in sequence, switches to that
  $seq.nextInSequence(); // Go to next "page"
  $seq.previousInSequence(); // Go to previous "page"
</script>

This would enable canvas panel to support the following:

  • Scroll-like manifests (with continuous in the manifest)
  • Book reading (with paged in manifest)

Things to consider:

  • Layout options
  • Additional events?
  • Existing APIs that are geared towards single canvases
@stephenwf stephenwf added this to the v1.0 milestone Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant