Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions l10n/es-ES/viewer.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ pdfjs-editor-comments-sidebar-no-comments-link = Saber más
pdfjs-editor-alt-text-button-label = Texto alternativo
pdfjs-editor-alt-text-edit-button =
.aria-label = Editar el texto alternativo
pdfjs-editor-alt-text-dialog-label = Eligir una opción
pdfjs-editor-alt-text-dialog-description = El texto alternativo (texto alternativo) ayuda cuando las personas no pueden ver la imagen o cuando no se carga.
pdfjs-editor-alt-text-dialog-label = Elegir una opción
pdfjs-editor-alt-text-dialog-description = El texto alternativo ayuda cuando las personas no pueden ver la imagen o cuando no se carga.
pdfjs-editor-alt-text-add-description-label = Añadir una descripción
pdfjs-editor-alt-text-add-description-description = Intente escribir 1 o 2 frases que describan el tema, el entorno o las acciones.
pdfjs-editor-alt-text-mark-decorative-label = Marcar como decorativa
Expand Down Expand Up @@ -698,7 +698,7 @@ pdfjs-views-manager-status-undo-cut-label =
pdfjs-views-manager-pages-status-undo-copy-label =
{ $count ->
[one] 1 página copiada
*[other] { $count } páginas cortadas
*[other] { $count } páginas copiadas
}
# Variables:
# $count (Number) - the number of selected pages to be deleted.
Expand All @@ -711,8 +711,8 @@ pdfjs-views-manager-pages-status-waiting-ready-label = Preparando su archivo…
pdfjs-views-manager-pages-status-waiting-uploading-label = Subiendo el archivo…
pdfjs-views-manager-status-warning-cut-label = No se pudo cortar. Refresque la página y pruebe de nuevo.
pdfjs-views-manager-status-warning-copy-label = No se pudo copiar. Refresque la página y pruebe de nuevo.
pdfjs-views-manager-status-warning-delete-label = No se pudo cortar. Refresque la página y pruebe de nuevo.
pdfjs-views-manager-status-warning-save-label = No se pudo cortar. Refresque la página y pruebe de nuevo.
pdfjs-views-manager-status-warning-delete-label = No se pudo eliminar. Refresque la página y pruebe de nuevo.
pdfjs-views-manager-status-warning-save-label = No se pudo guardar. Refresque la página y pruebe de nuevo.
pdfjs-views-manager-status-undo-button-label = Deshacer
pdfjs-views-manager-status-done-button-label = Hecho
pdfjs-views-manager-status-close-button =
Expand Down
5 changes: 5 additions & 0 deletions l10n/gn/viewer.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,11 @@ pdfjs-digital-signature-properties-button-label = Firma digital oguerekóva
## $count (Number) - number of signatures at the worst level.

pdfjs-digital-signature-properties-banner-verified = Pe kuatia oñemboheraguapy firma digital oikóvape
pdfjs-digital-signature-properties-banner-revoked =
{ $count ->
[one] Kuatia mboheraguapypyre { $count } mboajepyre oikove’ỹva ndive
*[other] Kuatia mboheraguapypyre { $count } mboajepyreita oikove’ỹva ndive
}

## Per-signature status row. Only three distinct strings are needed:
## the signature crypto either verified (the cert chain may still be
Expand Down
12 changes: 6 additions & 6 deletions l10n/it/viewer.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ pdfjs-thumb-page-title1 =
## Find panel button title and messages

pdfjs-find-input =
.title = Trova
.placeholder = Trova nel documento…
.title = Trova
pdfjs-find-previous-button =
.title = Trova l’occorrenza precedente del testo da cercare
pdfjs-find-previous-button-label = Precedente
Expand Down Expand Up @@ -331,16 +331,16 @@ pdfjs-editor-highlight-button =
.title = Evidenzia
pdfjs-editor-highlight-button-label = Evidenzia
pdfjs-highlight-floating-button1 =
.title = Evidenzia
.aria-label = Evidenzia
.title = Evidenzia
pdfjs-highlight-floating-button-label = Evidenzia
pdfjs-comment-floating-button =
.title = Commenta
.aria-label = Commenta
.title = Commenta
pdfjs-comment-floating-button-label = Commenta
pdfjs-editor-comment-button =
.title = Commenta
.aria-label = Commenta
.title = Commenta
pdfjs-editor-comment-button-label = Commenta
pdfjs-editor-signature-button =
.title = Aggiungi firma
Expand Down Expand Up @@ -413,8 +413,8 @@ pdfjs-editor-comments-sidebar-title =
*[other] Commenti
}
pdfjs-editor-comments-sidebar-close-button =
.title = Chiudi la barra laterale
.aria-label = Chiudi la barra laterale
.title = Chiudi la barra laterale
pdfjs-editor-comments-sidebar-close-button-label = Chiudi la barra laterale
# Instructional copy to add a comment by selecting text or an annotations.
pdfjs-editor-comments-sidebar-no-comments1 = Hai notato qualcosa di interessante? Evidenzialo e aggiungi un commento.
Expand Down Expand Up @@ -756,8 +756,8 @@ pdfjs-toggle-views-manager-button1 =
## Digital signature properties (signature verification panel)

pdfjs-digital-signature-properties-button =
.title = Proprietà firma digitale
.aria-label = Proprietà firma digitale
.title = Proprietà firma digitale
pdfjs-digital-signature-properties-button-label = Proprietà firma digitale

## Banner shown above the signature list summarising the overall
Expand Down
7 changes: 4 additions & 3 deletions l10n/lv/viewer.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,13 @@ pdfjs-find-previous-button-label = Iepriekšējā
pdfjs-find-next-button =
.title = Atrast nākamo
pdfjs-find-next-button-label = Nākamā
pdfjs-find-highlight-checkbox = Iekrāsot visas
pdfjs-find-match-case-checkbox-label = Lielo, mazo burtu jutīgs
pdfjs-find-highlight-checkbox = Izcelt visus
pdfjs-find-match-case-checkbox-label = Lielo un mazo burtu atbilstība
pdfjs-find-match-diacritics-checkbox-label = Diakritisko zīmju atbilstība
pdfjs-find-entire-word-checkbox-label = Veselus vārdus
pdfjs-find-reached-top = Sasniegts dokumenta sākums, turpinām no beigām
pdfjs-find-reached-bottom = Sasniegtas dokumenta beigas, turpinām no sākuma
pdfjs-find-not-found = Frāze nav atrasta
pdfjs-find-not-found = Vārdkopa nav atrasta

## Predefined zoom values

Expand Down
57 changes: 55 additions & 2 deletions src/display/touch_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ class TouchManager {

#touchMoveAC = null;

#unconfirmedPinch = 0;

/**
* @param {TouchManagerOptions} options
*/
Expand Down Expand Up @@ -127,6 +129,18 @@ class TouchManager {
return 35 / OutputScale.pixelRatio;
}

/**
* Once pinching, the span must change by at least 4 device pixels to update
* the scale: below that it's contact jitter (a moving finger is reported
* with a slight lag and its position is quantized), not an intentional
* pinch, hence a two-finger pan doesn't make the zoom drift.
*
* NOTE: Don't shadow this value since `devicePixelRatio` may change.
*/
get MIN_TOUCH_DISTANCE_TO_SCALE() {
return 4 / OutputScale.pixelRatio;
}

#onTouchStart(evt) {
if (this.#isPinchingDisabled?.()) {
return;
Expand Down Expand Up @@ -281,6 +295,9 @@ class TouchManager {
// Distances use screen coordinates; zoom and scrolling use client ones.
panX: (touch0.clientX + touch1.clientX) / 2,
panY: (touch0.clientY + touch1.clientY) / 2,
// Screen-coordinate midpoint used by the sampling allowance.
screenPanX: (touch0.screenX + touch1.screenX) / 2,
screenPanY: (touch0.screenY + touch1.screenY) / 2,
};
}

Expand Down Expand Up @@ -330,13 +347,28 @@ class TouchManager {
const dx = panX - pPanX;
const dy = panY - pPanY;

// Measure midpoint motion in the same coordinates as the span.
const screenPanX = (screen0X + screen1X) / 2;
const screenPanY = (screen0Y + screen1Y) / 2;
const translation = Math.hypot(
screenPanX - touchInfo.screenPanX,
screenPanY - touchInfo.screenPanY
);
touchInfo.screenPanX = screenPanX;
touchInfo.screenPanY = screenPanY;

const distance = Math.hypot(currGapX, currGapY);
const pDistance = Math.hypot(prevGapX, prevGapY);
// Before pinching, moving one contact by d moves the midpoint by d / 2 and
// changes the span by at most d. Add that sampling allowance to the
// threshold.
const minDistance = this.#isPinching
? this.MIN_TOUCH_DISTANCE_TO_SCALE
: this.MIN_TOUCH_DISTANCE_TO_PINCH + 2 * translation;
if (
distance < MIN_TOUCH_SPAN ||
pDistance < MIN_TOUCH_SPAN ||
(!this.#isPinching &&
Math.abs(pDistance - distance) <= this.MIN_TOUCH_DISTANCE_TO_PINCH)
Math.abs(pDistance - distance) <= minDistance
) {
// Keep the distance baseline so a slow pinch can cross the threshold, or
// a degenerate span recover, but the midpoint still moved.
Expand All @@ -351,9 +383,12 @@ class TouchManager {
touchInfo.touch1X = screen1X;
touchInfo.touch1Y = screen1Y;

const direction = Math.sign(distance - pDistance);

if (!this.#isPinching) {
// Start pinching.
this.#isPinching = true;
this.#unconfirmedPinch = direction;

// Skip the first scale update, as before, but keep its translation.
if (dx || dy) {
Expand All @@ -362,6 +397,23 @@ class TouchManager {
return;
}

if (this.#unconfirmedPinch) {
const unconfirmed = this.#unconfirmedPinch;
this.#unconfirmedPinch = 0;
if (
direction !== unconfirmed &&
Math.abs(distance - pDistance) <= 2 * translation
) {
// This reversal matches a lagging contact catching up: its span change
// is at most twice the midpoint movement. Discard the tentative pinch.
this.#isPinching = false;
if (dx || dy) {
this.#onPanning?.(dx, dy);
}
return;
}
}

// The distances are in screen CSS pixels, but the origin must be in client
// coordinates, like the one coming from a wheel event.
// Zoom around the previous midpoint and apply its movement in the same
Expand Down Expand Up @@ -399,6 +451,7 @@ class TouchManager {
// `#setTouchInfo` may already have cleared the baseline.
this.#touchInfo = null;
this.#isPinching = false;
this.#unconfirmedPinch = 0;
this.#ownsGesture = false;
if (this.#touchMoveAC) {
this.#touchMoveAC.abort();
Expand Down
Loading
Loading