chore(): remove use of host: {inputs: []}

This commit is contained in:
Adam Bradley
2016-01-14 21:14:23 -06:00
parent 02626b9489
commit b5d8a1de70
2 changed files with 33 additions and 38 deletions

View File

@ -37,23 +37,23 @@ import {IonicApp} from './app';
* has been navigated away from. * has been navigated away from.
*/ */
@Directive({ @Directive({
selector: '[id]', selector: '[id]'
inputs: ['id']
}) })
export class IdRef { export class IdRef {
component: any; private _component: any;
id: string;
constructor(private _app: IonicApp, private _elementRef: ElementRef, private _appViewManager: AppViewManager) { @Input() id: string;
constructor(private _app: IonicApp, elementRef: ElementRef, appViewManager: AppViewManager) {
// Grab the component this directive is attached to // Grab the component this directive is attached to
this.component = _appViewManager.getComponent(_elementRef); this._component = appViewManager.getComponent(elementRef);
} }
/** /**
* @private * @private
*/ */
ngOnInit() { ngOnInit() {
this._app.register(this.id, this.component); this._app.register(this.id, this._component);
} }
/** /**

View File

@ -192,7 +192,7 @@ export class Slides extends Ion {
/* /*
* TODO: Finish this * TODO: Finish this
if(util.isTrueProperty(this.zoom)) { if (util.isTrueProperty(this.zoom)) {
this.enableZoom = true; this.enableZoom = true;
setTimeout(() => { setTimeout(() => {
this.initZoom(); this.initZoom();
@ -291,7 +291,7 @@ export class Slides extends Ion {
this.zoomGesture.on('pinchend', (e) => { this.zoomGesture.on('pinchend', (e) => {
//last_scale = Math.max(1, Math.min(last_scale * e.scale, 10)); //last_scale = Math.max(1, Math.min(last_scale * e.scale, 10));
if(this.scale > this.maxScale) { if (this.scale > this.maxScale) {
let za = new Animation(this.zoomElement) let za = new Animation(this.zoomElement)
.duration(this.zoomDuration) .duration(this.zoomDuration)
.easing('linear') .easing('linear')
@ -309,7 +309,7 @@ export class Slides extends Ion {
*/ */
resetZoom() { resetZoom() {
if(this.zoomElement) { if (this.zoomElement) {
this.zoomElement.parentElement.style[CSS.transform] = ''; this.zoomElement.parentElement.style[CSS.transform] = '';
this.zoomElement.style[CSS.transform] = 'scale(1)'; this.zoomElement.style[CSS.transform] = 'scale(1)';
@ -325,7 +325,7 @@ export class Slides extends Ion {
*/ */
toggleZoom(swiper, e) { toggleZoom(swiper, e) {
console.log('Try toggle zoom'); console.log('Try toggle zoom');
if(!this.enableZoom) { return; } if (!this.enableZoom) { return; }
console.log('Toggling zoom', e); console.log('Toggling zoom', e);
@ -338,14 +338,14 @@ export class Slides extends Ion {
let tx, ty; let tx, ty;
if(x > mx) { if (x > mx) {
// Greater than half // Greater than half
tx = -x; tx = -x;
} else { } else {
// Less than or equal to half // Less than or equal to half
tx = (this.viewportWidth - x); tx = (this.viewportWidth - x);
} }
if(y > my) { if (y > my) {
ty = -y; ty = -y;
} else { } else {
ty = y-my; ty = y-my;
@ -364,10 +364,9 @@ export class Slides extends Ion {
.easing('linear'); .easing('linear');
let za = new Animation(); let za = new Animation();
za.fill('none'); za.add(zi);
za.add(zi);//, zw);
if(this.scale > 1) { if (this.scale > 1) {
// Zoom out // Zoom out
//zw.fromTo('translateX', posX + 'px', '0px'); //zw.fromTo('translateX', posX + 'px', '0px');
@ -458,7 +457,7 @@ export class Slides extends Ion {
console.log('BOUNDS', x1, x2, y1, y2); console.log('BOUNDS', x1, x2, y1, y2);
if(this.scale <= 1) { if (this.scale <= 1) {
return; return;
} }
@ -470,16 +469,16 @@ export class Slides extends Ion {
console.log(this.touch.x, this.touch.y); console.log(this.touch.x, this.touch.y);
if(this.touch.x < x1) { if (this.touch.x < x1) {
console.log('OUT ON LEFT'); console.log('OUT ON LEFT');
} }
if(this.touch.x > x2 ){ if (this.touch.x > x2 ){
console.log('OUT ON RIGHT'); console.log('OUT ON RIGHT');
} }
if(this.touch.x > this.viewportWidth) { if (this.touch.x > this.viewportWidth) {
// Too far on the left side, let the event bubble up (to enable slider on edges, for example) // Too far on the left side, let the event bubble up (to enable slider on edges, for example)
} else if(-this.touch.x > this.viewportWidth) { } else if (-this.touch.x > this.viewportWidth) {
// Too far on the right side, let the event bubble up (to enable slider on edges, for example) // Too far on the right side, let the event bubble up (to enable slider on edges, for example)
} else { } else {
console.log('TRANSFORM', this.touch.x, this.touch.y, this.touch.target); console.log('TRANSFORM', this.touch.x, this.touch.y, this.touch.target);
@ -498,16 +497,16 @@ export class Slides extends Ion {
onTouchEnd(e) { onTouchEnd(e) {
console.log('PANEND', e); console.log('PANEND', e);
if(this.scale > 1) { if (this.scale > 1) {
if(Math.abs(this.touch.x) > this.viewportWidth) { if (Math.abs(this.touch.x) > this.viewportWidth) {
//TODO what is posX? // TODO what is posX?
posX = posX > 0 ? this.viewportWidth - 1 : -(this.viewportWidth - 1); var posX = posX > 0 ? this.viewportWidth - 1 : -(this.viewportWidth - 1);
console.log('Setting on posx', this.touch.x); console.log('Setting on posx', this.touch.x);
} }
/* /*
if(posY > this.viewportHeight/2) { if (posY > this.viewportHeight/2) {
let z = new Animation(this.zoomElement.parentElement); let z = new Animation(this.zoomElement.parentElement);
z.fromTo('translateY', posY + 'px', Math.min(this.viewportHeight/2 + 30, posY)); z.fromTo('translateY', posY + 'px', Math.min(this.viewportHeight/2 + 30, posY));
z.play(); z.play();
@ -533,7 +532,7 @@ export class Slides extends Ion {
this.slider.update(); this.slider.update();
// Don't allow pager to show with > 10 slides // Don't allow pager to show with > 10 slides
if(this.slider.slides.length > 10) { if (this.slider.slides.length > 10) {
this.showPager = false; this.showPager = false;
} }
}); });
@ -594,16 +593,13 @@ export class Slides extends Ion {
*/ */
@Component({ @Component({
selector: 'ion-slide', selector: 'ion-slide',
inputs: ['zoom'],
template: '<div class="slide-zoom"><ng-content></ng-content></div>' template: '<div class="slide-zoom"><ng-content></ng-content></div>'
}) })
export class Slide { export class Slide {
private ele: HTMLElement; private ele: HTMLElement;
/**
* TODO @Input() zoom;
* @param {Slides} slides The containing slidebox.
* @param {ElementRef} elementRef TODO
*/
constructor( constructor(
elementRef: ElementRef, elementRef: ElementRef,
@Host() slides: Slides @Host() slides: Slides
@ -620,9 +616,8 @@ export class Slide {
*/ */
@Directive({ @Directive({
selector: 'slide-lazy', selector: 'slide-lazy',
}) host: {
export class SlideLazy { 'class': 'swiper-lazy'
constructor(elementRef: ElementRef) {
elementRef.nativeElement.classList.add('swiper-lazy');
} }
} })
export class SlideLazy {}