Moved polyfill from utils to own file

This commit is contained in:
Sebastian Kupke 2022-11-09 14:11:34 +01:00
parent 34792f20d6
commit 2987b820a9
7 changed files with 16 additions and 92 deletions

View File

@ -83764,7 +83764,7 @@ if (typeof pixi_viewport !== 'undefined') { Object.assign(this.PIXI, pixi_viewpo
window.convertPointFromNodeToPage = function (element, offsetX, offsetY) {
return new Point(offsetX, offsetY, 0).transformBy(getTransformationMatrix(element))
}
})()
})();
;(function () {
var module = {
@ -83989,7 +83989,7 @@ if (typeof pixi_viewport !== 'undefined') { Object.assign(this.PIXI, pixi_viewpo
})
}
}
})(jQuery)
})(jQuery);
(function () {

File diff suppressed because one or more lines are too long

View File

@ -8189,4 +8189,4 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
window.convertPointFromNodeToPage = function (element, offsetX, offsetY) {
return new Point(offsetX, offsetY, 0).transformBy(getTransformationMatrix(element))
}
})()
})();

View File

@ -80,4 +80,4 @@
window.convertPointFromNodeToPage = function (element, offsetX, offsetY) {
return new Point(offsetX, offsetY, 0).transformBy(getTransformationMatrix(element))
}
})()
})();

View File

@ -221,4 +221,4 @@
})
}
}
})(jQuery)
})(jQuery);

View File

@ -597,8 +597,6 @@ export default class Card {
// Prevents loading the link in the current tab.
if (event.type != 'Follow') {
event.preventDefault()
event.stopPropagation()
event.stopImmediatePropagation()
}
if (editable && event.type == 'click') {

View File

@ -411,96 +411,22 @@ export class Points {
}
static fromPageToNode(element, p) {
// if (window.webkitConvertPointFromPageToNode) {
// return window.webkitConvertPointFromPageToNode(element, new WebKitPoint(p.x, p.y))
// }
return convertPointFromPageToNode(element, p.x, p.y)
// if (window.webkitConvertPointFromPageToNode) {
// return window.webkitConvertPointFromPageToNode(element,
// new WebKitPoint(p.x, p.y))
// }
return window.convertPointFromPageToNode(element, p.x, p.y)
}
static fromNodeToPage(element, p) {
// if (window.webkitConvertPointFromNodeToPage) {
// return window.webkitConvertPointFromNodeToPage(element, new WebKitPoint(p.x, p.y))
// }
return convertPointFromNodeToPage(element, p.x, p.y)
// if (window.webkitConvertPointFromNodeToPage) {
// return window.webkitConvertPointFromNodeToPage(element,
// new WebKitPoint(p.x, p.y))
// }
return window.convertPointFromNodeToPage(element, p.x, p.y)
}
}
var I = typeof WebKitCSSMatrix == 'undefined' ? new DOMMatrix() : new WebKitCSSMatrix()
function Point(x, y, z) {
this.x = x
this.y = y
this.z = z
}
Point.prototype.transformBy = function (matrix) {
var tmp = matrix.multiply(I.translate(this.x, this.y, this.z))
return new Point(tmp.m41, tmp.m42, tmp.m43)
}
function createMatrix(transform) {
try {
return typeof WebKitCSSMatrix == 'undefined' ? new DOMMatrix(transform) : new WebKitCSSMatrix(transform)
} catch (e) {
console.warn(transform)
console.warn(e.toString())
return I
}
}
function getTransformationMatrix(element) {
var transformationMatrix = I
var x = element
while (x != undefined && x !== x.ownerDocument.documentElement) {
var computedStyle = window.getComputedStyle(x, undefined)
var transform = computedStyle.transform || 'none'
var c = transform === 'none' ? I : createMatrix(transform)
transformationMatrix = c.multiply(transformationMatrix)
x = x.parentNode
}
var w = element.offsetWidth
var h = element.offsetHeight
var i = 4
var left = +Infinity
var top = +Infinity
while (--i >= 0) {
var p = new Point(i === 0 || i === 1 ? 0 : w, i === 0 || i === 3 ? 0 : h, 0).transformBy(
transformationMatrix
)
if (p.x < left) {
left = p.x
}
if (p.y < top) {
top = p.y
}
}
var rect = element.getBoundingClientRect()
transformationMatrix = I.translate(
window.pageXOffset + rect.left - left,
window.pageYOffset + rect.top - top,
0
).multiply(transformationMatrix)
return transformationMatrix
}
var convertPointFromPageToNode = function (element, pageX, pageY) {
return new Point(pageX, pageY, 0).transformBy(getTransformationMatrix(element).inverse())
}
var convertPointFromNodeToPage = function (element, offsetX, offsetY) {
return new Point(offsetX, offsetY, 0).transformBy(getTransformationMatrix(element))
}
/**
* A helper class for common set operations.
*