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
rotate(angle) {
[22000] Fix | Delete
const {
[22001] Fix | Delete
drawLayer
[22002] Fix | Delete
} = this.parent;
[22003] Fix | Delete
let box;
[22004] Fix | Delete
if (this.#isFreeHighlight) {
[22005] Fix | Delete
angle = (angle - this.rotation + 360) % 360;
[22006] Fix | Delete
box = HighlightEditor.#rotateBbox(this.#highlightOutlines.box, angle);
[22007] Fix | Delete
} else {
[22008] Fix | Delete
box = HighlightEditor.#rotateBbox(this, angle);
[22009] Fix | Delete
}
[22010] Fix | Delete
drawLayer.rotate(this.#id, angle);
[22011] Fix | Delete
drawLayer.rotate(this.#outlineId, angle);
[22012] Fix | Delete
drawLayer.updateBox(this.#id, box);
[22013] Fix | Delete
drawLayer.updateBox(this.#outlineId, HighlightEditor.#rotateBbox(this.#focusOutlines.box, angle));
[22014] Fix | Delete
}
[22015] Fix | Delete
render() {
[22016] Fix | Delete
if (this.div) {
[22017] Fix | Delete
return this.div;
[22018] Fix | Delete
}
[22019] Fix | Delete
const div = super.render();
[22020] Fix | Delete
if (this.#text) {
[22021] Fix | Delete
div.setAttribute("aria-label", this.#text);
[22022] Fix | Delete
div.setAttribute("role", "mark");
[22023] Fix | Delete
}
[22024] Fix | Delete
if (this.#isFreeHighlight) {
[22025] Fix | Delete
div.classList.add("free");
[22026] Fix | Delete
} else {
[22027] Fix | Delete
this.div.addEventListener("keydown", this.#boundKeydown);
[22028] Fix | Delete
}
[22029] Fix | Delete
const highlightDiv = this.#highlightDiv = document.createElement("div");
[22030] Fix | Delete
div.append(highlightDiv);
[22031] Fix | Delete
highlightDiv.setAttribute("aria-hidden", "true");
[22032] Fix | Delete
highlightDiv.className = "internal";
[22033] Fix | Delete
highlightDiv.style.clipPath = this.#clipPathId;
[22034] Fix | Delete
const [parentWidth, parentHeight] = this.parentDimensions;
[22035] Fix | Delete
this.setDims(this.width * parentWidth, this.height * parentHeight);
[22036] Fix | Delete
bindEvents(this, this.#highlightDiv, ["pointerover", "pointerleave"]);
[22037] Fix | Delete
this.enableEditing();
[22038] Fix | Delete
return div;
[22039] Fix | Delete
}
[22040] Fix | Delete
pointerover() {
[22041] Fix | Delete
this.parent.drawLayer.addClass(this.#outlineId, "hovered");
[22042] Fix | Delete
}
[22043] Fix | Delete
pointerleave() {
[22044] Fix | Delete
this.parent.drawLayer.removeClass(this.#outlineId, "hovered");
[22045] Fix | Delete
}
[22046] Fix | Delete
#keydown(event) {
[22047] Fix | Delete
HighlightEditor._keyboardManager.exec(this, event);
[22048] Fix | Delete
}
[22049] Fix | Delete
_moveCaret(direction) {
[22050] Fix | Delete
this.parent.unselect(this);
[22051] Fix | Delete
switch (direction) {
[22052] Fix | Delete
case 0:
[22053] Fix | Delete
case 2:
[22054] Fix | Delete
this.#setCaret(true);
[22055] Fix | Delete
break;
[22056] Fix | Delete
case 1:
[22057] Fix | Delete
case 3:
[22058] Fix | Delete
this.#setCaret(false);
[22059] Fix | Delete
break;
[22060] Fix | Delete
}
[22061] Fix | Delete
}
[22062] Fix | Delete
#setCaret(start) {
[22063] Fix | Delete
if (!this.#anchorNode) {
[22064] Fix | Delete
return;
[22065] Fix | Delete
}
[22066] Fix | Delete
const selection = window.getSelection();
[22067] Fix | Delete
if (start) {
[22068] Fix | Delete
selection.setPosition(this.#anchorNode, this.#anchorOffset);
[22069] Fix | Delete
} else {
[22070] Fix | Delete
selection.setPosition(this.#focusNode, this.#focusOffset);
[22071] Fix | Delete
}
[22072] Fix | Delete
}
[22073] Fix | Delete
select() {
[22074] Fix | Delete
super.select();
[22075] Fix | Delete
if (!this.#outlineId) {
[22076] Fix | Delete
return;
[22077] Fix | Delete
}
[22078] Fix | Delete
this.parent?.drawLayer.removeClass(this.#outlineId, "hovered");
[22079] Fix | Delete
this.parent?.drawLayer.addClass(this.#outlineId, "selected");
[22080] Fix | Delete
}
[22081] Fix | Delete
unselect() {
[22082] Fix | Delete
super.unselect();
[22083] Fix | Delete
if (!this.#outlineId) {
[22084] Fix | Delete
return;
[22085] Fix | Delete
}
[22086] Fix | Delete
this.parent?.drawLayer.removeClass(this.#outlineId, "selected");
[22087] Fix | Delete
if (!this.#isFreeHighlight) {
[22088] Fix | Delete
this.#setCaret(false);
[22089] Fix | Delete
}
[22090] Fix | Delete
}
[22091] Fix | Delete
get _mustFixPosition() {
[22092] Fix | Delete
return !this.#isFreeHighlight;
[22093] Fix | Delete
}
[22094] Fix | Delete
show(visible = this._isVisible) {
[22095] Fix | Delete
super.show(visible);
[22096] Fix | Delete
if (this.parent) {
[22097] Fix | Delete
this.parent.drawLayer.show(this.#id, visible);
[22098] Fix | Delete
this.parent.drawLayer.show(this.#outlineId, visible);
[22099] Fix | Delete
}
[22100] Fix | Delete
}
[22101] Fix | Delete
#getRotation() {
[22102] Fix | Delete
return this.#isFreeHighlight ? this.rotation : 0;
[22103] Fix | Delete
}
[22104] Fix | Delete
#serializeBoxes() {
[22105] Fix | Delete
if (this.#isFreeHighlight) {
[22106] Fix | Delete
return null;
[22107] Fix | Delete
}
[22108] Fix | Delete
const [pageWidth, pageHeight] = this.pageDimensions;
[22109] Fix | Delete
const boxes = this.#boxes;
[22110] Fix | Delete
const quadPoints = new Array(boxes.length * 8);
[22111] Fix | Delete
let i = 0;
[22112] Fix | Delete
for (const {
[22113] Fix | Delete
x,
[22114] Fix | Delete
y,
[22115] Fix | Delete
width,
[22116] Fix | Delete
height
[22117] Fix | Delete
} of boxes) {
[22118] Fix | Delete
const sx = x * pageWidth;
[22119] Fix | Delete
const sy = (1 - y - height) * pageHeight;
[22120] Fix | Delete
quadPoints[i] = quadPoints[i + 4] = sx;
[22121] Fix | Delete
quadPoints[i + 1] = quadPoints[i + 3] = sy;
[22122] Fix | Delete
quadPoints[i + 2] = quadPoints[i + 6] = sx + width * pageWidth;
[22123] Fix | Delete
quadPoints[i + 5] = quadPoints[i + 7] = sy + height * pageHeight;
[22124] Fix | Delete
i += 8;
[22125] Fix | Delete
}
[22126] Fix | Delete
return quadPoints;
[22127] Fix | Delete
}
[22128] Fix | Delete
#serializeOutlines(rect) {
[22129] Fix | Delete
return this.#highlightOutlines.serialize(rect, this.#getRotation());
[22130] Fix | Delete
}
[22131] Fix | Delete
static startHighlighting(parent, isLTR, {
[22132] Fix | Delete
target: textLayer,
[22133] Fix | Delete
x,
[22134] Fix | Delete
y
[22135] Fix | Delete
}) {
[22136] Fix | Delete
const {
[22137] Fix | Delete
x: layerX,
[22138] Fix | Delete
y: layerY,
[22139] Fix | Delete
width: parentWidth,
[22140] Fix | Delete
height: parentHeight
[22141] Fix | Delete
} = textLayer.getBoundingClientRect();
[22142] Fix | Delete
const pointerMove = e => {
[22143] Fix | Delete
this.#highlightMove(parent, e);
[22144] Fix | Delete
};
[22145] Fix | Delete
const pointerDownOptions = {
[22146] Fix | Delete
capture: true,
[22147] Fix | Delete
passive: false
[22148] Fix | Delete
};
[22149] Fix | Delete
const pointerDown = e => {
[22150] Fix | Delete
e.preventDefault();
[22151] Fix | Delete
e.stopPropagation();
[22152] Fix | Delete
};
[22153] Fix | Delete
const pointerUpCallback = e => {
[22154] Fix | Delete
textLayer.removeEventListener("pointermove", pointerMove);
[22155] Fix | Delete
window.removeEventListener("blur", pointerUpCallback);
[22156] Fix | Delete
window.removeEventListener("pointerup", pointerUpCallback);
[22157] Fix | Delete
window.removeEventListener("pointerdown", pointerDown, pointerDownOptions);
[22158] Fix | Delete
window.removeEventListener("contextmenu", noContextMenu);
[22159] Fix | Delete
this.#endHighlight(parent, e);
[22160] Fix | Delete
};
[22161] Fix | Delete
window.addEventListener("blur", pointerUpCallback);
[22162] Fix | Delete
window.addEventListener("pointerup", pointerUpCallback);
[22163] Fix | Delete
window.addEventListener("pointerdown", pointerDown, pointerDownOptions);
[22164] Fix | Delete
window.addEventListener("contextmenu", noContextMenu);
[22165] Fix | Delete
textLayer.addEventListener("pointermove", pointerMove);
[22166] Fix | Delete
this._freeHighlight = new FreeOutliner({
[22167] Fix | Delete
x,
[22168] Fix | Delete
y
[22169] Fix | Delete
}, [layerX, layerY, parentWidth, parentHeight], parent.scale, this._defaultThickness / 2, isLTR, 0.001);
[22170] Fix | Delete
({
[22171] Fix | Delete
id: this._freeHighlightId,
[22172] Fix | Delete
clipPathId: this._freeHighlightClipId
[22173] Fix | Delete
} = parent.drawLayer.highlight(this._freeHighlight, this._defaultColor, this._defaultOpacity, true));
[22174] Fix | Delete
}
[22175] Fix | Delete
static #highlightMove(parent, event) {
[22176] Fix | Delete
if (this._freeHighlight.add(event)) {
[22177] Fix | Delete
parent.drawLayer.updatePath(this._freeHighlightId, this._freeHighlight);
[22178] Fix | Delete
}
[22179] Fix | Delete
}
[22180] Fix | Delete
static #endHighlight(parent, event) {
[22181] Fix | Delete
if (!this._freeHighlight.isEmpty()) {
[22182] Fix | Delete
parent.createAndAddNewEditor(event, false, {
[22183] Fix | Delete
highlightId: this._freeHighlightId,
[22184] Fix | Delete
highlightOutlines: this._freeHighlight.getOutlines(),
[22185] Fix | Delete
clipPathId: this._freeHighlightClipId,
[22186] Fix | Delete
methodOfCreation: "main_toolbar"
[22187] Fix | Delete
});
[22188] Fix | Delete
} else {
[22189] Fix | Delete
parent.drawLayer.removeFreeHighlight(this._freeHighlightId);
[22190] Fix | Delete
}
[22191] Fix | Delete
this._freeHighlightId = -1;
[22192] Fix | Delete
this._freeHighlight = null;
[22193] Fix | Delete
this._freeHighlightClipId = "";
[22194] Fix | Delete
}
[22195] Fix | Delete
static deserialize(data, parent, uiManager) {
[22196] Fix | Delete
const editor = super.deserialize(data, parent, uiManager);
[22197] Fix | Delete
const {
[22198] Fix | Delete
rect: [blX, blY, trX, trY],
[22199] Fix | Delete
color,
[22200] Fix | Delete
quadPoints
[22201] Fix | Delete
} = data;
[22202] Fix | Delete
editor.color = Util.makeHexColor(...color);
[22203] Fix | Delete
editor.#opacity = data.opacity;
[22204] Fix | Delete
const [pageWidth, pageHeight] = editor.pageDimensions;
[22205] Fix | Delete
editor.width = (trX - blX) / pageWidth;
[22206] Fix | Delete
editor.height = (trY - blY) / pageHeight;
[22207] Fix | Delete
const boxes = editor.#boxes = [];
[22208] Fix | Delete
for (let i = 0; i < quadPoints.length; i += 8) {
[22209] Fix | Delete
boxes.push({
[22210] Fix | Delete
x: (quadPoints[4] - trX) / pageWidth,
[22211] Fix | Delete
y: (trY - (1 - quadPoints[i + 5])) / pageHeight,
[22212] Fix | Delete
width: (quadPoints[i + 2] - quadPoints[i]) / pageWidth,
[22213] Fix | Delete
height: (quadPoints[i + 5] - quadPoints[i + 1]) / pageHeight
[22214] Fix | Delete
});
[22215] Fix | Delete
}
[22216] Fix | Delete
editor.#createOutlines();
[22217] Fix | Delete
return editor;
[22218] Fix | Delete
}
[22219] Fix | Delete
serialize(isForCopying = false) {
[22220] Fix | Delete
if (this.isEmpty() || isForCopying) {
[22221] Fix | Delete
return null;
[22222] Fix | Delete
}
[22223] Fix | Delete
const rect = this.getRect(0, 0);
[22224] Fix | Delete
const color = AnnotationEditor._colorManager.convert(this.color);
[22225] Fix | Delete
return {
[22226] Fix | Delete
annotationType: AnnotationEditorType.HIGHLIGHT,
[22227] Fix | Delete
color,
[22228] Fix | Delete
opacity: this.#opacity,
[22229] Fix | Delete
thickness: this.#thickness,
[22230] Fix | Delete
quadPoints: this.#serializeBoxes(),
[22231] Fix | Delete
outlines: this.#serializeOutlines(rect),
[22232] Fix | Delete
pageIndex: this.pageIndex,
[22233] Fix | Delete
rect,
[22234] Fix | Delete
rotation: this.#getRotation(),
[22235] Fix | Delete
structTreeParentId: this._structTreeParentId
[22236] Fix | Delete
};
[22237] Fix | Delete
}
[22238] Fix | Delete
static canCreateNewEmptyEditor() {
[22239] Fix | Delete
return false;
[22240] Fix | Delete
}
[22241] Fix | Delete
}
[22242] Fix | Delete
[22243] Fix | Delete
;// CONCATENATED MODULE: ./src/display/editor/ink.js
[22244] Fix | Delete
[22245] Fix | Delete
[22246] Fix | Delete
[22247] Fix | Delete
[22248] Fix | Delete
[22249] Fix | Delete
[22250] Fix | Delete
[22251] Fix | Delete
class InkEditor extends AnnotationEditor {
[22252] Fix | Delete
#baseHeight = 0;
[22253] Fix | Delete
#baseWidth = 0;
[22254] Fix | Delete
#boundCanvasPointermove = this.canvasPointermove.bind(this);
[22255] Fix | Delete
#boundCanvasPointerleave = this.canvasPointerleave.bind(this);
[22256] Fix | Delete
#boundCanvasPointerup = this.canvasPointerup.bind(this);
[22257] Fix | Delete
#boundCanvasPointerdown = this.canvasPointerdown.bind(this);
[22258] Fix | Delete
#canvasContextMenuTimeoutId = null;
[22259] Fix | Delete
#currentPath2D = new Path2D();
[22260] Fix | Delete
#disableEditing = false;
[22261] Fix | Delete
#hasSomethingToDraw = false;
[22262] Fix | Delete
#isCanvasInitialized = false;
[22263] Fix | Delete
#observer = null;
[22264] Fix | Delete
#realWidth = 0;
[22265] Fix | Delete
#realHeight = 0;
[22266] Fix | Delete
#requestFrameCallback = null;
[22267] Fix | Delete
static _defaultColor = null;
[22268] Fix | Delete
static _defaultOpacity = 1;
[22269] Fix | Delete
static _defaultThickness = 1;
[22270] Fix | Delete
static _type = "ink";
[22271] Fix | Delete
static _editorType = AnnotationEditorType.INK;
[22272] Fix | Delete
constructor(params) {
[22273] Fix | Delete
super({
[22274] Fix | Delete
...params,
[22275] Fix | Delete
name: "inkEditor"
[22276] Fix | Delete
});
[22277] Fix | Delete
this.color = params.color || null;
[22278] Fix | Delete
this.thickness = params.thickness || null;
[22279] Fix | Delete
this.opacity = params.opacity || null;
[22280] Fix | Delete
this.paths = [];
[22281] Fix | Delete
this.bezierPath2D = [];
[22282] Fix | Delete
this.allRawPaths = [];
[22283] Fix | Delete
this.currentPath = [];
[22284] Fix | Delete
this.scaleFactor = 1;
[22285] Fix | Delete
this.translationX = this.translationY = 0;
[22286] Fix | Delete
this.x = 0;
[22287] Fix | Delete
this.y = 0;
[22288] Fix | Delete
this._willKeepAspectRatio = true;
[22289] Fix | Delete
}
[22290] Fix | Delete
static initialize(l10n, uiManager) {
[22291] Fix | Delete
AnnotationEditor.initialize(l10n, uiManager);
[22292] Fix | Delete
}
[22293] Fix | Delete
static updateDefaultParams(type, value) {
[22294] Fix | Delete
switch (type) {
[22295] Fix | Delete
case AnnotationEditorParamsType.INK_THICKNESS:
[22296] Fix | Delete
InkEditor._defaultThickness = value;
[22297] Fix | Delete
break;
[22298] Fix | Delete
case AnnotationEditorParamsType.INK_COLOR:
[22299] Fix | Delete
InkEditor._defaultColor = value;
[22300] Fix | Delete
break;
[22301] Fix | Delete
case AnnotationEditorParamsType.INK_OPACITY:
[22302] Fix | Delete
InkEditor._defaultOpacity = value / 100;
[22303] Fix | Delete
break;
[22304] Fix | Delete
}
[22305] Fix | Delete
}
[22306] Fix | Delete
updateParams(type, value) {
[22307] Fix | Delete
switch (type) {
[22308] Fix | Delete
case AnnotationEditorParamsType.INK_THICKNESS:
[22309] Fix | Delete
this.#updateThickness(value);
[22310] Fix | Delete
break;
[22311] Fix | Delete
case AnnotationEditorParamsType.INK_COLOR:
[22312] Fix | Delete
this.#updateColor(value);
[22313] Fix | Delete
break;
[22314] Fix | Delete
case AnnotationEditorParamsType.INK_OPACITY:
[22315] Fix | Delete
this.#updateOpacity(value);
[22316] Fix | Delete
break;
[22317] Fix | Delete
}
[22318] Fix | Delete
}
[22319] Fix | Delete
static get defaultPropertiesToUpdate() {
[22320] Fix | Delete
return [[AnnotationEditorParamsType.INK_THICKNESS, InkEditor._defaultThickness], [AnnotationEditorParamsType.INK_COLOR, InkEditor._defaultColor || AnnotationEditor._defaultLineColor], [AnnotationEditorParamsType.INK_OPACITY, Math.round(InkEditor._defaultOpacity * 100)]];
[22321] Fix | Delete
}
[22322] Fix | Delete
get propertiesToUpdate() {
[22323] Fix | Delete
return [[AnnotationEditorParamsType.INK_THICKNESS, this.thickness || InkEditor._defaultThickness], [AnnotationEditorParamsType.INK_COLOR, this.color || InkEditor._defaultColor || AnnotationEditor._defaultLineColor], [AnnotationEditorParamsType.INK_OPACITY, Math.round(100 * (this.opacity ?? InkEditor._defaultOpacity))]];
[22324] Fix | Delete
}
[22325] Fix | Delete
#updateThickness(thickness) {
[22326] Fix | Delete
const setThickness = th => {
[22327] Fix | Delete
this.thickness = th;
[22328] Fix | Delete
this.#fitToContent();
[22329] Fix | Delete
};
[22330] Fix | Delete
const savedThickness = this.thickness;
[22331] Fix | Delete
this.addCommands({
[22332] Fix | Delete
cmd: setThickness.bind(this, thickness),
[22333] Fix | Delete
undo: setThickness.bind(this, savedThickness),
[22334] Fix | Delete
post: this._uiManager.updateUI.bind(this._uiManager, this),
[22335] Fix | Delete
mustExec: true,
[22336] Fix | Delete
type: AnnotationEditorParamsType.INK_THICKNESS,
[22337] Fix | Delete
overwriteIfSameType: true,
[22338] Fix | Delete
keepUndo: true
[22339] Fix | Delete
});
[22340] Fix | Delete
}
[22341] Fix | Delete
#updateColor(color) {
[22342] Fix | Delete
const setColor = col => {
[22343] Fix | Delete
this.color = col;
[22344] Fix | Delete
this.#redraw();
[22345] Fix | Delete
};
[22346] Fix | Delete
const savedColor = this.color;
[22347] Fix | Delete
this.addCommands({
[22348] Fix | Delete
cmd: setColor.bind(this, color),
[22349] Fix | Delete
undo: setColor.bind(this, savedColor),
[22350] Fix | Delete
post: this._uiManager.updateUI.bind(this._uiManager, this),
[22351] Fix | Delete
mustExec: true,
[22352] Fix | Delete
type: AnnotationEditorParamsType.INK_COLOR,
[22353] Fix | Delete
overwriteIfSameType: true,
[22354] Fix | Delete
keepUndo: true
[22355] Fix | Delete
});
[22356] Fix | Delete
}
[22357] Fix | Delete
#updateOpacity(opacity) {
[22358] Fix | Delete
const setOpacity = op => {
[22359] Fix | Delete
this.opacity = op;
[22360] Fix | Delete
this.#redraw();
[22361] Fix | Delete
};
[22362] Fix | Delete
opacity /= 100;
[22363] Fix | Delete
const savedOpacity = this.opacity;
[22364] Fix | Delete
this.addCommands({
[22365] Fix | Delete
cmd: setOpacity.bind(this, opacity),
[22366] Fix | Delete
undo: setOpacity.bind(this, savedOpacity),
[22367] Fix | Delete
post: this._uiManager.updateUI.bind(this._uiManager, this),
[22368] Fix | Delete
mustExec: true,
[22369] Fix | Delete
type: AnnotationEditorParamsType.INK_OPACITY,
[22370] Fix | Delete
overwriteIfSameType: true,
[22371] Fix | Delete
keepUndo: true
[22372] Fix | Delete
});
[22373] Fix | Delete
}
[22374] Fix | Delete
rebuild() {
[22375] Fix | Delete
if (!this.parent) {
[22376] Fix | Delete
return;
[22377] Fix | Delete
}
[22378] Fix | Delete
super.rebuild();
[22379] Fix | Delete
if (this.div === null) {
[22380] Fix | Delete
return;
[22381] Fix | Delete
}
[22382] Fix | Delete
if (!this.canvas) {
[22383] Fix | Delete
this.#createCanvas();
[22384] Fix | Delete
this.#createObserver();
[22385] Fix | Delete
}
[22386] Fix | Delete
if (!this.isAttachedToDOM) {
[22387] Fix | Delete
this.parent.add(this);
[22388] Fix | Delete
this.#setCanvasDims();
[22389] Fix | Delete
}
[22390] Fix | Delete
this.#fitToContent();
[22391] Fix | Delete
}
[22392] Fix | Delete
remove() {
[22393] Fix | Delete
if (this.canvas === null) {
[22394] Fix | Delete
return;
[22395] Fix | Delete
}
[22396] Fix | Delete
if (!this.isEmpty()) {
[22397] Fix | Delete
this.commit();
[22398] Fix | Delete
}
[22399] Fix | Delete
this.canvas.width = this.canvas.height = 0;
[22400] Fix | Delete
this.canvas.remove();
[22401] Fix | Delete
this.canvas = null;
[22402] Fix | Delete
if (this.#canvasContextMenuTimeoutId) {
[22403] Fix | Delete
clearTimeout(this.#canvasContextMenuTimeoutId);
[22404] Fix | Delete
this.#canvasContextMenuTimeoutId = null;
[22405] Fix | Delete
}
[22406] Fix | Delete
this.#observer.disconnect();
[22407] Fix | Delete
this.#observer = null;
[22408] Fix | Delete
super.remove();
[22409] Fix | Delete
}
[22410] Fix | Delete
setParent(parent) {
[22411] Fix | Delete
if (!this.parent && parent) {
[22412] Fix | Delete
this._uiManager.removeShouldRescale(this);
[22413] Fix | Delete
} else if (this.parent && parent === null) {
[22414] Fix | Delete
this._uiManager.addShouldRescale(this);
[22415] Fix | Delete
}
[22416] Fix | Delete
super.setParent(parent);
[22417] Fix | Delete
}
[22418] Fix | Delete
onScaleChanging() {
[22419] Fix | Delete
const [parentWidth, parentHeight] = this.parentDimensions;
[22420] Fix | Delete
const width = this.width * parentWidth;
[22421] Fix | Delete
const height = this.height * parentHeight;
[22422] Fix | Delete
this.setDimensions(width, height);
[22423] Fix | Delete
}
[22424] Fix | Delete
enableEditMode() {
[22425] Fix | Delete
if (this.#disableEditing || this.canvas === null) {
[22426] Fix | Delete
return;
[22427] Fix | Delete
}
[22428] Fix | Delete
super.enableEditMode();
[22429] Fix | Delete
this._isDraggable = false;
[22430] Fix | Delete
this.canvas.addEventListener("pointerdown", this.#boundCanvasPointerdown);
[22431] Fix | Delete
}
[22432] Fix | Delete
disableEditMode() {
[22433] Fix | Delete
if (!this.isInEditMode() || this.canvas === null) {
[22434] Fix | Delete
return;
[22435] Fix | Delete
}
[22436] Fix | Delete
super.disableEditMode();
[22437] Fix | Delete
this._isDraggable = !this.isEmpty();
[22438] Fix | Delete
this.div.classList.remove("editing");
[22439] Fix | Delete
this.canvas.removeEventListener("pointerdown", this.#boundCanvasPointerdown);
[22440] Fix | Delete
}
[22441] Fix | Delete
onceAdded() {
[22442] Fix | Delete
this._isDraggable = !this.isEmpty();
[22443] Fix | Delete
}
[22444] Fix | Delete
isEmpty() {
[22445] Fix | Delete
return this.paths.length === 0 || this.paths.length === 1 && this.paths[0].length === 0;
[22446] Fix | Delete
}
[22447] Fix | Delete
#getInitialBBox() {
[22448] Fix | Delete
const {
[22449] Fix | Delete
parentRotation,
[22450] Fix | Delete
parentDimensions: [width, height]
[22451] Fix | Delete
} = this;
[22452] Fix | Delete
switch (parentRotation) {
[22453] Fix | Delete
case 90:
[22454] Fix | Delete
return [0, height, height, width];
[22455] Fix | Delete
case 180:
[22456] Fix | Delete
return [width, height, width, height];
[22457] Fix | Delete
case 270:
[22458] Fix | Delete
return [width, 0, height, width];
[22459] Fix | Delete
default:
[22460] Fix | Delete
return [0, 0, width, height];
[22461] Fix | Delete
}
[22462] Fix | Delete
}
[22463] Fix | Delete
#setStroke() {
[22464] Fix | Delete
const {
[22465] Fix | Delete
ctx,
[22466] Fix | Delete
color,
[22467] Fix | Delete
opacity,
[22468] Fix | Delete
thickness,
[22469] Fix | Delete
parentScale,
[22470] Fix | Delete
scaleFactor
[22471] Fix | Delete
} = this;
[22472] Fix | Delete
ctx.lineWidth = thickness * parentScale / scaleFactor;
[22473] Fix | Delete
ctx.lineCap = "round";
[22474] Fix | Delete
ctx.lineJoin = "round";
[22475] Fix | Delete
ctx.miterLimit = 10;
[22476] Fix | Delete
ctx.strokeStyle = `${color}${opacityToHex(opacity)}`;
[22477] Fix | Delete
}
[22478] Fix | Delete
#startDrawing(x, y) {
[22479] Fix | Delete
this.canvas.addEventListener("contextmenu", noContextMenu);
[22480] Fix | Delete
this.canvas.addEventListener("pointerleave", this.#boundCanvasPointerleave);
[22481] Fix | Delete
this.canvas.addEventListener("pointermove", this.#boundCanvasPointermove);
[22482] Fix | Delete
this.canvas.addEventListener("pointerup", this.#boundCanvasPointerup);
[22483] Fix | Delete
this.canvas.removeEventListener("pointerdown", this.#boundCanvasPointerdown);
[22484] Fix | Delete
this.isEditing = true;
[22485] Fix | Delete
if (!this.#isCanvasInitialized) {
[22486] Fix | Delete
this.#isCanvasInitialized = true;
[22487] Fix | Delete
this.#setCanvasDims();
[22488] Fix | Delete
this.thickness ||= InkEditor._defaultThickness;
[22489] Fix | Delete
this.color ||= InkEditor._defaultColor || AnnotationEditor._defaultLineColor;
[22490] Fix | Delete
this.opacity ??= InkEditor._defaultOpacity;
[22491] Fix | Delete
}
[22492] Fix | Delete
this.currentPath.push([x, y]);
[22493] Fix | Delete
this.#hasSomethingToDraw = false;
[22494] Fix | Delete
this.#setStroke();
[22495] Fix | Delete
this.#requestFrameCallback = () => {
[22496] Fix | Delete
this.#drawPoints();
[22497] Fix | Delete
if (this.#requestFrameCallback) {
[22498] Fix | Delete
window.requestAnimationFrame(this.#requestFrameCallback);
[22499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function