Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/embedpre.../assets/pdf/build
File: script.js
this.y = (y + ty) / height;
[8500] Fix | Delete
this.fixAndSetPosition();
[8501] Fix | Delete
}
[8502] Fix | Delete
#translate([width, height], x, y) {
[8503] Fix | Delete
[x, y] = this.screenToPageTranslation(x, y);
[8504] Fix | Delete
this.x += x / width;
[8505] Fix | Delete
this.y += y / height;
[8506] Fix | Delete
this.fixAndSetPosition();
[8507] Fix | Delete
}
[8508] Fix | Delete
translate(x, y) {
[8509] Fix | Delete
this.#translate(this.parentDimensions, x, y);
[8510] Fix | Delete
}
[8511] Fix | Delete
translateInPage(x, y) {
[8512] Fix | Delete
this.#initialPosition ||= [this.x, this.y];
[8513] Fix | Delete
this.#translate(this.pageDimensions, x, y);
[8514] Fix | Delete
this.div.scrollIntoView({
[8515] Fix | Delete
block: "nearest"
[8516] Fix | Delete
});
[8517] Fix | Delete
}
[8518] Fix | Delete
drag(tx, ty) {
[8519] Fix | Delete
this.#initialPosition ||= [this.x, this.y];
[8520] Fix | Delete
const [parentWidth, parentHeight] = this.parentDimensions;
[8521] Fix | Delete
this.x += tx / parentWidth;
[8522] Fix | Delete
this.y += ty / parentHeight;
[8523] Fix | Delete
if (this.parent && (this.x < 0 || this.x > 1 || this.y < 0 || this.y > 1)) {
[8524] Fix | Delete
const {
[8525] Fix | Delete
x,
[8526] Fix | Delete
y
[8527] Fix | Delete
} = this.div.getBoundingClientRect();
[8528] Fix | Delete
if (this.parent.findNewParent(this, x, y)) {
[8529] Fix | Delete
this.x -= Math.floor(this.x);
[8530] Fix | Delete
this.y -= Math.floor(this.y);
[8531] Fix | Delete
}
[8532] Fix | Delete
}
[8533] Fix | Delete
let {
[8534] Fix | Delete
x,
[8535] Fix | Delete
y
[8536] Fix | Delete
} = this;
[8537] Fix | Delete
const [bx, by] = this.getBaseTranslation();
[8538] Fix | Delete
x += bx;
[8539] Fix | Delete
y += by;
[8540] Fix | Delete
this.div.style.left = `${(100 * x).toFixed(2)}%`;
[8541] Fix | Delete
this.div.style.top = `${(100 * y).toFixed(2)}%`;
[8542] Fix | Delete
this.div.scrollIntoView({
[8543] Fix | Delete
block: "nearest"
[8544] Fix | Delete
});
[8545] Fix | Delete
}
[8546] Fix | Delete
get _hasBeenMoved() {
[8547] Fix | Delete
return !!this.#initialPosition && (this.#initialPosition[0] !== this.x || this.#initialPosition[1] !== this.y);
[8548] Fix | Delete
}
[8549] Fix | Delete
getBaseTranslation() {
[8550] Fix | Delete
const [parentWidth, parentHeight] = this.parentDimensions;
[8551] Fix | Delete
const {
[8552] Fix | Delete
_borderLineWidth
[8553] Fix | Delete
} = AnnotationEditor;
[8554] Fix | Delete
const x = _borderLineWidth / parentWidth;
[8555] Fix | Delete
const y = _borderLineWidth / parentHeight;
[8556] Fix | Delete
switch (this.rotation) {
[8557] Fix | Delete
case 90:
[8558] Fix | Delete
return [-x, y];
[8559] Fix | Delete
case 180:
[8560] Fix | Delete
return [x, y];
[8561] Fix | Delete
case 270:
[8562] Fix | Delete
return [x, -y];
[8563] Fix | Delete
default:
[8564] Fix | Delete
return [-x, -y];
[8565] Fix | Delete
}
[8566] Fix | Delete
}
[8567] Fix | Delete
get _mustFixPosition() {
[8568] Fix | Delete
return true;
[8569] Fix | Delete
}
[8570] Fix | Delete
fixAndSetPosition(rotation = this.rotation) {
[8571] Fix | Delete
const [pageWidth, pageHeight] = this.pageDimensions;
[8572] Fix | Delete
let {
[8573] Fix | Delete
x,
[8574] Fix | Delete
y,
[8575] Fix | Delete
width,
[8576] Fix | Delete
height
[8577] Fix | Delete
} = this;
[8578] Fix | Delete
width *= pageWidth;
[8579] Fix | Delete
height *= pageHeight;
[8580] Fix | Delete
x *= pageWidth;
[8581] Fix | Delete
y *= pageHeight;
[8582] Fix | Delete
if (this._mustFixPosition) {
[8583] Fix | Delete
switch (rotation) {
[8584] Fix | Delete
case 0:
[8585] Fix | Delete
x = Math.max(0, Math.min(pageWidth - width, x));
[8586] Fix | Delete
y = Math.max(0, Math.min(pageHeight - height, y));
[8587] Fix | Delete
break;
[8588] Fix | Delete
case 90:
[8589] Fix | Delete
x = Math.max(0, Math.min(pageWidth - height, x));
[8590] Fix | Delete
y = Math.min(pageHeight, Math.max(width, y));
[8591] Fix | Delete
break;
[8592] Fix | Delete
case 180:
[8593] Fix | Delete
x = Math.min(pageWidth, Math.max(width, x));
[8594] Fix | Delete
y = Math.min(pageHeight, Math.max(height, y));
[8595] Fix | Delete
break;
[8596] Fix | Delete
case 270:
[8597] Fix | Delete
x = Math.min(pageWidth, Math.max(height, x));
[8598] Fix | Delete
y = Math.max(0, Math.min(pageHeight - width, y));
[8599] Fix | Delete
break;
[8600] Fix | Delete
}
[8601] Fix | Delete
}
[8602] Fix | Delete
this.x = x /= pageWidth;
[8603] Fix | Delete
this.y = y /= pageHeight;
[8604] Fix | Delete
const [bx, by] = this.getBaseTranslation();
[8605] Fix | Delete
x += bx;
[8606] Fix | Delete
y += by;
[8607] Fix | Delete
const {
[8608] Fix | Delete
style
[8609] Fix | Delete
} = this.div;
[8610] Fix | Delete
style.left = `${(100 * x).toFixed(2)}%`;
[8611] Fix | Delete
style.top = `${(100 * y).toFixed(2)}%`;
[8612] Fix | Delete
this.moveInDOM();
[8613] Fix | Delete
}
[8614] Fix | Delete
static #rotatePoint(x, y, angle) {
[8615] Fix | Delete
switch (angle) {
[8616] Fix | Delete
case 90:
[8617] Fix | Delete
return [y, -x];
[8618] Fix | Delete
case 180:
[8619] Fix | Delete
return [-x, -y];
[8620] Fix | Delete
case 270:
[8621] Fix | Delete
return [-y, x];
[8622] Fix | Delete
default:
[8623] Fix | Delete
return [x, y];
[8624] Fix | Delete
}
[8625] Fix | Delete
}
[8626] Fix | Delete
screenToPageTranslation(x, y) {
[8627] Fix | Delete
return AnnotationEditor.#rotatePoint(x, y, this.parentRotation);
[8628] Fix | Delete
}
[8629] Fix | Delete
pageTranslationToScreen(x, y) {
[8630] Fix | Delete
return AnnotationEditor.#rotatePoint(x, y, 360 - this.parentRotation);
[8631] Fix | Delete
}
[8632] Fix | Delete
#getRotationMatrix(rotation) {
[8633] Fix | Delete
switch (rotation) {
[8634] Fix | Delete
case 90:
[8635] Fix | Delete
{
[8636] Fix | Delete
const [pageWidth, pageHeight] = this.pageDimensions;
[8637] Fix | Delete
return [0, -pageWidth / pageHeight, pageHeight / pageWidth, 0];
[8638] Fix | Delete
}
[8639] Fix | Delete
case 180:
[8640] Fix | Delete
return [-1, 0, 0, -1];
[8641] Fix | Delete
case 270:
[8642] Fix | Delete
{
[8643] Fix | Delete
const [pageWidth, pageHeight] = this.pageDimensions;
[8644] Fix | Delete
return [0, pageWidth / pageHeight, -pageHeight / pageWidth, 0];
[8645] Fix | Delete
}
[8646] Fix | Delete
default:
[8647] Fix | Delete
return [1, 0, 0, 1];
[8648] Fix | Delete
}
[8649] Fix | Delete
}
[8650] Fix | Delete
get parentScale() {
[8651] Fix | Delete
return this._uiManager.viewParameters.realScale;
[8652] Fix | Delete
}
[8653] Fix | Delete
get parentRotation() {
[8654] Fix | Delete
return (this._uiManager.viewParameters.rotation + this.pageRotation) % 360;
[8655] Fix | Delete
}
[8656] Fix | Delete
get parentDimensions() {
[8657] Fix | Delete
const {
[8658] Fix | Delete
parentScale,
[8659] Fix | Delete
pageDimensions: [pageWidth, pageHeight]
[8660] Fix | Delete
} = this;
[8661] Fix | Delete
const scaledWidth = pageWidth * parentScale;
[8662] Fix | Delete
const scaledHeight = pageHeight * parentScale;
[8663] Fix | Delete
return util_FeatureTest.isCSSRoundSupported ? [Math.round(scaledWidth), Math.round(scaledHeight)] : [scaledWidth, scaledHeight];
[8664] Fix | Delete
}
[8665] Fix | Delete
setDims(width, height) {
[8666] Fix | Delete
const [parentWidth, parentHeight] = this.parentDimensions;
[8667] Fix | Delete
this.div.style.width = `${(100 * width / parentWidth).toFixed(2)}%`;
[8668] Fix | Delete
if (!this.#keepAspectRatio) {
[8669] Fix | Delete
this.div.style.height = `${(100 * height / parentHeight).toFixed(2)}%`;
[8670] Fix | Delete
}
[8671] Fix | Delete
}
[8672] Fix | Delete
fixDims() {
[8673] Fix | Delete
const {
[8674] Fix | Delete
style
[8675] Fix | Delete
} = this.div;
[8676] Fix | Delete
const {
[8677] Fix | Delete
height,
[8678] Fix | Delete
width
[8679] Fix | Delete
} = style;
[8680] Fix | Delete
const widthPercent = width.endsWith("%");
[8681] Fix | Delete
const heightPercent = !this.#keepAspectRatio && height.endsWith("%");
[8682] Fix | Delete
if (widthPercent && heightPercent) {
[8683] Fix | Delete
return;
[8684] Fix | Delete
}
[8685] Fix | Delete
const [parentWidth, parentHeight] = this.parentDimensions;
[8686] Fix | Delete
if (!widthPercent) {
[8687] Fix | Delete
style.width = `${(100 * parseFloat(width) / parentWidth).toFixed(2)}%`;
[8688] Fix | Delete
}
[8689] Fix | Delete
if (!this.#keepAspectRatio && !heightPercent) {
[8690] Fix | Delete
style.height = `${(100 * parseFloat(height) / parentHeight).toFixed(2)}%`;
[8691] Fix | Delete
}
[8692] Fix | Delete
}
[8693] Fix | Delete
getInitialTranslation() {
[8694] Fix | Delete
return [0, 0];
[8695] Fix | Delete
}
[8696] Fix | Delete
#createResizers() {
[8697] Fix | Delete
if (this.#resizersDiv) {
[8698] Fix | Delete
return;
[8699] Fix | Delete
}
[8700] Fix | Delete
this.#resizersDiv = document.createElement("div");
[8701] Fix | Delete
this.#resizersDiv.classList.add("resizers");
[8702] Fix | Delete
const classes = this._willKeepAspectRatio ? ["topLeft", "topRight", "bottomRight", "bottomLeft"] : ["topLeft", "topMiddle", "topRight", "middleRight", "bottomRight", "bottomMiddle", "bottomLeft", "middleLeft"];
[8703] Fix | Delete
for (const name of classes) {
[8704] Fix | Delete
const div = document.createElement("div");
[8705] Fix | Delete
this.#resizersDiv.append(div);
[8706] Fix | Delete
div.classList.add("resizer", name);
[8707] Fix | Delete
div.setAttribute("data-resizer-name", name);
[8708] Fix | Delete
div.addEventListener("pointerdown", this.#resizerPointerdown.bind(this, name));
[8709] Fix | Delete
div.addEventListener("contextmenu", noContextMenu);
[8710] Fix | Delete
div.tabIndex = -1;
[8711] Fix | Delete
}
[8712] Fix | Delete
this.div.prepend(this.#resizersDiv);
[8713] Fix | Delete
}
[8714] Fix | Delete
#resizerPointerdown(name, event) {
[8715] Fix | Delete
event.preventDefault();
[8716] Fix | Delete
const {
[8717] Fix | Delete
isMac
[8718] Fix | Delete
} = util_FeatureTest.platform;
[8719] Fix | Delete
if (event.button !== 0 || event.ctrlKey && isMac) {
[8720] Fix | Delete
return;
[8721] Fix | Delete
}
[8722] Fix | Delete
this.#altText?.toggle(false);
[8723] Fix | Delete
const boundResizerPointermove = this.#resizerPointermove.bind(this, name);
[8724] Fix | Delete
const savedDraggable = this._isDraggable;
[8725] Fix | Delete
this._isDraggable = false;
[8726] Fix | Delete
const pointerMoveOptions = {
[8727] Fix | Delete
passive: true,
[8728] Fix | Delete
capture: true
[8729] Fix | Delete
};
[8730] Fix | Delete
this.parent.togglePointerEvents(false);
[8731] Fix | Delete
window.addEventListener("pointermove", boundResizerPointermove, pointerMoveOptions);
[8732] Fix | Delete
window.addEventListener("contextmenu", noContextMenu);
[8733] Fix | Delete
const savedX = this.x;
[8734] Fix | Delete
const savedY = this.y;
[8735] Fix | Delete
const savedWidth = this.width;
[8736] Fix | Delete
const savedHeight = this.height;
[8737] Fix | Delete
const savedParentCursor = this.parent.div.style.cursor;
[8738] Fix | Delete
const savedCursor = this.div.style.cursor;
[8739] Fix | Delete
this.div.style.cursor = this.parent.div.style.cursor = window.getComputedStyle(event.target).cursor;
[8740] Fix | Delete
const pointerUpCallback = () => {
[8741] Fix | Delete
this.parent.togglePointerEvents(true);
[8742] Fix | Delete
this.#altText?.toggle(true);
[8743] Fix | Delete
this._isDraggable = savedDraggable;
[8744] Fix | Delete
window.removeEventListener("pointerup", pointerUpCallback);
[8745] Fix | Delete
window.removeEventListener("blur", pointerUpCallback);
[8746] Fix | Delete
window.removeEventListener("pointermove", boundResizerPointermove, pointerMoveOptions);
[8747] Fix | Delete
window.removeEventListener("contextmenu", noContextMenu);
[8748] Fix | Delete
this.parent.div.style.cursor = savedParentCursor;
[8749] Fix | Delete
this.div.style.cursor = savedCursor;
[8750] Fix | Delete
this.#addResizeToUndoStack(savedX, savedY, savedWidth, savedHeight);
[8751] Fix | Delete
};
[8752] Fix | Delete
window.addEventListener("pointerup", pointerUpCallback);
[8753] Fix | Delete
window.addEventListener("blur", pointerUpCallback);
[8754] Fix | Delete
}
[8755] Fix | Delete
#addResizeToUndoStack(savedX, savedY, savedWidth, savedHeight) {
[8756] Fix | Delete
const newX = this.x;
[8757] Fix | Delete
const newY = this.y;
[8758] Fix | Delete
const newWidth = this.width;
[8759] Fix | Delete
const newHeight = this.height;
[8760] Fix | Delete
if (newX === savedX && newY === savedY && newWidth === savedWidth && newHeight === savedHeight) {
[8761] Fix | Delete
return;
[8762] Fix | Delete
}
[8763] Fix | Delete
this.addCommands({
[8764] Fix | Delete
cmd: () => {
[8765] Fix | Delete
this.width = newWidth;
[8766] Fix | Delete
this.height = newHeight;
[8767] Fix | Delete
this.x = newX;
[8768] Fix | Delete
this.y = newY;
[8769] Fix | Delete
const [parentWidth, parentHeight] = this.parentDimensions;
[8770] Fix | Delete
this.setDims(parentWidth * newWidth, parentHeight * newHeight);
[8771] Fix | Delete
this.fixAndSetPosition();
[8772] Fix | Delete
},
[8773] Fix | Delete
undo: () => {
[8774] Fix | Delete
this.width = savedWidth;
[8775] Fix | Delete
this.height = savedHeight;
[8776] Fix | Delete
this.x = savedX;
[8777] Fix | Delete
this.y = savedY;
[8778] Fix | Delete
const [parentWidth, parentHeight] = this.parentDimensions;
[8779] Fix | Delete
this.setDims(parentWidth * savedWidth, parentHeight * savedHeight);
[8780] Fix | Delete
this.fixAndSetPosition();
[8781] Fix | Delete
},
[8782] Fix | Delete
mustExec: true
[8783] Fix | Delete
});
[8784] Fix | Delete
}
[8785] Fix | Delete
#resizerPointermove(name, event) {
[8786] Fix | Delete
const [parentWidth, parentHeight] = this.parentDimensions;
[8787] Fix | Delete
const savedX = this.x;
[8788] Fix | Delete
const savedY = this.y;
[8789] Fix | Delete
const savedWidth = this.width;
[8790] Fix | Delete
const savedHeight = this.height;
[8791] Fix | Delete
const minWidth = AnnotationEditor.MIN_SIZE / parentWidth;
[8792] Fix | Delete
const minHeight = AnnotationEditor.MIN_SIZE / parentHeight;
[8793] Fix | Delete
const round = x => Math.round(x * 10000) / 10000;
[8794] Fix | Delete
const rotationMatrix = this.#getRotationMatrix(this.rotation);
[8795] Fix | Delete
const transf = (x, y) => [rotationMatrix[0] * x + rotationMatrix[2] * y, rotationMatrix[1] * x + rotationMatrix[3] * y];
[8796] Fix | Delete
const invRotationMatrix = this.#getRotationMatrix(360 - this.rotation);
[8797] Fix | Delete
const invTransf = (x, y) => [invRotationMatrix[0] * x + invRotationMatrix[2] * y, invRotationMatrix[1] * x + invRotationMatrix[3] * y];
[8798] Fix | Delete
let getPoint;
[8799] Fix | Delete
let getOpposite;
[8800] Fix | Delete
let isDiagonal = false;
[8801] Fix | Delete
let isHorizontal = false;
[8802] Fix | Delete
switch (name) {
[8803] Fix | Delete
case "topLeft":
[8804] Fix | Delete
isDiagonal = true;
[8805] Fix | Delete
getPoint = (w, h) => [0, 0];
[8806] Fix | Delete
getOpposite = (w, h) => [w, h];
[8807] Fix | Delete
break;
[8808] Fix | Delete
case "topMiddle":
[8809] Fix | Delete
getPoint = (w, h) => [w / 2, 0];
[8810] Fix | Delete
getOpposite = (w, h) => [w / 2, h];
[8811] Fix | Delete
break;
[8812] Fix | Delete
case "topRight":
[8813] Fix | Delete
isDiagonal = true;
[8814] Fix | Delete
getPoint = (w, h) => [w, 0];
[8815] Fix | Delete
getOpposite = (w, h) => [0, h];
[8816] Fix | Delete
break;
[8817] Fix | Delete
case "middleRight":
[8818] Fix | Delete
isHorizontal = true;
[8819] Fix | Delete
getPoint = (w, h) => [w, h / 2];
[8820] Fix | Delete
getOpposite = (w, h) => [0, h / 2];
[8821] Fix | Delete
break;
[8822] Fix | Delete
case "bottomRight":
[8823] Fix | Delete
isDiagonal = true;
[8824] Fix | Delete
getPoint = (w, h) => [w, h];
[8825] Fix | Delete
getOpposite = (w, h) => [0, 0];
[8826] Fix | Delete
break;
[8827] Fix | Delete
case "bottomMiddle":
[8828] Fix | Delete
getPoint = (w, h) => [w / 2, h];
[8829] Fix | Delete
getOpposite = (w, h) => [w / 2, 0];
[8830] Fix | Delete
break;
[8831] Fix | Delete
case "bottomLeft":
[8832] Fix | Delete
isDiagonal = true;
[8833] Fix | Delete
getPoint = (w, h) => [0, h];
[8834] Fix | Delete
getOpposite = (w, h) => [w, 0];
[8835] Fix | Delete
break;
[8836] Fix | Delete
case "middleLeft":
[8837] Fix | Delete
isHorizontal = true;
[8838] Fix | Delete
getPoint = (w, h) => [0, h / 2];
[8839] Fix | Delete
getOpposite = (w, h) => [w, h / 2];
[8840] Fix | Delete
break;
[8841] Fix | Delete
}
[8842] Fix | Delete
const point = getPoint(savedWidth, savedHeight);
[8843] Fix | Delete
const oppositePoint = getOpposite(savedWidth, savedHeight);
[8844] Fix | Delete
let transfOppositePoint = transf(...oppositePoint);
[8845] Fix | Delete
const oppositeX = round(savedX + transfOppositePoint[0]);
[8846] Fix | Delete
const oppositeY = round(savedY + transfOppositePoint[1]);
[8847] Fix | Delete
let ratioX = 1;
[8848] Fix | Delete
let ratioY = 1;
[8849] Fix | Delete
let [deltaX, deltaY] = this.screenToPageTranslation(event.movementX, event.movementY);
[8850] Fix | Delete
[deltaX, deltaY] = invTransf(deltaX / parentWidth, deltaY / parentHeight);
[8851] Fix | Delete
if (isDiagonal) {
[8852] Fix | Delete
const oldDiag = Math.hypot(savedWidth, savedHeight);
[8853] Fix | Delete
ratioX = ratioY = Math.max(Math.min(Math.hypot(oppositePoint[0] - point[0] - deltaX, oppositePoint[1] - point[1] - deltaY) / oldDiag, 1 / savedWidth, 1 / savedHeight), minWidth / savedWidth, minHeight / savedHeight);
[8854] Fix | Delete
} else if (isHorizontal) {
[8855] Fix | Delete
ratioX = Math.max(minWidth, Math.min(1, Math.abs(oppositePoint[0] - point[0] - deltaX))) / savedWidth;
[8856] Fix | Delete
} else {
[8857] Fix | Delete
ratioY = Math.max(minHeight, Math.min(1, Math.abs(oppositePoint[1] - point[1] - deltaY))) / savedHeight;
[8858] Fix | Delete
}
[8859] Fix | Delete
const newWidth = round(savedWidth * ratioX);
[8860] Fix | Delete
const newHeight = round(savedHeight * ratioY);
[8861] Fix | Delete
transfOppositePoint = transf(...getOpposite(newWidth, newHeight));
[8862] Fix | Delete
const newX = oppositeX - transfOppositePoint[0];
[8863] Fix | Delete
const newY = oppositeY - transfOppositePoint[1];
[8864] Fix | Delete
this.width = newWidth;
[8865] Fix | Delete
this.height = newHeight;
[8866] Fix | Delete
this.x = newX;
[8867] Fix | Delete
this.y = newY;
[8868] Fix | Delete
this.setDims(parentWidth * newWidth, parentHeight * newHeight);
[8869] Fix | Delete
this.fixAndSetPosition();
[8870] Fix | Delete
}
[8871] Fix | Delete
altTextFinish() {
[8872] Fix | Delete
this.#altText?.finish();
[8873] Fix | Delete
}
[8874] Fix | Delete
async addEditToolbar() {
[8875] Fix | Delete
if (this.#editToolbar || this.#isInEditMode) {
[8876] Fix | Delete
return this.#editToolbar;
[8877] Fix | Delete
}
[8878] Fix | Delete
this.#editToolbar = new EditorToolbar(this);
[8879] Fix | Delete
this.div.append(this.#editToolbar.render());
[8880] Fix | Delete
if (this.#altText) {
[8881] Fix | Delete
this.#editToolbar.addAltTextButton(await this.#altText.render());
[8882] Fix | Delete
}
[8883] Fix | Delete
return this.#editToolbar;
[8884] Fix | Delete
}
[8885] Fix | Delete
removeEditToolbar() {
[8886] Fix | Delete
if (!this.#editToolbar) {
[8887] Fix | Delete
return;
[8888] Fix | Delete
}
[8889] Fix | Delete
this.#editToolbar.remove();
[8890] Fix | Delete
this.#editToolbar = null;
[8891] Fix | Delete
this.#altText?.destroy();
[8892] Fix | Delete
}
[8893] Fix | Delete
getClientDimensions() {
[8894] Fix | Delete
return this.div.getBoundingClientRect();
[8895] Fix | Delete
}
[8896] Fix | Delete
async addAltTextButton() {
[8897] Fix | Delete
if (this.#altText) {
[8898] Fix | Delete
return;
[8899] Fix | Delete
}
[8900] Fix | Delete
AltText.initialize(AnnotationEditor._l10nPromise);
[8901] Fix | Delete
this.#altText = new AltText(this);
[8902] Fix | Delete
await this.addEditToolbar();
[8903] Fix | Delete
}
[8904] Fix | Delete
get altTextData() {
[8905] Fix | Delete
return this.#altText?.data;
[8906] Fix | Delete
}
[8907] Fix | Delete
set altTextData(data) {
[8908] Fix | Delete
if (!this.#altText) {
[8909] Fix | Delete
return;
[8910] Fix | Delete
}
[8911] Fix | Delete
this.#altText.data = data;
[8912] Fix | Delete
}
[8913] Fix | Delete
hasAltText() {
[8914] Fix | Delete
return !this.#altText?.isEmpty();
[8915] Fix | Delete
}
[8916] Fix | Delete
render() {
[8917] Fix | Delete
this.div = document.createElement("div");
[8918] Fix | Delete
this.div.setAttribute("data-editor-rotation", (360 - this.rotation) % 360);
[8919] Fix | Delete
this.div.className = this.name;
[8920] Fix | Delete
this.div.setAttribute("id", this.id);
[8921] Fix | Delete
this.div.tabIndex = this.#disabled ? -1 : 0;
[8922] Fix | Delete
if (!this._isVisible) {
[8923] Fix | Delete
this.div.classList.add("hidden");
[8924] Fix | Delete
}
[8925] Fix | Delete
this.setInForeground();
[8926] Fix | Delete
this.div.addEventListener("focusin", this.#boundFocusin);
[8927] Fix | Delete
this.div.addEventListener("focusout", this.#boundFocusout);
[8928] Fix | Delete
const [parentWidth, parentHeight] = this.parentDimensions;
[8929] Fix | Delete
if (this.parentRotation % 180 !== 0) {
[8930] Fix | Delete
this.div.style.maxWidth = `${(100 * parentHeight / parentWidth).toFixed(2)}%`;
[8931] Fix | Delete
this.div.style.maxHeight = `${(100 * parentWidth / parentHeight).toFixed(2)}%`;
[8932] Fix | Delete
}
[8933] Fix | Delete
const [tx, ty] = this.getInitialTranslation();
[8934] Fix | Delete
this.translate(tx, ty);
[8935] Fix | Delete
bindEvents(this, this.div, ["pointerdown"]);
[8936] Fix | Delete
return this.div;
[8937] Fix | Delete
}
[8938] Fix | Delete
pointerdown(event) {
[8939] Fix | Delete
const {
[8940] Fix | Delete
isMac
[8941] Fix | Delete
} = util_FeatureTest.platform;
[8942] Fix | Delete
if (event.button !== 0 || event.ctrlKey && isMac) {
[8943] Fix | Delete
event.preventDefault();
[8944] Fix | Delete
return;
[8945] Fix | Delete
}
[8946] Fix | Delete
this.#hasBeenClicked = true;
[8947] Fix | Delete
if (this._isDraggable) {
[8948] Fix | Delete
this.#setUpDragSession(event);
[8949] Fix | Delete
return;
[8950] Fix | Delete
}
[8951] Fix | Delete
this.#selectOnPointerEvent(event);
[8952] Fix | Delete
}
[8953] Fix | Delete
#selectOnPointerEvent(event) {
[8954] Fix | Delete
const {
[8955] Fix | Delete
isMac
[8956] Fix | Delete
} = util_FeatureTest.platform;
[8957] Fix | Delete
if (event.ctrlKey && !isMac || event.shiftKey || event.metaKey && isMac) {
[8958] Fix | Delete
this.parent.toggleSelected(this);
[8959] Fix | Delete
} else {
[8960] Fix | Delete
this.parent.setSelected(this);
[8961] Fix | Delete
}
[8962] Fix | Delete
}
[8963] Fix | Delete
#setUpDragSession(event) {
[8964] Fix | Delete
const isSelected = this._uiManager.isSelected(this);
[8965] Fix | Delete
this._uiManager.setUpDragSession();
[8966] Fix | Delete
let pointerMoveOptions, pointerMoveCallback;
[8967] Fix | Delete
if (isSelected) {
[8968] Fix | Delete
this.div.classList.add("moving");
[8969] Fix | Delete
pointerMoveOptions = {
[8970] Fix | Delete
passive: true,
[8971] Fix | Delete
capture: true
[8972] Fix | Delete
};
[8973] Fix | Delete
this.#prevDragX = event.clientX;
[8974] Fix | Delete
this.#prevDragY = event.clientY;
[8975] Fix | Delete
pointerMoveCallback = e => {
[8976] Fix | Delete
const {
[8977] Fix | Delete
clientX: x,
[8978] Fix | Delete
clientY: y
[8979] Fix | Delete
} = e;
[8980] Fix | Delete
const [tx, ty] = this.screenToPageTranslation(x - this.#prevDragX, y - this.#prevDragY);
[8981] Fix | Delete
this.#prevDragX = x;
[8982] Fix | Delete
this.#prevDragY = y;
[8983] Fix | Delete
this._uiManager.dragSelectedEditors(tx, ty);
[8984] Fix | Delete
};
[8985] Fix | Delete
window.addEventListener("pointermove", pointerMoveCallback, pointerMoveOptions);
[8986] Fix | Delete
}
[8987] Fix | Delete
const pointerUpCallback = () => {
[8988] Fix | Delete
window.removeEventListener("pointerup", pointerUpCallback);
[8989] Fix | Delete
window.removeEventListener("blur", pointerUpCallback);
[8990] Fix | Delete
if (isSelected) {
[8991] Fix | Delete
this.div.classList.remove("moving");
[8992] Fix | Delete
window.removeEventListener("pointermove", pointerMoveCallback, pointerMoveOptions);
[8993] Fix | Delete
}
[8994] Fix | Delete
this.#hasBeenClicked = false;
[8995] Fix | Delete
if (!this._uiManager.endDragSession()) {
[8996] Fix | Delete
this.#selectOnPointerEvent(event);
[8997] Fix | Delete
}
[8998] Fix | Delete
};
[8999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function