2014-02-26 20:09:37 +00:00
|
|
|
|
/*
|
|
|
|
|
* This file is part of the MediaWiki extension MediaViewer.
|
|
|
|
|
*
|
|
|
|
|
* MediaViewer is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* MediaViewer is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with MediaViewer. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2023-05-19 20:26:45 +00:00
|
|
|
|
const { HtmlUtils } = require( 'mmv.bootstrap' );
|
|
|
|
|
const ThumbnailWidthCalculator = require( '../mmv.ThumbnailWidthCalculator.js' );
|
|
|
|
|
const UiElement = require( './mmv.ui.js' );
|
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* UI component that contains the multimedia element to be displayed.
|
|
|
|
|
* This first version assumes an image but it can be extended to other
|
|
|
|
|
* media types (video, sound, presentation, etc.).
|
|
|
|
|
*/
|
|
|
|
|
class Canvas extends UiElement {
|
2014-02-26 20:09:37 +00:00
|
|
|
|
/**
|
2024-05-21 20:12:08 +00:00
|
|
|
|
* @param {jQuery} $container Canvas' container
|
|
|
|
|
* @param {jQuery} $imageWrapper
|
|
|
|
|
* @param {jQuery} $mainWrapper
|
2014-02-26 20:09:37 +00:00
|
|
|
|
*/
|
2024-05-21 20:12:08 +00:00
|
|
|
|
constructor( $container, $imageWrapper, $mainWrapper ) {
|
|
|
|
|
super( $container );
|
|
|
|
|
|
2014-02-26 20:09:37 +00:00
|
|
|
|
/**
|
2024-05-21 20:12:08 +00:00
|
|
|
|
* @property {boolean}
|
|
|
|
|
* @private
|
2014-02-26 20:09:37 +00:00
|
|
|
|
*/
|
2024-05-21 20:12:08 +00:00
|
|
|
|
this.dialogOpen = false;
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2024-05-21 20:12:08 +00:00
|
|
|
|
* @property {ThumbnailWidthCalculator}
|
|
|
|
|
* @private
|
2014-02-26 20:09:37 +00:00
|
|
|
|
*/
|
2024-05-21 20:12:08 +00:00
|
|
|
|
this.thumbnailWidthCalculator = new ThumbnailWidthCalculator();
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2024-05-21 20:12:08 +00:00
|
|
|
|
* Contains image.
|
2020-06-26 10:21:04 +00:00
|
|
|
|
*
|
2024-05-21 20:12:08 +00:00
|
|
|
|
* @property {jQuery}
|
2014-02-26 20:09:37 +00:00
|
|
|
|
*/
|
2024-05-21 20:12:08 +00:00
|
|
|
|
this.$imageDiv = $( '<div>' )
|
|
|
|
|
.addClass( 'mw-mmv-image' );
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
this.$imageDiv.appendTo( this.$container );
|
2023-05-20 12:38:59 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* Container of canvas and controls, needed for canvas size calculations.
|
|
|
|
|
*
|
|
|
|
|
* @property {jQuery}
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
this.$imageWrapper = $imageWrapper;
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2024-05-21 20:12:08 +00:00
|
|
|
|
* Main container of image and metadata, needed to propagate events.
|
2020-06-26 10:21:04 +00:00
|
|
|
|
*
|
2024-05-21 20:12:08 +00:00
|
|
|
|
* @property {jQuery}
|
|
|
|
|
* @private
|
2014-02-26 20:09:37 +00:00
|
|
|
|
*/
|
2024-05-21 20:12:08 +00:00
|
|
|
|
this.$mainWrapper = $mainWrapper;
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* Raw metadata of current image, needed for canvas size calculations.
|
|
|
|
|
*
|
|
|
|
|
* @property {LightboxImage}
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
this.imageRawMetadata = null;
|
|
|
|
|
}
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* Clears everything.
|
|
|
|
|
*/
|
|
|
|
|
empty() {
|
|
|
|
|
this.$imageDiv.addClass( 'empty' ).removeClass( 'error' );
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
this.$imageDiv.empty();
|
|
|
|
|
}
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* Sets image on the canvas; does not resize it to fit. This is used to make the placeholder
|
|
|
|
|
* image available; it will be resized and displayed by #maybeDisplayPlaceholder().
|
|
|
|
|
* FIXME maybeDisplayPlaceholder() receives the placeholder so it is very unclear why this
|
|
|
|
|
* is necessary at all (apart from setting the LightboxImage, which is used in size calculations).
|
|
|
|
|
*
|
|
|
|
|
* @param {LightboxImage} imageRawMetadata
|
|
|
|
|
* @param {jQuery} $imageElement
|
|
|
|
|
*/
|
|
|
|
|
set( imageRawMetadata, $imageElement ) {
|
|
|
|
|
this.$imageDiv.removeClass( 'empty' );
|
|
|
|
|
|
|
|
|
|
this.imageRawMetadata = imageRawMetadata;
|
|
|
|
|
this.$image = $imageElement;
|
|
|
|
|
this.setUpImageClick();
|
|
|
|
|
|
|
|
|
|
this.$imageDiv.html( this.$image );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Resizes image to the given dimensions and displays it on the canvas.
|
|
|
|
|
* This is used to display the actual image; it assumes set function was already called before.
|
|
|
|
|
*
|
|
|
|
|
* @param {Thumbnail} thumbnail thumbnail information
|
|
|
|
|
* @param {HTMLImageElement} imageElement
|
|
|
|
|
* @param {ThumbnailWidth} imageWidths
|
|
|
|
|
*/
|
|
|
|
|
setImageAndMaxDimensions( thumbnail, imageElement, imageWidths ) {
|
|
|
|
|
const $image = $( imageElement );
|
|
|
|
|
|
|
|
|
|
// we downscale larger images but do not scale up smaller ones, that would look ugly
|
|
|
|
|
if ( thumbnail.width > imageWidths.cssWidth ) {
|
|
|
|
|
imageElement.width = imageWidths.cssWidth;
|
|
|
|
|
imageElement.height = imageWidths.cssHeight;
|
2014-03-04 01:58:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
if ( !this.$image.is( imageElement ) ) { // http://bugs.jquery.com/ticket/4087
|
|
|
|
|
this.$image.replaceWith( $image );
|
|
|
|
|
this.$image = $image;
|
2014-09-04 21:50:14 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
// Since the image element got replaced, we need to rescue the dialog-open class.
|
2014-09-24 23:19:03 +00:00
|
|
|
|
this.$image.toggleClass( 'mw-mmv-dialog-is-open', this.dialogOpen );
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
this.setUpImageClick();
|
2014-09-19 18:34:18 +00:00
|
|
|
|
}
|
2024-05-21 20:12:08 +00:00
|
|
|
|
}
|
2014-09-12 18:05:13 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* Handles a "dialog open/close" event from dialogs on the page.
|
|
|
|
|
*
|
|
|
|
|
* @param {jQuery.Event} e
|
|
|
|
|
*/
|
|
|
|
|
handleDialogEvent( e ) {
|
|
|
|
|
switch ( e.type ) {
|
|
|
|
|
case 'mmv-download-opened':
|
|
|
|
|
this.downloadOpen = true;
|
|
|
|
|
break;
|
|
|
|
|
case 'mmv-download-closed':
|
|
|
|
|
this.downloadOpen = false;
|
|
|
|
|
break;
|
|
|
|
|
case 'mmv-reuse-opened':
|
|
|
|
|
this.reuseOpen = true;
|
|
|
|
|
break;
|
|
|
|
|
case 'mmv-reuse-closed':
|
|
|
|
|
this.reuseOpen = false;
|
|
|
|
|
break;
|
|
|
|
|
case 'mmv-options-opened':
|
|
|
|
|
this.optionsOpen = true;
|
|
|
|
|
break;
|
|
|
|
|
case 'mmv-options-closed':
|
|
|
|
|
this.optionsOpen = false;
|
|
|
|
|
break;
|
2023-05-20 12:38:59 +00:00
|
|
|
|
}
|
2015-01-01 02:24:32 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
this.dialogOpen = this.reuseOpen || this.downloadOpen || this.optionsOpen;
|
|
|
|
|
this.$image.toggleClass( 'mw-mmv-dialog-is-open', this.dialogOpen );
|
|
|
|
|
}
|
2014-09-04 21:50:14 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* Registers click listener on the image.
|
|
|
|
|
*
|
|
|
|
|
* @fires ReuseDialog#mmv-reuse-opened
|
|
|
|
|
* @fires ReuseDialog#mmv-reuse-closed
|
|
|
|
|
* @fires DownloadDialog#mmv-download-opened
|
|
|
|
|
* @fires DownloadDialog#mmv-download-closed
|
|
|
|
|
* @fires OptionsDialog#mmv-options-opened
|
|
|
|
|
* @fires OptionsDialog#mmv-options-closed
|
|
|
|
|
*/
|
|
|
|
|
setUpImageClick() {
|
|
|
|
|
this.handleEvent( 'mmv-reuse-opened', this.handleDialogEvent.bind( this ) );
|
|
|
|
|
this.handleEvent( 'mmv-reuse-closed', this.handleDialogEvent.bind( this ) );
|
|
|
|
|
this.handleEvent( 'mmv-download-opened', this.handleDialogEvent.bind( this ) );
|
|
|
|
|
this.handleEvent( 'mmv-download-closed', this.handleDialogEvent.bind( this ) );
|
|
|
|
|
this.handleEvent( 'mmv-options-opened', this.handleDialogEvent.bind( this ) );
|
|
|
|
|
this.handleEvent( 'mmv-options-closed', this.handleDialogEvent.bind( this ) );
|
|
|
|
|
|
|
|
|
|
this.$image.on( 'click.mmv-canvas', ( e ) => {
|
|
|
|
|
// ignore clicks if the metadata panel or one of the dialogs is open - assume the intent is to
|
|
|
|
|
// close it in this case; that will be handled elsewhere
|
|
|
|
|
if ( !this.dialogOpen &&
|
|
|
|
|
// FIXME a UI component should not know about its parents
|
|
|
|
|
this.$container.closest( '.metadata-panel-is-open' ).length === 0 ) {
|
|
|
|
|
e.stopPropagation(); // don't let $imageWrapper handle this
|
|
|
|
|
$( document ).trigger( 'mmv-viewfile' );
|
|
|
|
|
}
|
|
|
|
|
} );
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
// open the download panel on right clicking the image
|
|
|
|
|
this.$image.on( 'mousedown.mmv-canvas', ( e ) => {
|
|
|
|
|
if ( e.which === 3 && !this.downloadOpen ) {
|
|
|
|
|
$( document ).trigger( 'mmv-download-open', e );
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
}
|
|
|
|
|
} );
|
|
|
|
|
}
|
2014-06-26 01:26:49 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* Registers listeners.
|
|
|
|
|
*
|
|
|
|
|
* @fires MultimediaViewer#mmv-resize-end
|
|
|
|
|
*/
|
|
|
|
|
attach() {
|
2023-05-20 12:38:59 +00:00
|
|
|
|
/**
|
2024-05-21 20:12:08 +00:00
|
|
|
|
* Fired when the screen size changes. Debounced to avoid continuous triggering while resizing with a mouse.
|
2023-05-20 12:38:59 +00:00
|
|
|
|
*
|
2024-05-21 20:12:08 +00:00
|
|
|
|
* @event MultimediaViewer#mmv-resize-end
|
2023-05-20 12:38:59 +00:00
|
|
|
|
*/
|
2024-05-21 20:12:08 +00:00
|
|
|
|
$( window ).on( 'resize.mmv-canvas', mw.util.debounce( () => {
|
|
|
|
|
this.$mainWrapper.trigger( $.Event( 'mmv-resize-end' ) );
|
|
|
|
|
}, 100 ) );
|
|
|
|
|
|
|
|
|
|
this.$imageWrapper.on( 'click.mmv-canvas', () => {
|
|
|
|
|
if ( this.$container.closest( '.metadata-panel-is-open' ).length > 0 ) {
|
|
|
|
|
this.$mainWrapper.trigger( 'mmv-panel-close-area-click' );
|
2014-11-22 02:46:51 +00:00
|
|
|
|
}
|
2024-05-21 20:12:08 +00:00
|
|
|
|
} );
|
|
|
|
|
}
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* Clears listeners.
|
|
|
|
|
*/
|
|
|
|
|
unattach() {
|
|
|
|
|
this.clearEvents();
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
$( window ).off( 'resize.mmv-canvas' );
|
2014-06-26 01:26:49 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
this.$imageWrapper.off( 'click.mmv-canvas' );
|
|
|
|
|
}
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
/**
|
2024-05-15 18:40:29 +00:00
|
|
|
|
* Sets page thumbnail for display if blowupFactor
|
|
|
|
|
* <= MAX_BLOWUP_FACTOR. Otherwise thumb is not set.
|
2024-05-21 20:12:08 +00:00
|
|
|
|
* We set SVG files to the maximum screen size available.
|
|
|
|
|
* Assumes set function called before.
|
|
|
|
|
*
|
|
|
|
|
* @param {{width: number, height: number}} size
|
|
|
|
|
* @param {jQuery} $imagePlaceholder Image placeholder to be displayed while the real image loads.
|
|
|
|
|
* @param {ThumbnailWidth} imageWidths
|
|
|
|
|
*/
|
|
|
|
|
maybeDisplayPlaceholder( size, $imagePlaceholder, imageWidths ) {
|
|
|
|
|
// Assume natural thumbnail size¸
|
2024-05-15 18:40:29 +00:00
|
|
|
|
let targetWidth = size.width;
|
|
|
|
|
let targetHeight = size.height;
|
2024-05-21 20:12:08 +00:00
|
|
|
|
|
|
|
|
|
// If the image is bigger than the screen we need to resize it
|
|
|
|
|
if ( size.width > imageWidths.cssWidth ) { // This assumes imageInfo.width in CSS units
|
|
|
|
|
targetWidth = imageWidths.cssWidth;
|
|
|
|
|
targetHeight = imageWidths.cssHeight;
|
|
|
|
|
}
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
const blowupFactor = targetWidth / $imagePlaceholder.width();
|
|
|
|
|
// If the placeholder is too blown up, it's not worth showing it
|
|
|
|
|
if ( blowupFactor > Canvas.MAX_BLOWUP_FACTOR ) {
|
2024-05-15 18:40:29 +00:00
|
|
|
|
return;
|
2014-02-26 20:09:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
$imagePlaceholder.width( targetWidth );
|
|
|
|
|
$imagePlaceholder.height( targetHeight );
|
|
|
|
|
this.set( this.imageRawMetadata, $imagePlaceholder.show() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Displays a message and error icon when loading the image fails.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} error error message
|
|
|
|
|
*/
|
|
|
|
|
showError( error ) {
|
|
|
|
|
const canvasDimensions = this.getDimensions();
|
|
|
|
|
const thumbnailDimensions = this.getCurrentImageWidths();
|
|
|
|
|
|
|
|
|
|
// ** is bolding in Phabricator
|
2024-05-28 18:04:50 +00:00
|
|
|
|
const description = `**${ mw.msg( 'multimediaviewer-errorreport-privacywarning' ) }**
|
2023-05-20 12:38:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Error details:
|
|
|
|
|
|
2024-02-13 00:44:51 +00:00
|
|
|
|
error: ${ error }
|
|
|
|
|
URL: ${ location.href }
|
|
|
|
|
user agent: ${ navigator.userAgent }
|
|
|
|
|
screen size: ${ screen.width }x${ screen.height }
|
|
|
|
|
canvas size: ${ canvasDimensions.width }x${ canvasDimensions.height }
|
|
|
|
|
image size: ${ this.imageRawMetadata.originalWidth }x${ this.imageRawMetadata.originalHeight }
|
|
|
|
|
thumbnail size: CSS: ${ thumbnailDimensions.cssWidth }x${ thumbnailDimensions.cssHeight }, screen width: ${ thumbnailDimensions.screen }, real width: ${ thumbnailDimensions.real }`;
|
2024-05-21 20:12:08 +00:00
|
|
|
|
const errorUri = mw.msg( 'multimediaviewer-report-issue-url', encodeURIComponent( description ) );
|
|
|
|
|
|
|
|
|
|
const $retryLink = $( '<a>' ).addClass( 'mw-mmv-retry-link' ).text(
|
|
|
|
|
mw.msg( 'multimediaviewer-thumbnail-error-retry' ) );
|
|
|
|
|
const $reportLink = $( '<a>' ).attr( 'href', errorUri ).text(
|
|
|
|
|
mw.msg( 'multimediaviewer-thumbnail-error-report' ) );
|
|
|
|
|
|
|
|
|
|
this.$imageDiv.empty()
|
|
|
|
|
.addClass( 'error' )
|
|
|
|
|
.append(
|
|
|
|
|
$( '<div>' ).addClass( 'error-box' ).append(
|
|
|
|
|
$( '<div>' ).addClass( 'mw-mmv-error-text' ).text(
|
|
|
|
|
mw.msg( 'multimediaviewer-thumbnail-error' )
|
|
|
|
|
)
|
|
|
|
|
).append(
|
|
|
|
|
$( '<div>' ).addClass( 'mw-mmv-error-description' ).append(
|
|
|
|
|
mw.msg( 'multimediaviewer-thumbnail-error-description',
|
|
|
|
|
HtmlUtils.jqueryToHtml( $retryLink ),
|
|
|
|
|
error,
|
|
|
|
|
HtmlUtils.jqueryToHtml( $reportLink )
|
2015-10-22 04:31:47 +00:00
|
|
|
|
)
|
2015-01-13 21:07:37 +00:00
|
|
|
|
)
|
2024-05-21 20:12:08 +00:00
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
this.$imageDiv.find( '.mw-mmv-retry-link' ).on( 'click', () => {
|
|
|
|
|
location.reload();
|
|
|
|
|
} );
|
|
|
|
|
}
|
2023-05-20 12:38:59 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* Returns width and height of the canvas area (i.e. the space available for the image).
|
|
|
|
|
*
|
|
|
|
|
* @return {Object} Width and height in CSS pixels
|
|
|
|
|
*/
|
2024-07-15 09:45:35 +00:00
|
|
|
|
getDimensions() {
|
2024-05-21 20:12:08 +00:00
|
|
|
|
const $window = $( window );
|
|
|
|
|
// eslint-disable-next-line no-jquery/no-global-selector
|
|
|
|
|
const $aboveFold = $( '.mw-mmv-above-fold' );
|
|
|
|
|
const isFullscreened = !!$aboveFold.closest( '.jq-fullscreened' ).length;
|
|
|
|
|
// Don't rely on this.$imageWrapper's sizing because it's fragile.
|
|
|
|
|
// Depending on what the wrapper contains, its size can be 0 on some browsers.
|
|
|
|
|
// Therefore, we calculate the available space manually
|
|
|
|
|
const availableWidth = $window.width();
|
|
|
|
|
const availableHeight = $window.height() - ( isFullscreened ? 0 : $aboveFold.outerHeight() );
|
|
|
|
|
|
2024-07-15 09:45:35 +00:00
|
|
|
|
return {
|
|
|
|
|
width: availableWidth,
|
|
|
|
|
height: availableHeight
|
|
|
|
|
};
|
2024-05-21 20:12:08 +00:00
|
|
|
|
}
|
2023-05-20 12:38:59 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* Gets the widths for a given lightbox image.
|
|
|
|
|
*
|
|
|
|
|
* @param {LightboxImage} image
|
|
|
|
|
* @return {ThumbnailWidth}
|
|
|
|
|
*/
|
|
|
|
|
getLightboxImageWidths( image ) {
|
|
|
|
|
const thumb = image.thumbnail;
|
|
|
|
|
const canvasDimensions = this.getDimensions();
|
2023-05-20 12:38:59 +00:00
|
|
|
|
|
2024-05-21 20:12:08 +00:00
|
|
|
|
return this.thumbnailWidthCalculator.calculateWidths(
|
2024-07-15 10:00:53 +00:00
|
|
|
|
canvasDimensions.width,
|
|
|
|
|
canvasDimensions.height,
|
|
|
|
|
image.originalWidth || thumb.width,
|
|
|
|
|
image.originalHeight || thumb.height
|
|
|
|
|
);
|
2023-05-20 12:38:59 +00:00
|
|
|
|
}
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2024-05-21 20:12:08 +00:00
|
|
|
|
* Gets the widths for the current lightbox image.
|
2016-07-18 13:49:27 +00:00
|
|
|
|
*
|
2024-05-21 20:12:08 +00:00
|
|
|
|
* @return {ThumbnailWidth}
|
2014-02-26 20:09:37 +00:00
|
|
|
|
*/
|
2024-05-21 20:12:08 +00:00
|
|
|
|
getCurrentImageWidths() {
|
|
|
|
|
return this.getLightboxImageWidths( this.imageRawMetadata );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Maximum blowup factor tolerated
|
|
|
|
|
*
|
|
|
|
|
* @property {number} MAX_BLOWUP_FACTOR
|
|
|
|
|
* @static
|
|
|
|
|
*/
|
|
|
|
|
Canvas.MAX_BLOWUP_FACTOR = 11;
|
|
|
|
|
|
|
|
|
|
module.exports = Canvas;
|