Skip to content

Commit

Permalink
refactor: remove gestures (#214)
Browse files Browse the repository at this point in the history
Use the following meta tag to achieve fast clicks in modern mobile browsers:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
  • Loading branch information
vladitasev authored Mar 19, 2019
1 parent c5c1786 commit 0365aed
Show file tree
Hide file tree
Showing 21 changed files with 18 additions and 119 deletions.
1 change: 0 additions & 1 deletion packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"lint": "eslint ."
},
"dependencies": {
"@polymer/polymer": "^3.1.0",
"@ui5/webcomponents-core": "0.9.0",
"lit-html": "^1.0.0",
"regenerator-runtime": "0.12.1",
Expand Down
7 changes: 0 additions & 7 deletions packages/base/src/sap/ui/webcomponents/base/Configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const CONFIGURATION = {
supportedLanguages,
calendarType: null,
derivedRTL: null,
"xx-wc-force-default-gestures": false,
"xx-wc-no-conflict": false, // no URL
};

Expand All @@ -40,11 +39,6 @@ const getSupportedLanguages = () => {
return CONFIGURATION.supportedLanguages;
};

/* WC specifics */
const getWCForceDefaultGestures = () => {
return CONFIGURATION["xx-wc-force-default-gestures"];
};

const getWCNoConflict = () => {
return CONFIGURATION["xx-wc-no-conflict"];
};
Expand Down Expand Up @@ -134,7 +128,6 @@ export {
getRTL,
getLanguage,
getCompactSize,
getWCForceDefaultGestures,
getWCNoConflict,
getCalendarType,
getLocale,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Gestures from "./DefaultGestures";

/**
* @namespace
* @public
Expand Down Expand Up @@ -54,12 +52,6 @@ oControlEvents.events = [ // IMPORTANT: update the public documentation when ext
"touchcancel",
];

oControlEvents.gestures = [
"down",
"up",
"tap",
];

/**
* Binds all events for listening with the given callback function.
*
Expand All @@ -71,10 +63,6 @@ oControlEvents.bindAnyEvent = function bindAnyEvent(fnCallback) {
oControlEvents.events.forEach(event => {
document.addEventListener(event, fnCallback);
});

oControlEvents.gestures.forEach(gesture => {
Gestures.addListener(document, gesture, fnCallback);
});
}
};

Expand All @@ -89,10 +77,6 @@ oControlEvents.unbindAnyEvent = function unbindAnyEvent(fnCallback) {
oControlEvents.events.forEach(event => {
document.removeEventListener(event, fnCallback);
});

oControlEvents.gestures.forEach(gesture => {
Gestures.removeListener(document, gesture, fnCallback);
});
}
};

Expand Down

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion packages/main/bundle.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import "@ui5/webcomponents-base/src/sap/ui/webcomponents/base/browsersupport/Edge";

import "@ui5/webcomponents-base/src/sap/ui/webcomponents/base/shims/jquery-shim";
import "@ui5/webcomponents-base/src/sap/ui/webcomponents/base/events/PolymerGestures";
import "./src/ThemePropertiesProvider";

import Gregorian from "@ui5/webcomponents-core/dist/sap/ui/core/date/Gregorian";
Expand Down
6 changes: 3 additions & 3 deletions packages/main/src/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,21 @@ class Button extends WebComponent {
}
}

ontap(event) {
onclick(event) {
event.isMarked = "button";
if (!this.disabled) {
this.fireEvent("press", {});
}
}

ondown(event) {
onmousedown(event) {
event.isMarked = "button";
if (this.activeIcon) {
this._active = true;
}
}

onup(event) {
onmouseup(event) {
event.isMarked = "button";
if (this.activeIcon) {
this._active = false;
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/CalendarHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class CalendarHeader extends WebComponent {
this.fireEvent("btn2Press", event);
}

ontap(event) {
onclick(event) {
const composedPath = event.composedPath();

for (let index = 0; index < composedPath.length; index++) {
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/CheckBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class CheckBox extends WebComponent {
this._label.textDirection = this.textDirection;
}

ontap() {
onclick() {
this.toggle();
}

Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/DatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ class DatePicker extends WebComponent {
}
}

ontap(event) {
onclick(event) {
const icon = this.shadowRoot.querySelector("ui5-icon");
const isIconTab = (event.ui5target === icon);

Expand Down
4 changes: 2 additions & 2 deletions packages/main/src/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class Icon extends WebComponent {
HTMLElement.prototype.focus.call(this);
}

ontap() {
onclick() {
this.fireEvent("press");
}

Expand All @@ -99,7 +99,7 @@ class Icon extends WebComponent {
event.preventDefault();
this.__spaceDown = true;
} else if (isEnter(event)) {
this.ontap(event);
this.onclick(event);
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/Label.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class Label extends WebComponent {
return LabelRenderer;
}

ontap() {
onclick() {
const labelFor = this.for;

if (labelFor) {
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class Link extends WebComponent {
return LinkRederer;
}

ontap(event) {
onclick(event) {
if (this.disabled) {
return;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/main/src/ListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ class ListItem extends ListItemBase {
}
}

ondown(event) {
onmousedown(event) {
if (event.isMarked === "button") {
return;
}
this.activate();
}

onup(event) {
onmouseup(event) {
if (event.isMarked === "button") {
return;
}
Expand All @@ -143,7 +143,7 @@ class ListItem extends ListItemBase {
this.deactivate();
}

ontap(event) {
onclick(event) {
if (event.isMarked === "button") {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/RadioButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class RadioButton extends WebComponent {
this._group = this.group;
}

ontap() {
onclick() {
return this.toggle();
}

Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class Select extends WebComponent {
}

/* Event handling */
ontap(event) {
onclick(event) {
if (this.disabled) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/Switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class Switch extends WebComponent {
return SwitchRenderer;
}

ontap(event) {
onclick(event) {
this.toggle();
}

Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/TabContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ class TabContainer extends WebComponent {
}
}

ontap(event) {
onclick(event) {
const icon = event.composedPath().filter(element => {
return element.classList && element.classList.contains("sapMITBArrowScroll");
})[0];
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/ToggleButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class ToggleButton extends Button {
return ToggleButtonRenderer;
}

ontap() {
onclick() {
if (!this.disabled) {
this.pressed = !this.pressed;
this.fireEvent("press", { pressed: this.pressed });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@

<title>Eventing</title>

<script data-id="sap-ui-config" type="application/json">
{
"xx-wc-force-default-gestures": true
}
</script>

<script src="../../../../../../webcomponentsjs/webcomponents-loader.js"></script>
<script src="../../../../../../resources/sap/ui/webcomponents/main/bundle.esm.js" type="module" ></script>
<script nomodule src="../../../../../../resources/sap/ui/webcomponents/main/bundle.es5.js">
Expand Down
12 changes: 0 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -679,13 +679,6 @@
resolved "https://registry.yarnpkg.com/@openui5/themelib_sap_belize/-/themelib_sap_belize-1.63.0.tgz#107498bf1f9a71253c55159867769bf79b5efc65"
integrity sha512-PAh68KPGcnQ+blekbMdipT8IZJPvSFQq6TZ+0x4MhgMSv9gNH/KtCysbDc/T765QHQgpL6XuiOxHpIPWNxihQQ==

"@polymer/polymer@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@polymer/polymer/-/polymer-3.1.0.tgz#3e1b7447a1e350fd654e1823def655d0f0828a70"
integrity sha512-hwN8IMERsFATz/9dSMxYHL+84J9uBkPuuarxJWlTsppZ4CAYTZKnepBfNrKoyNsafBmA3yXBiiKPPf+fJtza7A==
dependencies:
"@webcomponents/shadycss" "^1.5.2"

"@types/estree@0.0.39":
version "0.0.39"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
Expand Down Expand Up @@ -964,11 +957,6 @@
"@wdio/logger" "^5.6.3"
deepmerge "^3.2.0"

"@webcomponents/shadycss@^1.5.2":
version "1.9.0"
resolved "https://registry.yarnpkg.com/@webcomponents/shadycss/-/shadycss-1.9.0.tgz#8450465037370d4f5c32e801bb2554a7cf2f5037"
integrity sha512-g8Xa+6RSEME4g/wLJW4YII0eq15rvXp76RxPAuv7hx+Bdoi7GzZJ/EoZOUfyIbqAsQbII1TcWD4/+Xhs5NcM1w==

"@webcomponents/webcomponentsjs@^2.2.7":
version "2.2.7"
resolved "https://registry.yarnpkg.com/@webcomponents/webcomponentsjs/-/webcomponentsjs-2.2.7.tgz#1f1a7a7aa083db5ae6aadaeda68caa8fd8657462"
Expand Down

0 comments on commit 0365aed

Please sign in to comment.