mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
focus input w/ label
This commit is contained in:
@ -2,6 +2,7 @@ import {Directive, Parent, Optional} from 'angular2/angular2';
|
|||||||
|
|
||||||
import {Input} from './text-input';
|
import {Input} from './text-input';
|
||||||
import {IonicConfig} from '../../config/config';
|
import {IonicConfig} from '../../config/config';
|
||||||
|
import * as dom from '../../util/dom';
|
||||||
|
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
@ -39,9 +40,6 @@ export class Label {
|
|||||||
let endCoord = dom.pointerCoord(ev);
|
let endCoord = dom.pointerCoord(ev);
|
||||||
|
|
||||||
// focus this input if the pointer hasn't moved XX pixels
|
// focus this input if the pointer hasn't moved XX pixels
|
||||||
// and the input doesn't already have focus
|
|
||||||
console.log('!this.hasFocus()', !this.hasFocus());
|
|
||||||
|
|
||||||
if (!dom.hasPointerMoved(20, this.startCoord, endCoord)) {
|
if (!dom.hasPointerMoved(20, this.startCoord, endCoord)) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
@ -49,7 +47,8 @@ export class Label {
|
|||||||
this.container.focus();
|
this.container.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.startCoord null;
|
this.startCoord = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -78,8 +78,6 @@ export class TextInput extends IonInput {
|
|||||||
|
|
||||||
// focus this input if the pointer hasn't moved XX pixels
|
// focus this input if the pointer hasn't moved XX pixels
|
||||||
// and the input doesn't already have focus
|
// and the input doesn't already have focus
|
||||||
console.log('!this.hasFocus()', !this.hasFocus());
|
|
||||||
|
|
||||||
if (!dom.hasPointerMoved(20, this.startCoord, endCoord) && !this.hasFocus()) {
|
if (!dom.hasPointerMoved(20, this.startCoord, endCoord) && !this.hasFocus()) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
Reference in New Issue
Block a user