-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
not working on IOS Devices #77
Comments
Even with touch support (Angular supports Hammerjs), on press or tap the contextmenu is not showed |
@johaven are you using a |
@isaacplmann <tr ...(longpress)="onMyContextMenu($event, obj)"></tr> You can try with Chrome and emulating Ipad or Iphone. |
If |
@isaacplmann |
@johaven |
@johaven |
@isaacplmann import 'hammerjs';
import 'hammer-timejs' Angular will detect and handle this library and default events (tap, press...) will be available. import { HammerGestureConfig, HAMMER_GESTURE_CONFIG } from '@angular/platform-browser'
export class CustomHammerConfig extends HammerGestureConfig {
overrides = <any>{
'pinch': { enable: false },
'rotate': { enable: false },
'tap': {taps: 2}
}
}...
{provide: HAMMER_GESTURE_CONFIG, useClass: CustomHammerConfig}, http://hammerjs.github.io for docs :) [Log] Object (main.bundle.js, line 4735)
angle: 0
center: {x: 356, y: 169}
changedPointers: [MouseEvent] (1)
deltaTime: 0
deltaX: 0
deltaY: 0
direction: 1
distance: 0
eventType: 1
isFinal: false
isFirst: true
maxPointers: 1
offsetDirection: 1
overallVelocity: 0
overallVelocityX: 0
overallVelocityY: 0
pointerType: "mouse"
pointers: [MouseEvent] (1)
preventDefault: function()
returnValue: false
rotation: 0
scale: 1
srcEvent: MouseEvent {isTrusted: true, screenX: 666, screenY: 301, clientX: 356, clientY: 169, …}
target: <td>
timeStamp: 1513712391367
type: "press"
velocity: 0
velocityX: 0
velocityY: 0
Prototype Object |
So it looks like you can immediately work around the issue by passing |
It could be that the actual touch event on a real mobile device won't have a onContextMenu(pressEvent) {
this.contextMenuService.show.next({
contextMenu: this.contextMenu,
event: <any>{
clientX: pressEvent.center.x,
clientY: pressEvent.center.y,
target: pressEvent.target,
},
item: item,
});
} |
It's ok with srcEvent, my workaround: onMyContextMenu(event: any) {
this.contextMenuService.show.next({
contextMenu: this.fileContextMenu,
event: event.type === 'contextmenu' ? event : event.srcEvent,
item: null
})
} |
@isaacplmann Compilation warning with your workaround, event type does not match: error TS2345: Argument of type '{ contextMenu: ContextMenuComponent; event: { clientX: any; clientY: any; target: any; altKey: an...' is not assignable to parameter of type 'IContextMenuClickEvent'.
Types of property 'event' are incompatible.
Type '{ clientX: any; clientY: any; target: any; altKey: any; }' is not assignable to type 'MouseEvent'.
Property 'button' is missing in type '{ clientX: any; clientY: any; target: any; altKey: any; }'. |
@johaven I've updated my workaround to have |
@isaacplmann i don't see any on your workaround. |
Oops, I edited your workaround |
Maybe that's better. |
My workaround does not work on real device ... Yours it's ok ! |
context menu on IOS devices not being triggered for angular 4.2.4
The text was updated successfully, but these errors were encountered: