puneethrai / angular-long-press Goto Github PK
View Code? Open in Web Editor NEWLong press support for both desktop and mobile when used in AngularJS framework
License: MIT License
Long press support for both desktop and mobile when used in AngularJS framework
License: MIT License
I am using this with a ng-map instance, but it does not send the event.
To address this we can add the following:
// ...
var touchStartY;
var touchStartX;
var MAX_DELTA = 15;
// ...
$elm.bind('touchmove', onMove);
// in onEnter(), add:
touchStartY = _.get(evt, 'touches[0].screenY');
touchStartX = _.get(evt, 'touches[0].screenX');
// ...
function onMove(evt) {
var yPosition = _.get(evt, 'touches[0].screenY');
var xPosition = _.get(evt, 'touches[0].screenX');
// If we scrolled, prevent long presses
if (!_.isUndefined(touchStartY) && !_.isUndefined(touchStartX) &&
(Math.abs(yPosition - touchStartY) > MAX_DELTA) || Math.abs(xPosition - touchStartX) > MAX_DELTA) {
$timeout.cancel(timer);
}
}
The 15px delta is to help with "fat fingers". Very slight scrolling is probably unintentional.
Hi,
Would you mind tagging the current release with a version, to allow cleaner integration with bower?
Thanks
I'm trying to use this directive inside of my Cordova Angular app, but it's failing and I'm not sure why. Angular error says:
Unknown provider: nProvider <- n <- onLongPressDirective
I have verified:
<button on-long-press="vm.toggle(log)">test</button>
But still the above error. What am I missing here?
I have the problem that the long press triggers when I'm scrolling. This issue is also on windows phone 10.
Change the current default value of 600 to a configurable value
Option Name:
long-press-duration: Integer value in MS to indicate after how long user touches will trigger long-press event
default: 600
When used with Angular Material Menu directive it causes the menu-content alignment to fail.
I think it's something related with event and I'm trying to investigate further.
Here is a pen.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.