LineNumberSegment angepasst

This commit is contained in:
silas
2018-10-24 23:28:56 +02:00
parent 9cdd126a5d
commit b1bfeaffc1
5 changed files with 97 additions and 73 deletions

View File

@@ -17,6 +17,10 @@ export class ParentSegment extends Segment {
ParentSegment.mouseDownTarget = e.targetTouches[0].target;
ParentSegment.clickPosition = {x: e.targetTouches[0].pageX, y: e.targetTouches[0].pageY};
}
else if (Array.isArray(e.path) && e.path.length >= 1) {
ParentSegment.mouseDownTarget = e.path[0];
ParentSegment.clickPosition = null;
}
});
window.addEventListener("touchend", (e) => {
ParentSegment.mouseDownTarget = null;
@@ -37,16 +41,20 @@ export class ParentSegment extends Segment {
let self = this;
this.touchendListener = function (e) {
let target = null;
let position = null;
if (e.changedTouches.length >= 1) {
let target = document.elementFromPoint(e.changedTouches[0].pageX, e.changedTouches[0].pageY);
if (e.targetTouches.length === 0 && e.changedTouches.length === 1 && self.element.contains(ParentSegment.mouseDownTarget) && self.element.contains(target)) {
let position = {x: e.changedTouches[0].pageX, y: e.changedTouches[0].pageY};
self.getLevel().segmentClickedListener(self);
self.rotate(ParentSegment.mouseDownTarget, target, ParentSegment.clickPosition, position);
e.stopPropagation();
e.preventDefault();
}
target = document.elementFromPoint(e.changedTouches[0].pageX, e.changedTouches[0].pageY);
position = {x: e.changedTouches[0].pageX, y: e.changedTouches[0].pageY};
}
else if (Array.isArray(e.path) && e.path.length >= 1) {
target = e.path[0];
}
if (e.targetTouches.length === 0 && self.element.contains(ParentSegment.mouseDownTarget) && self.element.contains(target)) {
self.getLevel().segmentClickedListener(self);
self.rotate(ParentSegment.mouseDownTarget, target, ParentSegment.clickPosition, position);
e.stopPropagation();
e.preventDefault();
}
};
this.mouseupListener = function (e) {