Commit f8f24706 authored by Robert Knight's avatar Robert Knight

Add a couple of notes in comments

These address a couple of issues raised in code review.
parent 1f6ea342
...@@ -322,6 +322,8 @@ export function location(annotation) { ...@@ -322,6 +322,8 @@ export function location(annotation) {
let cfi; let cfi;
let position; let position;
// nb. We ignore the possibility of an annotation having multiple targets here.
// h and the client only support one.
for (const selector of targets[0]?.selector ?? []) { for (const selector of targets[0]?.selector ?? []) {
if (selector.type === 'TextPositionSelector') { if (selector.type === 'TextPositionSelector') {
position = selector.start; position = selector.start;
......
...@@ -96,6 +96,7 @@ export const sorters = { ...@@ -96,6 +96,7 @@ export const sorters = {
if (aLocation.cfi && bLocation.cfi) { if (aLocation.cfi && bLocation.cfi) {
const cfiResult = compareCFIs(aLocation.cfi, bLocation.cfi); const cfiResult = compareCFIs(aLocation.cfi, bLocation.cfi);
if (cfiResult !== 0) { if (cfiResult !== 0) {
// Annotations are in different chapters.
return Math.sign(cfiResult); return Math.sign(cfiResult);
} }
} else if (aLocation.cfi) { } else if (aLocation.cfi) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment