DEV: zoom isn't used anymore (#18016)

This commit is contained in:
Jarek Radosz 2022-08-21 09:18:19 +02:00 committed by GitHub
parent 1284d746b0
commit d35ffe8361
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,15 +7,6 @@ import {
import { click, triggerEvent, visit } from "@ember/test-helpers";
async function triggerSwipeStart(touchTarget) {
// some tests are shown in a zoom viewport.
// boundingClientRect is affected by the zoom and need to be multiplied by the zoom effect.
// EG: if the element has a zoom of 50%, this DOUBLES the x and y positions and offsets.
// The numbers you get from getBoundingClientRect are seen as twice as large... however, the
// touch input still deals with the base inputs, not doubled. This allows us to convert for those environments.
let zoom = parseFloat(
window.getComputedStyle(document.querySelector("#ember-testing")).zoom || 1
);
// Other tests are shown in a transformed viewport, and this is a multiple for the offsets
let scale = parseFloat(
window
@ -26,13 +17,11 @@ async function triggerSwipeStart(touchTarget) {
const touchStart = {
touchTarget,
x:
zoom *
(touchTarget.getBoundingClientRect().x +
(scale * touchTarget.offsetWidth) / 2),
touchTarget.getBoundingClientRect().x +
(scale * touchTarget.offsetWidth) / 2,
y:
zoom *
(touchTarget.getBoundingClientRect().y +
(scale * touchTarget.offsetHeight) / 2),
touchTarget.getBoundingClientRect().y +
(scale * touchTarget.offsetHeight) / 2,
};
const touch = new Touch({
identifier: "test",