-
Notifications
You must be signed in to change notification settings - Fork 67
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
Snap-Toggle directive only OPENs? #61
Comments
Thanks or the screen casts - a few questions:
|
Thanks.
Seems like it might be a bug? Maybe if we could get it to only fire the close event once, turning on fastclick might still work. |
Thanks for checking up on that. Yeah sounds like it might be a bug. I'd I'll be happy to investigate further but am on vacation for the next few |
Great! Thanks. I've dive in a take a peak and PR if moons align. |
Update and notes to self. If the |
So here's what I'm leaning towards, you can actually recreate it yourself if you want to give it a try: app.directive('myToggle', ['$rootScope', 'snapRemote', function($rootScope, snapRemote) {
'use strict';
return {
restrict: 'A',
link: function (scope, element, attrs) {
var snapId = attrs.snapId
, snapSide = attrs.snapToggle || 'left';
if(!!snapId) {
snapId = scope.$eval(snapId);
}
element.bind('mousedown', function(event) {
event.stopImmediatePropagation();
});
element.bind('mouseup', function(event) {
event.stopImmediatePropagation();
});
element.bind('click', function() {
snapRemote.toggle(snapSide, snapId);
$rootScope.$digest();
});
}
};
}]); Stifling mouseup means TLDR; Fixed toggle functionality but you won't be able to start a drag on the toggle button itself. Same would apply for a |
Disable `tapToClose` feature on `snap-toggle` elements by stifling the mousedown and mouseup events. You can override this guard with `snap-unsafe="true"`. See #61
I'm open to other solutions but for now we'll stifle the <button snap-toggle snap-unsafe="true">Toggle (w/ mousedown + mouseup)</button> Should be considered for #34. |
Understood. Sounds like a good solution. |
Anyone know why I would be having CLOSE issues with my snap-toggle directive?
OPEN works just fine... and even touching anywhere on the snap-content panel will close it... just does not allow CLOSE with that very same snap-toggle button.
I thought for sure I had this working previously....
http://www.screencast.com/t/aF7UpcUY
- UPDATE -
I've not changed a thing, just noticed that if I click the toggle button and drag off it to the content area at the same time..... then it seems to work? Is it possible that the close and open events are being fired both at the same time?
http://www.screencast.com/t/FmIjV9Sr4wgs
- UPDATE 2 -
I was able to use snapRemote to console out the events and I think I was right... somehow its firing those events twice really fast, and essentially closing and opening it before it even starts closing.
http://www.screencast.com/t/knX0VZel5eD
The text was updated successfully, but these errors were encountered: