Skip to content

Commit

Permalink
Responsive UI test 6
Browse files Browse the repository at this point in the history
  • Loading branch information
hayk-kerobyan committed May 22, 2024
1 parent fb5ce90 commit 27fbc51
Show file tree
Hide file tree
Showing 99 changed files with 121 additions and 316 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion composeApp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion composeApp.js.map

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Large diffs are not rendered by default.

89 changes: 6 additions & 83 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,90 +2,13 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<script>
window.addEventListener("load", function(){ onLoad() } );
// Sets the viewport to the correct size for mobile devices
function onLoad() {
window.setTimeout(function() {
// Replace the default viewport for mobile with one that uses the devicePixelRatio
let meta = document.querySelector('meta[name="viewport"]')
meta.content = calcMetaViewportContent(innerWidth);
document.head.appendChild(meta);
}, 5);
}

screen.orientation.addEventListener("change", (event) => {
const type = event.target.type;
const angle = event.target.angle;
var calcWidth;

// Reset to default viewport for mobile
let meta = document.querySelector('meta[name="viewport"]')
meta.content = "width=device-width, initial-scale=1";

// Adjust the viewport for mobile after orientation change.
setTimeout(() => {
meta.content = calcMetaViewportContent();
}, 50);
});

function calcMetaViewportContent(actualWidth) {
var calcWidth;

if(actualWidth != undefined) {
calcWidth = actualWidth;
} else {
if (screen.orientation.type.includes("landscape")) {
calcWidth = screen.height;
} else {
calcWidth = screen.width;
}
}

return "width=" + ((calcWidth * getDevicePixelRatio())/2) + ", initial-scale=1.0";
}

function getDevicePixelRatio() {
var mediaQuery;
var is_firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
if (window.devicePixelRatio !== undefined && !is_firefox) {
return window.devicePixelRatio;
} else if (window.matchMedia) {
mediaQuery = "(-webkit-min-device-pixel-ratio: 1.5),\
(min--moz-device-pixel-ratio: 1.5),\
(-o-min-device-pixel-ratio: 3/2),\
(min-resolution: 1.5dppx)";
if (window.matchMedia(mediaQuery).matches) {
return 1.5;
}
mediaQuery = "(-webkit-min-device-pixel-ratio: 2),\
(min--moz-device-pixel-ratio: 2),\
(-o-min-device-pixel-ratio: 2/1),\
(min-resolution: 2dppx)";
if (window.matchMedia(mediaQuery).matches) {
return 2;
}
mediaQuery = "(-webkit-min-device-pixel-ratio: 0.75),\
(min--moz-device-pixel-ratio: 0.75),\
(-o-min-device-pixel-ratio: 3/4),\
(min-resolution: 0.75dppx)";
if (window.matchMedia(mediaQuery).matches) {
return 0.7;
}
} else {
return 1;
}
}
</script>
<title>PassaporteAuPair</title>
<script type="application/javascript" src="skiko.js"></script>
<script type="application/javascript" src="composeApp.js"></script>
<meta name=“viewport” content=“width=device-width, initial-scale=1.0">
<title>Passaporte AuPair</title>
<link type="text/css" rel="stylesheet" href="styles.css">
<script src="skiko.js"></script>
<script type="application/javascript" src="composeApp.js" defer></script>
</head>
<body>
<div>
<canvas id="ComposeTarget"></canvas>
</div>
<div id="composeTarget"></div>
</body>
</html>
2 changes: 1 addition & 1 deletion skiko.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion skiko.mjs

Large diffs are not rendered by default.

Binary file modified skiko.wasm
Binary file not shown.
17 changes: 17 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}

h1 {
padding: 0 16px;
font-size: 2em;
}

#composeTarget {
width: 100%;
height: 100%;
}
229 changes: 0 additions & 229 deletions values/strings.xml

This file was deleted.

0 comments on commit 27fbc51

Please sign in to comment.