Skip to content

Commit

Permalink
no dragging on small screens and further tweaking
Browse files Browse the repository at this point in the history
  • Loading branch information
jasper committed Sep 29, 2024
1 parent ca3864c commit 8f76cef
Show file tree
Hide file tree
Showing 9 changed files with 5,093 additions and 5,067 deletions.
4 changes: 2 additions & 2 deletions Application/AIS-catcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
#define VERSION "v0.60"
#define COPYRIGHT "jvde-github and other contributors"

#define VERSION_DESCRIBE "v0.60-115-g78c6a23d"
#define VERSION_URL_TAG "v0_60_115_g78c6a23d"
#define VERSION_DESCRIBE "1727609403"
#define VERSION_URL_TAG "1727609403"
4 changes: 2 additions & 2 deletions HTML/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<script src="https://cdn.jsdelivr.net/npm/ol@v10.0.0/dist/ol.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v10.0.0/ol.css">

<link rel="stylesheet" href="style_1727605515.css" />
<link rel="stylesheet" href="style_1727609403.css" />
<link rel="stylesheet" href="config.css" />

</head>
Expand Down Expand Up @@ -1006,7 +1006,7 @@
</div>
<div class="bottombar"></div>

<script src="script_1727605515.js"></script>
<script src="script_1727609403.js"></script>
<script src="config.js"></script>

<script>
Expand Down
1,557 changes: 778 additions & 779 deletions HTML/index_html.cpp

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions HTML/index_local.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<script src="cdn/npm/ol@v10.0.0/dist/ol.js"></script>
<link rel="stylesheet" href="cdn/npm/ol@v10.0.0/ol.css">

<link rel="stylesheet" href="style_v0_60_115_g78c6a23d.css" />
<link rel="stylesheet" href="style_1727609403.css" />
<link rel="stylesheet" href="config.css" />

</head>
Expand Down Expand Up @@ -1006,7 +1006,7 @@
</div>
<div class="bottombar"></div>

<script src="script_v0_60_115_g78c6a23d.js"></script>
<script src="script_1727609403.js"></script>
<script src="config.js"></script>

<script>
Expand Down
1,554 changes: 776 additions & 778 deletions HTML/index_local_html.cpp

Large diffs are not rendered by default.

34 changes: 24 additions & 10 deletions HTML/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4540,9 +4540,6 @@ function showShipcard(m, pixel = undefined) {
}


updateFocusMarker();
trackLayer.changed();

if (isShipcardMax()) {
toggleShipcardSize();
}
Expand All @@ -4555,6 +4552,9 @@ function showShipcard(m, pixel = undefined) {
aside.offsetHeight;
aside.style.display = '';
}

trackLayer.changed();
updateFocusMarker();
}

function compareObjects(obj1, obj2) {
Expand Down Expand Up @@ -5178,6 +5178,9 @@ addOverlayLayer("NOAA", new ol.layer.Tile({
})
}));

let isDraggingGlobal = false;
let clickPrevent = false;

function makeDraggable(element) {
let offsetX, offsetY;
let dragging = false;
Expand All @@ -5201,8 +5204,8 @@ function makeDraggable(element) {
if (!dragging && (Math.abs(dx) > moveThreshold || Math.abs(dy) > moveThreshold)) {
dragging = true;
isDraggingGlobal = true;
clickPrevent = true;
element.classList.add('dragging');
clickPrevent = true;
element.classList.add('dragging');

e.preventDefault();
}
Expand All @@ -5216,14 +5219,14 @@ function makeDraggable(element) {
function onDragEnd() {
if (dragging) {
isDraggingGlobal = false;
clickPrevent = true;
clickPrevent = true;
element.classList.remove('dragging');
}
dragging = false;
}

element.addEventListener('pointerdown', (e) => {
e.preventDefault();
e.preventDefault();
element.setPointerCapture(e.pointerId);
onDragStart(e.clientX, e.clientY);

Expand Down Expand Up @@ -5251,9 +5254,20 @@ function makeDraggable(element) {
});
}

document.querySelectorAll('.draggable').forEach(card => {
makeDraggable(card);
});
document.addEventListener('click', function (e) {
if (clickPrevent) {
e.preventDefault();
e.stopPropagation();
clickPrevent = false;
}
}, true);


if (!window.matchMedia('(max-width: 500px), (max-height: 800px)').matches) {
document.querySelectorAll('.draggable').forEach(card => {
makeDraggable(card);
});
}


let mdabout = "This content can be defined by the owner of the station";
Expand Down
2,136 changes: 1,070 additions & 1,066 deletions HTML/script_js.cpp

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions HTML/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ html {
touch-action: none;
}

.draggable {
cursor: grab;
}

.draggable.dragging {
cursor: grabbing;
}


a {
color: var(--link-color);
text-decoration: none;
Expand Down Expand Up @@ -606,7 +615,7 @@ td {
z-index: 100;
font-size: 12px;
background-color: rgba(var(--menu-background-color), 0.6) !important;
background-color: rgba(0,0,0, 0.2) !important;
background-color: rgba(0, 0, 0, 0.2) !important;
color: var(--menu-font-color) !important;
color: white !important;
text-align: center;
Expand Down Expand Up @@ -2311,4 +2320,4 @@ td {
background-color: var(--menu-background-color);
cursor: pointer;
border: none;
}
}
4,854 changes: 2,428 additions & 2,426 deletions HTML/style_css.cpp

Large diffs are not rendered by default.

0 comments on commit 8f76cef

Please sign in to comment.