mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-21 20:56:09 +03:00
support viewport flipping for clip and cropping polygons in webglviewer
This commit is contained in:
parent
ae5f08b9bd
commit
5df791fc82
@ -917,6 +917,12 @@
|
||||
|
||||
this._clippingContext.clearRect(0, 0, this._clippingCanvas.width, this._clippingCanvas.height);
|
||||
this._clippingContext.save();
|
||||
if(this.viewer.viewport.getFlip()){
|
||||
const point = new $.Point(this.canvas.width / 2, this.canvas.height / 2);
|
||||
this._clippingContext.translate(point.x, 0);
|
||||
this._clippingContext.scale(-1, 1);
|
||||
this._clippingContext.translate(-point.x, 0);
|
||||
}
|
||||
|
||||
if(item._clip){
|
||||
const polygon = [
|
||||
@ -936,7 +942,7 @@
|
||||
this._clippingContext[i === 0 ? 'moveTo' : 'lineTo'](coord.x, coord.y);
|
||||
});
|
||||
this._clippingContext.clip();
|
||||
this._setClip()
|
||||
this._setClip();
|
||||
}
|
||||
if(item._croppingPolygons){
|
||||
let polygons = item._croppingPolygons.map(polygon => {
|
||||
@ -956,6 +962,13 @@
|
||||
this._clippingContext.clip();
|
||||
}
|
||||
|
||||
if(this.viewer.viewport.getFlip()){
|
||||
const point = new $.Point(this.canvas.width / 2, this.canvas.height / 2);
|
||||
this._clippingContext.translate(point.x, 0);
|
||||
this._clippingContext.scale(-1, 1);
|
||||
this._clippingContext.translate(-point.x, 0);
|
||||
}
|
||||
|
||||
this._clippingContext.drawImage(this._renderingCanvas, 0, 0);
|
||||
|
||||
this._clippingContext.restore();
|
||||
|
Loading…
Reference in New Issue
Block a user