Skip to content

Commit

Permalink
Merge pull request #22 from xontab/feature/improved-events
Browse files Browse the repository at this point in the history
v1.12.3
  • Loading branch information
xontab authored Oct 9, 2017
2 parents c7fc358 + c29b183 commit 0c82b0b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Virtual Keyboard",
"description": "Fullscreen on-screen virtual keyboard for touch screen devices",
"manifest_version": 2,
"version": "1.12.2",
"version": "1.12.3",
"icons": {
"16": "keyboard.png",
"48": "keyboard.png",
Expand Down
19 changes: 7 additions & 12 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ function virtualKeyboardChromeExtension_click(key, skip) {
virtualKeyboardChromeExtensionDraggabling = false;
virtualKeyboardChromeExtensionClickedElem.dispatchEvent(virtualKeyboardChromeExtension_fireEvent("keypress", 0, key.charCodeAt(0)));
virtualKeyboardChromeExtensionClickedElem.dispatchEvent(virtualKeyboardChromeExtension_fireEvent("keyup", 0, key.charCodeAt(0)));
virtualKeyboardChromeExtension_dispatch_event();
}
}
break;
Expand Down Expand Up @@ -527,9 +528,10 @@ function vt_evt_textarea_click() {
return vk_evt_input_event(this, false, "textarea");
}

function vk_evt_input_mousedown() {
virtualKeyboardChromeExtensionClickedYPos = window.event.clientY;
virtualKeyboardChromeExtensionClickedXPos = window.event.clientX;
function vk_evt_input_mousedown(ent) {
const evt = virtualKeyboardChromeExtensionTouchEvents == "true" ? ent.touches[0] : window.event;
virtualKeyboardChromeExtensionClickedYPos = evt.clientY;
virtualKeyboardChromeExtensionClickedXPos = evt.clientX;
}

function vt_evt_autoTrigger_mover_timeout(elem) {
Expand Down Expand Up @@ -584,22 +586,15 @@ function virtualKeyboardChromeClassStyleDisplay(className, value) {

function virtualKeyboardChrome_bind_input(e, autoTrigger, focusCallback, clickCallback) {
if (e.getAttribute("_vkEnabled") == undefined) {
e.setAttribute("_vkEnabled", "true");
e.addEventListener("blur", vk_evt_input_blur, false);
if (virtualKeyboardChromeExtensionTouchEvents == "true") {
e.addEventListener("touchstart", function (ent) {
virtualKeyboardChromeExtensionClickedYPos = ent.touches[0].clientY;
virtualKeyboardChromeExtensionClickedXPos = ent.touches[0].clientX;
}, false);
} else {
e.addEventListener("mousedown", vk_evt_input_mousedown, false);
}
e.addEventListener(virtualKeyboardChromeExtensionTouchEvents == "true" ? "touchstart" : "mousedown", vk_evt_input_mousedown, false);
e.addEventListener("focus", focusCallback, false);
e.addEventListener("click", clickCallback, false);
if (autoTrigger) {
e.addEventListener("mouseover", vt_evt_autoTrigger_mover, false);
e.addEventListener("mouseout", vt_evt_autoTrigger_mout, false);
}
e.setAttribute("_vkEnabled", "true");
}
}

Expand Down

0 comments on commit 0c82b0b

Please sign in to comment.