Skip to content

Commit

Permalink
Make buttons, inputs, & selects larger on small screens where...
Browse files Browse the repository at this point in the history
...fine pointing device isn't detected (touch screens)

#417
  • Loading branch information
AntumDeluge committed Apr 26, 2024
1 parent 7a00021 commit 3d4a30c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
25 changes: 25 additions & 0 deletions src/js/css/res.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

/* small screens without fine pointing device (touch) */
@media screen and (max-width: 1080px) and ((pointer: none) or (pointer: coarse)) {
button {
min-height: 2em;
min-width: 2em;
}

.actionbutton + .actionbutton {
margin-top: 4px;
}

input[type=text], input[type=number] {
min-height: 1.5em;
}

input[type=checkbox] {
min-height: 1.2em;
min-width: 1.2em;
}

select {
min-height: 2.2em;
}
}
1 change: 1 addition & 0 deletions src/js/stendhal.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<title>Stendhal</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/font.css">
<link rel="stylesheet" type="text/css" href="css/res.css">
<meta name="viewport" content="interactive-widget=resizes-content">
</head>

Expand Down
6 changes: 3 additions & 3 deletions src/js/stendhal/ui/dialog/ActionContextMenu.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
* (C) Copyright 2015-2023 - Faiumoni e. V. *
* (C) Copyright 2015-2024 - Faiumoni e. V. *
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
Expand Down Expand Up @@ -28,9 +28,9 @@ export class ActionContextMenu extends Component {
this.appendActions = append;
this.gatherActions();

var content = "<div class=\"actionmenu\">";
var content = "<div class=\"actionmenu verticalgroup\">";
for (var i = 0; i < this.actions.length; i++) {
content += "<button id=\"actionbutton." + i + "\">" + stendhal.ui.html.esc(this.actions[i].title) + "</button><br>";
content += "<button class=\"actionbutton" + (i > 0 ? " sub-actionbutton" : "") + "\" id=\"actionbutton." + i + "\">" + stendhal.ui.html.esc(this.actions[i].title) + "</button>";
}
content += "</div>";
this.componentElement.innerHTML = content;
Expand Down

0 comments on commit 3d4a30c

Please sign in to comment.