mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-21 12:46:09 +03:00
fixes from review of drawerbase.js
This commit is contained in:
parent
2d8c6fe4c3
commit
3f7e7141b9
@ -1,5 +1,5 @@
|
|||||||
Copyright (C) 2009 CodePlex Foundation
|
Copyright (C) 2009 CodePlex Foundation
|
||||||
Copyright (C) 2010-2023 OpenSeadragon contributors
|
Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are met:
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - Button
|
* OpenSeadragon - Button
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - ButtonGroup
|
* OpenSeadragon - ButtonGroup
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - CanvasDrawer
|
* OpenSeadragon - CanvasDrawer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2022 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
@ -347,7 +347,7 @@ class CanvasDrawer extends $.DrawerBase{
|
|||||||
var point = tiledImage
|
var point = tiledImage
|
||||||
.imageToViewportCoordinates(coord.x, coord.y, true)
|
.imageToViewportCoordinates(coord.x, coord.y, true)
|
||||||
.rotate(-tiledImage.getRotation(true), tiledImage._getRotationPoint(true));
|
.rotate(-tiledImage.getRotation(true), tiledImage._getRotationPoint(true));
|
||||||
var clipPoint = self._viewportCoordToDrawerCoord(point);
|
var clipPoint = self.viewportCoordToDrawerCoord(point);
|
||||||
if (sketchScale) {
|
if (sketchScale) {
|
||||||
clipPoint = clipPoint.times(sketchScale);
|
clipPoint = clipPoint.times(sketchScale);
|
||||||
}
|
}
|
||||||
@ -500,23 +500,6 @@ class CanvasDrawer extends $.DrawerBase{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This function converts the given point from to the drawer coordinate by
|
|
||||||
* multiplying it with the pixel density.
|
|
||||||
* This function does not take rotation into account, thus assuming provided
|
|
||||||
* point is at 0 degree.
|
|
||||||
* @private
|
|
||||||
* @param {OpenSeadragon.Point} point - the pixel point to convert
|
|
||||||
* @returns {OpenSeadragon.Point} Point in drawer coordinate system.
|
|
||||||
*/
|
|
||||||
_viewportCoordToDrawerCoord(point) {
|
|
||||||
var vpPoint = this.viewport.pixelFromPointNoRotate(point, true);
|
|
||||||
return new $.Point(
|
|
||||||
vpPoint.x * $.pixelDensityRatio,
|
|
||||||
vpPoint.y * $.pixelDensityRatio
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws special debug information for a TiledImage if in debug mode.
|
* Draws special debug information for a TiledImage if in debug mode.
|
||||||
* @private
|
* @private
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - Control
|
* OpenSeadragon - Control
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - ControlDock
|
* OpenSeadragon - ControlDock
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - DisplayRect
|
* OpenSeadragon - DisplayRect
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - DrawerBase
|
* OpenSeadragon - DrawerBase
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
@ -34,16 +34,6 @@
|
|||||||
|
|
||||||
(function( $ ){
|
(function( $ ){
|
||||||
|
|
||||||
$.DrawerOptions = class DrawerOptions{
|
|
||||||
constructor(options){}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} Point
|
|
||||||
* @property {number} x
|
|
||||||
* @property {number} y
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class DrawerBase
|
* @class DrawerBase
|
||||||
* @memberof OpenSeadragon
|
* @memberof OpenSeadragon
|
||||||
@ -90,16 +80,14 @@ $.DrawerBase = class DrawerBase{
|
|||||||
*/
|
*/
|
||||||
this.container = $.getElement( options.element );
|
this.container = $.getElement( options.element );
|
||||||
|
|
||||||
// We force our container to ltr because our drawing math doesn't work in rtl.
|
this._renderingTarget = this._createDrawingElement();
|
||||||
// This issue only affects our canvas renderer, but we do it always for consistency.
|
|
||||||
// Note that this means overlays you want to be rtl need to be explicitly set to rtl.
|
|
||||||
this.container.dir = 'ltr';
|
|
||||||
|
|
||||||
// the first time this.canvas is accessed, implementations will create it
|
|
||||||
this.canvas.style.width = "100%";
|
this.canvas.style.width = "100%";
|
||||||
this.canvas.style.height = "100%";
|
this.canvas.style.height = "100%";
|
||||||
this.canvas.style.position = "absolute";
|
this.canvas.style.position = "absolute";
|
||||||
$.setElementOpacity( this.canvas, this.viewer.opacity, true ); // set
|
this.canvas.style.left = "0";
|
||||||
|
$.setElementOpacity( this.canvas, this.viewer.opacity, true );
|
||||||
|
|
||||||
// Allow pointer events to pass through the canvas element so implicit
|
// Allow pointer events to pass through the canvas element so implicit
|
||||||
// pointer capture works on touch devices
|
// pointer capture works on touch devices
|
||||||
@ -113,10 +101,8 @@ $.DrawerBase = class DrawerBase{
|
|||||||
this._checkForAPIOverrides();
|
this._checkForAPIOverrides();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// protect the canvas member with a getter
|
||||||
get canvas(){
|
get canvas(){
|
||||||
if(!this._renderingTarget){
|
|
||||||
this._renderingTarget = this._createDrawingElement();
|
|
||||||
}
|
|
||||||
return this._renderingTarget;
|
return this._renderingTarget;
|
||||||
}
|
}
|
||||||
get element(){
|
get element(){
|
||||||
@ -125,9 +111,10 @@ $.DrawerBase = class DrawerBase{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {String|undefined} type What type of drawer this is. Implementations should override this property.
|
* @returns {String|undefined} What type of drawer this is.
|
||||||
*/
|
*/
|
||||||
getType(){
|
getType(){
|
||||||
|
$.console.error('Drawer.getType must be implemented by child class');
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,26 +193,25 @@ $.DrawerBase = class DrawerBase{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* Ensures that child classes have provided implementations for public API methods
|
* Ensures that child classes have provided implementations for public API methods
|
||||||
* draw, canRotate, destroy, and setImageSmoothinEnabled. Throws an exception if the original
|
* draw, canRotate, destroy, and setImageSmoothinEnabled. Throws an exception if the original
|
||||||
* placeholder methods are still in place.
|
* placeholder methods are still in place.
|
||||||
*/
|
*/
|
||||||
_checkForAPIOverrides(){
|
_checkForAPIOverrides(){
|
||||||
if(this._createDrawingElement === $.DrawerBase.prototype._createDrawingElement){
|
if(this._createDrawingElement === $.DrawerBase.prototype._createDrawingElement){
|
||||||
throw("[drawer]._createDrawingElement must be implemented by child class");
|
throw(new Error("[drawer]._createDrawingElement must be implemented by child class"));
|
||||||
}
|
}
|
||||||
if(this.draw === $.DrawerBase.prototype.draw){
|
if(this.draw === $.DrawerBase.prototype.draw){
|
||||||
throw("[drawer].draw must be implemented by child class");
|
throw(new Error("[drawer].draw must be implemented by child class"));
|
||||||
}
|
}
|
||||||
if(this.canRotate === $.DrawerBase.prototype.canRotate){
|
if(this.canRotate === $.DrawerBase.prototype.canRotate){
|
||||||
throw("[drawer].canRotate must be implemented by child class");
|
throw(new Error("[drawer].canRotate must be implemented by child class"));
|
||||||
}
|
}
|
||||||
if(this.destroy === $.DrawerBase.prototype.destroy){
|
if(this.destroy === $.DrawerBase.prototype.destroy){
|
||||||
throw("[drawer].destroy must be implemented by child class");
|
throw(new Error("[drawer].destroy must be implemented by child class"));
|
||||||
}
|
}
|
||||||
if(this.setImageSmoothingEnabled === $.DrawerBase.prototype.setImageSmoothingEnabled){
|
if(this.setImageSmoothingEnabled === $.DrawerBase.prototype.setImageSmoothingEnabled){
|
||||||
throw("[drawer].setImageSmoothingEnabled must be implemented by child class");
|
throw(new Error("[drawer].setImageSmoothingEnabled must be implemented by child class"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,19 +257,14 @@ $.DrawerBase = class DrawerBase{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* Calculate width and height of the canvas based on viewport dimensions
|
* Calculate width and height of the canvas based on viewport dimensions
|
||||||
* and pixelDensityRatio
|
* and pixelDensityRatio
|
||||||
* @returns {Point} {x, y} size of the canvas
|
* @returns {OpenSeadragon.Point} {x, y} size of the canvas
|
||||||
*/
|
*/
|
||||||
_calculateCanvasSize() {
|
_calculateCanvasSize() {
|
||||||
var pixelDensityRatio = $.pixelDensityRatio;
|
var pixelDensityRatio = $.pixelDensityRatio;
|
||||||
var viewportSize = this.viewport.getContainerSize();
|
var viewportSize = this.viewport.getContainerSize();
|
||||||
return {
|
return new OpenSeadragon.Point( Math.round(viewportSize.x * pixelDensityRatio), Math.round(viewportSize.y * pixelDensityRatio));
|
||||||
// canvas width and height are integers
|
|
||||||
x: Math.round(viewportSize.x * pixelDensityRatio),
|
|
||||||
y: Math.round(viewportSize.y * pixelDensityRatio)
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - DziTileSource
|
* OpenSeadragon - DziTileSource
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - EventSource
|
* OpenSeadragon - EventSource
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - full-screen support functions
|
* OpenSeadragon - full-screen support functions
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - HTMLDrawer
|
* OpenSeadragon - HTMLDrawer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
@ -130,7 +130,6 @@ class HTMLDrawer extends $.DrawerBase{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* Clears the Drawer so it's ready to draw another frame.
|
* Clears the Drawer so it's ready to draw another frame.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -140,7 +139,6 @@ class HTMLDrawer extends $.DrawerBase{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* Draws a TiledImage.
|
* Draws a TiledImage.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -179,7 +177,6 @@ class HTMLDrawer extends $.DrawerBase{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* Draws the given tile.
|
* Draws the given tile.
|
||||||
* @param {OpenSeadragon.Tile} tile - The tile to draw.
|
* @param {OpenSeadragon.Tile} tile - The tile to draw.
|
||||||
* @param {Function} drawingHandler - Method for firing the drawing event if using canvas.
|
* @param {Function} drawingHandler - Method for firing the drawing event if using canvas.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - IIIFTileSource
|
* OpenSeadragon - IIIFTileSource
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - ImageLoader
|
* OpenSeadragon - ImageLoader
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - ImageTileSource
|
* OpenSeadragon - ImageTileSource
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - LegacyTileSource
|
* OpenSeadragon - LegacyTileSource
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - Mat3
|
* OpenSeadragon - Mat3
|
||||||
*
|
*
|
||||||
* Modified from https://webglfundamentals.org/webgl/lessons/webgl-2d-matrices.html
|
* Modified from https://webglfundamentals.org/webgl/lessons/webgl-2d-matrices.html
|
||||||
* Copyright (C) 2010-2023 webglfundamentals.org and OpenSeadragon contributors
|
* Copyright (C) 2010-2024 webglfundamentals.org and OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - MouseTracker
|
* OpenSeadragon - MouseTracker
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - Navigator
|
* OpenSeadragon - Navigator
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon
|
* OpenSeadragon
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - OsmTileSource
|
* OpenSeadragon - OsmTileSource
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - Overlay
|
* OpenSeadragon - Overlay
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* OpenSeadragon - Placement
|
* OpenSeadragon - Placement
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010-2016 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - Point
|
* OpenSeadragon - Point
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - Profiler
|
* OpenSeadragon - Profiler
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - Rect
|
* OpenSeadragon - Rect
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - ReferenceStrip
|
* OpenSeadragon - ReferenceStrip
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - Spring
|
* OpenSeadragon - Spring
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - getString/setString
|
* OpenSeadragon - getString/setString
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - Tile
|
* OpenSeadragon - Tile
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - TileCache
|
* OpenSeadragon - TileCache
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - TiledImage
|
* OpenSeadragon - TiledImage
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - TileSource
|
* OpenSeadragon - TileSource
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - TileSourceCollection
|
* OpenSeadragon - TileSourceCollection
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - TmsTileSource
|
* OpenSeadragon - TmsTileSource
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - Viewer
|
* OpenSeadragon - Viewer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - Viewport
|
* OpenSeadragon - Viewport
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* OpenSeadragon - WebGLDrawer
|
* OpenSeadragon - WebGLDrawer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
@ -875,7 +875,6 @@
|
|||||||
this._clippingContext.clip();
|
this._clippingContext.clip();
|
||||||
}
|
}
|
||||||
_renderToClippingCanvas(item){
|
_renderToClippingCanvas(item){
|
||||||
let _this = this;
|
|
||||||
|
|
||||||
this._clippingContext.clearRect(0, 0, this._clippingCanvas.width, this._clippingCanvas.height);
|
this._clippingContext.clearRect(0, 0, this._clippingCanvas.width, this._clippingCanvas.height);
|
||||||
this._clippingContext.save();
|
this._clippingContext.save();
|
||||||
@ -886,18 +885,18 @@
|
|||||||
this._setClip(rect);
|
this._setClip(rect);
|
||||||
}
|
}
|
||||||
if(item._croppingPolygons){
|
if(item._croppingPolygons){
|
||||||
let polygons = item._croppingPolygons.map(function (polygon) {
|
let polygons = item._croppingPolygons.map(polygon => {
|
||||||
return polygon.map(function (coord) {
|
return polygon.map(coord => {
|
||||||
let point = item.imageToViewportCoordinates(coord.x, coord.y, true)
|
let point = item.imageToViewportCoordinates(coord.x, coord.y, true)
|
||||||
.rotate(_this.viewer.viewport.getRotation(true), _this.viewer.viewport.getCenter(true));
|
.rotate(this.viewer.viewport.getRotation(true), this.viewer.viewport.getCenter(true));
|
||||||
let clipPoint = _this._viewportCoordToDrawerCoord(point);
|
let clipPoint = this.viewportCoordToDrawerCoord(point);
|
||||||
return clipPoint;
|
return clipPoint;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this._clippingContext.beginPath();
|
this._clippingContext.beginPath();
|
||||||
polygons.forEach(function (polygon) {
|
polygons.forEach(polygon => {
|
||||||
polygon.forEach(function (coord, i) {
|
polygon.forEach( (coord, i) => {
|
||||||
_this._clippingContext[i === 0 ? 'moveTo' : 'lineTo'](coord.x, coord.y);
|
this._clippingContext[i === 0 ? 'moveTo' : 'lineTo'](coord.x, coord.y);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this._clippingContext.clip();
|
this._clippingContext.clip();
|
||||||
@ -927,25 +926,6 @@
|
|||||||
context.translate(-point.x, -point.y);
|
context.translate(-point.x, -point.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @inner
|
|
||||||
* This function converts the given point from to the drawer coordinate by
|
|
||||||
* multiplying it with the pixel density.
|
|
||||||
* This function does not take rotation into account, thus assuming provided
|
|
||||||
* point is at 0 degree.
|
|
||||||
* @param {OpenSeadragon.Point} point - the pixel point to convert
|
|
||||||
* @returns {OpenSeadragon.Point} Point in drawer coordinate system.
|
|
||||||
*/
|
|
||||||
_viewportCoordToDrawerCoord(point) {
|
|
||||||
var vpPoint = this.viewport.pixelFromPointNoRotate(point, true);
|
|
||||||
return new $.Point(
|
|
||||||
vpPoint.x * $.pixelDensityRatio,
|
|
||||||
vpPoint.y * $.pixelDensityRatio
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// private
|
// private
|
||||||
_drawDebugInfo( tilesToDraw, tiledImage, stroke, fill ) {
|
_drawDebugInfo( tilesToDraw, tiledImage, stroke, fill ) {
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OpenSeadragon - World
|
* OpenSeadragon - World
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 CodePlex Foundation
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
* Copyright (C) 2010-2023 OpenSeadragon contributors
|
* Copyright (C) 2010-2024 OpenSeadragon contributors
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
Loading…
Reference in New Issue
Block a user