Skip to content

Commit

Permalink
Fix keyboard on ios, fixes copy#105
Browse files Browse the repository at this point in the history
  • Loading branch information
copy committed Nov 9, 2017
1 parent b9c421f commit 8b4b89d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
6 changes: 4 additions & 2 deletions debug.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,11 @@ <h4>Debugger</h4>
<div id="screen_container" style="display: none">
<div id="screen"></div>
<canvas id="vga"></canvas>
</div>

<input type="text" class="phone_keyboard" style="display: none">
<div style="position: absolute; top: 0; z-index: 10">
<textarea class="phone_keyboard"></textarea>
</div>
</div>

<div id="runtime_infos" style="display: none">
Running: <span id="running_time">0s</span> <br>
Expand Down
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,12 @@ <h4>Setup</h4>
<div id="screen_container" style="display: none">
<div id="screen"></div>
<canvas id="vga"></canvas>
<div style="position: absolute; top: 0; z-index: 10">
<textarea class="phone_keyboard"></textarea>
</div>
</div>


<input type="text" class="phone_keyboard" style="display: none">

<div id="runtime_infos" style="display: none">
Running: <span id="running_time">0s</span> <br>
Speed: <span id="speed">0</span>kIPS<br>
Expand Down
15 changes: 13 additions & 2 deletions src/browser/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,6 @@
$("runtime_infos").style.display = "block";
$("screen_container").style.display = "block";

document.getElementsByClassName("phone_keyboard")[0].style.display = "block";

if(settings.filesystem)
{
init_filesystem_panel(emulator);
Expand Down Expand Up @@ -1197,6 +1195,19 @@
}
};

const phone_keyboard = document.getElementsByClassName("phone_keyboard")[0];

phone_keyboard.setAttribute("autocorrect", "off");
phone_keyboard.setAttribute("autocapitalize", "off");
phone_keyboard.setAttribute("spellcheck", "false");
phone_keyboard.tabIndex = 0;

$("screen_container").addEventListener("mousedown", (e) =>
{
e.preventDefault();
phone_keyboard.focus();
}, false);

$("take_screenshot").onclick = function()
{
emulator.screen_make_screenshot();
Expand Down
2 changes: 1 addition & 1 deletion src/browser/screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function ScreenAdapter(screen_container, bus)
graphic_screen = screen_container.getElementsByTagName("canvas")[0],
graphic_context = graphic_screen.getContext("2d"),

text_screen = graphic_screen.nextElementSibling || graphic_screen.previousElementSibling,
text_screen = screen_container.getElementsByTagName("div")[0],
cursor_element = document.createElement("div");

var
Expand Down
8 changes: 6 additions & 2 deletions v86.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,13 @@ a {
width: 0;
height: 0;
resize: none;
border: 0;
padding: 0;
position: absolute;
opacity: 0;
left: -9999em;
top: 0;
z-index: -10;
white-space: nowrap;
overflow: hidden;
}
h4 {
margin: 0px 0px 20px 0px;
Expand Down

0 comments on commit 8b4b89d

Please sign in to comment.