mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-21 20:56:09 +03:00
Fixed: Add inner div if text and invert x
This commit is contained in:
parent
fd9b701272
commit
176fae11e5
@ -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
|
||||||
@ -242,6 +242,9 @@
|
|||||||
*/
|
*/
|
||||||
drawHTML: function(container, viewport) {
|
drawHTML: function(container, viewport) {
|
||||||
var element = this.element;
|
var element = this.element;
|
||||||
|
var text = document.createElement('div');
|
||||||
|
text.textContent = element.textContent;
|
||||||
|
element.textContent = "";
|
||||||
if (element.parentNode !== container) {
|
if (element.parentNode !== container) {
|
||||||
//save the source parent for later if we need it
|
//save the source parent for later if we need it
|
||||||
element.prevElementParent = element.parentNode;
|
element.prevElementParent = element.parentNode;
|
||||||
@ -274,6 +277,7 @@
|
|||||||
this.onDraw(position, size, this.element);
|
this.onDraw(position, size, this.element);
|
||||||
} else {
|
} else {
|
||||||
var style = this.style;
|
var style = this.style;
|
||||||
|
var textStyle = text.style;
|
||||||
style.left = position.x + "px";
|
style.left = position.x + "px";
|
||||||
style.top = position.y + "px";
|
style.top = position.y + "px";
|
||||||
if (this.width !== null) {
|
if (this.width !== null) {
|
||||||
@ -291,9 +295,11 @@
|
|||||||
style[transformOriginProp] = this._getTransformOrigin();
|
style[transformOriginProp] = this._getTransformOrigin();
|
||||||
style[transformProp] = "rotate(" + rotate + "deg)";
|
style[transformProp] = "rotate(" + rotate + "deg)";
|
||||||
} else if (!rotate && viewport.flipped) {
|
} else if (!rotate && viewport.flipped) {
|
||||||
|
textStyle[transformProp] = "scaleX(-1)";
|
||||||
style[transformOriginProp] = this._getTransformOrigin();
|
style[transformOriginProp] = this._getTransformOrigin();
|
||||||
style[transformProp] = scale;
|
style[transformProp] = scale;
|
||||||
} else if (rotate && viewport.flipped){
|
} else if (rotate && viewport.flipped){
|
||||||
|
textStyle[transformProp] = "scaleX(-1)";
|
||||||
style[transformOriginProp] = this._getTransformOrigin();
|
style[transformOriginProp] = this._getTransformOrigin();
|
||||||
style[transformProp] = "rotate(" + rotate + "deg)" + scale;
|
style[transformProp] = "rotate(" + rotate + "deg)" + scale;
|
||||||
} else {
|
} else {
|
||||||
@ -302,6 +308,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
style.display = 'block';
|
style.display = 'block';
|
||||||
|
element.appendChild(text);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user