hammer.js

hammer.js swipe disabling native pinch to zoom

最后都变了- 提交于 2019-12-12 19:11:20
问题 Is it possible to use the native "pinch to zoom" on touch devices while using hammerjs to recognize swipe gestures? I want users to be able to zoom in on images in the gallery (as they can natively when hammer event handler is not bound) and swiping to display the previous or next image. hammertime.on('swipe', function(ev) { if (ev.direction === 2) { nextImage(); } else if (ev.direction === 4) { prevImage(); } }); 回答1: Solution was to use touchAction = 'auto' var hammertime = new Hammer

What's the scoop on Pinch to Zoom Gesture with Ionic3 and Hammer.JS?

僤鯓⒐⒋嵵緔 提交于 2019-12-12 12:50:52
问题 I need to be able to do pinch to zoom to scale font sizes, on both Android and iOS. (Not just a regular image per numerous examples I've seen when Googling). Can someone let me know if theres an easy way to do this in Ionic 3? Documentation, infers you can use (pinch). But this never works out of the box. I know Ionic uses Hammer.JS under the covers... per this source. Ionic Forums suggests you can enable it using a combination of @ViewChild and manually adding listen and on handler. Then for

Hammer.js skips 'case' inside 'switch'

余生颓废 提交于 2019-12-12 04:50:59
问题 After updating Hammer to v2 it doesn't recognize gestures anymore. It does trigger 'switch(event.type)' but skips all of the cases. Is 'case' not supported anymore? Example of the code: function handleHammer(event) { // disable browser scrolling event.preventDefault(); switch(event.type) { case 'tap': the_single_post.removeClass('grab'); var tapPos = (event.gesture.center.pageX) - (element.offset().left); if (tapPos > paneWidth/2) { hammer.next('easeinout'); } else if (tapPos < paneWidth/2) {

Try to resize image by HammerJS in iOS not work

无人久伴 提交于 2019-12-12 01:39:49
问题 I try to make image resizable on iOS by Hammer.js gesture. This jsfiddle code work OK on desktop, and this is my converted code (run on iOS safari) var startX,startY,startW,startH; var canResize = false; $('img').hammer().on("touch", function(events) { canResize = true; var e = events[0]; startX = e.pageX; startY = e.pageY; startW = $(this).innerWidth(); startH = $(this).innerHeight(); return false; }); $('img').hammer().on("release", function(events) { canResize = false; return false; }); $(

Hammer js - off() method doesn't work

流过昼夜 提交于 2019-12-11 07:55:12
问题 I am using Hammer this way, it works (it just triggers next/prev buttons): var slider = document.getElementsByClassName('slider'); Hammer(slider[0]).on("swiperight", function() { prev.click(); }); A according to Stack thread, on event when modal is coming out (hammer is still swiping behind it :/) I am trying to turn it of with: Hammer(slider[0]).off("swipeleft"); Hammer(slider[0]).off("swiperight"); But it doesn't work. It's still swipeing behind modal. Any idea why? 回答1: Save Hammer

HammerJS swipe with Mat-Tabs blocking vertical scroll

一世执手 提交于 2019-12-11 06:09:02
问题 SO I have a component in my Angular application that has tabs for categories of data with an array of values for the content of the tab. I want to use HammerJS to swipe between the tabs for a more native experience. I have installed this virtual scroll package also: https://github.com/rintoj/angular2-virtual-scroll to handle the amount of items I am preparing for the lists under each mat-tab . I'll start by showing the data and the markup here: Here is building the dummyData just to show how

Angular2: HammerJS swipe for md-tab-group

北城以北 提交于 2019-12-11 02:42:45
问题 I've implemented HammerJS in my Angular2 webapp and I've also tested the example code out. This code uses an Array of objects and seems to work flawlessly. However, I've been trying to implement the same system for @angular2-material/tabs. Therefore I have a <md-tab-group> with multiple <md-tab> 's which should swipe from tab to tab. Problem is that I can't even trigger the swipe function. HTML-File : <md-tab-group md-stretch-tabs [(selectedIndex)]="selectedIndex" (selectedIndexChange)=

Dragging HTML element , implemented with HammerJS , is jittery on touch device

拈花ヽ惹草 提交于 2019-12-10 23:36:37
问题 I have a list of HTML elements as cards stacked on top of each other. I am trying to drag the element with pan event using HammerJS export class HomePage { @ViewChildren('slides') slides; @ViewChild('stack') stack; constructor( this.cards = [1,2,3,4,5] } ngAfterViewInit(){ let hammer = new Hammer.Manager(this.stack.nativeElement, { preventDefault: true, recognizers: [ [ Hammer.Pan, { threshold: 2 }] ] }); hammer.get('pan').set({ direction: window['Hammer'].DIRECTION_ALL }); this.element =

Hammer.js is slow and jerky on pinchin/pinchout

别来无恙 提交于 2019-12-10 21:07:45
问题 I'm using hammer.js to implement some touchscreen functionality on a pet project. The desired product is a map that can be dragged around and zoomed in and out with a touchscreen. I got it working, and everything is nice except the pinchin/pinchout mechanics are very, very slow. There is a very noticeable delay between when the pinch happens, and when the event fires. Here's the relevant JQuery/JS code: EDIT: Code is way nicer (and faster) now per Simon's suggestions. Here's the finished

using backbone.js with hammer.js

柔情痞子 提交于 2019-12-10 19:57:55
问题 Would like to know if anyone have used backbone with hammer.js and how to implement the Backbone.View with the drag, hold events of hammer.js? 回答1: You can't use Hammerjs events in delegateEvents directly, but there are plugins that patch Backbone.View to make it possible: https://github.com/wookiehangover/backbone.hammer.js 来源: https://stackoverflow.com/questions/13039285/using-backbone-js-with-hammer-js