Skip to content

Commit

Permalink
Merge pull request #22 from Riron/rc4
Browse files Browse the repository at this point in the history
Compatibility with RC4
  • Loading branch information
Riron authored Dec 20, 2016
2 parents dcafb7a + b4a7651 commit f557753
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Thumbs.db
*.map
*.d.ts
*.css
*.tgz

# Ignored folders
dist
Expand Down
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ yarn.lock
# OS generated files
Thumbs.db
.DS_Store
.vscode

# Ignored files & folders
*.ts
!*.d.ts
/src
/demo
demo
config
Binary file removed ionic-img-viewer-1.1.4.tgz
Binary file not shown.
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ionic-img-viewer",
"version": "1.1.7",
"version": "1.1.8",
"description": "Ionic 2 component providing a Twitter inspired experience to visualize pictures.",
"main": "./dist/ionic-img-viewer.js",
"typings": "./dist/ionic-img-viewer.d.ts",
Expand All @@ -21,22 +21,22 @@
"author": "Orion Charlier",
"license": "MIT",
"dependencies": {
"@angular/common": "2.1.1",
"@angular/compiler": "2.1.1",
"@angular/compiler-cli": "2.1.1",
"@angular/core": "2.1.1",
"@angular/forms": "2.1.1",
"@angular/http": "2.1.1",
"@angular/platform-browser": "2.1.1",
"@angular/platform-browser-dynamic": "2.1.1",
"@angular/platform-server": "2.1.1",
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/compiler-cli": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/platform-server": "2.2.1",
"@ionic/storage": "1.1.6",
"ionic-angular": "2.0.0-rc.3",
"ionic-angular": "2.0.0-rc.4",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.26"
},
"devDependencies": {
"typescript": "2.0.6",
"typescript": "2.0.9",
"copyfiles": "1.0.0"
}
}
7 changes: 4 additions & 3 deletions src/image-viewer-gesture.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ImageViewerComponent } from './image-viewer.component';
import { PanGesture } from 'ionic-angular/gestures/drag-gesture';
import { CSS, nativeRaf, pointerCoord } from 'ionic-angular/util/dom';
import { Animation } from 'ionic-angular';
import { Animation, DomController } from 'ionic-angular';

const HAMMER_THRESHOLD = 10;
const MAX_ATTACK_ANGLE = 45;
Expand All @@ -15,12 +15,13 @@ export class ImageViewerGesture extends PanGesture {
private imageContainer: HTMLElement;
private backdrop: HTMLElement;

constructor(private component: ImageViewerComponent, private cb: Function) {
constructor(private component: ImageViewerComponent, domCtrl: DomController, private cb: Function) {
super(component.getNativeElement(), {
maxAngle: MAX_ATTACK_ANGLE,
threshold: HAMMER_THRESHOLD,
gesture: component._gestureCtrl.createGesture({ name: 'image-viewer' }),
direction: 'y'
direction: 'y',
domController: domCtrl
});

this.translationY = 0;
Expand Down
5 changes: 3 additions & 2 deletions src/image-viewer.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NavController, NavParams, Transition } from 'ionic-angular';
import { DomController, NavController, NavParams, Transition } from 'ionic-angular';
import { Ion } from 'ionic-angular/components/ion';
import { PanGesture } from 'ionic-angular/gestures/drag-gesture';
import { GestureController } from 'ionic-angular/gestures/gesture-controller';
Expand Down Expand Up @@ -41,6 +41,7 @@ export class ImageViewerComponent extends Ion implements OnInit, OnDestroy {
private _nav: NavController,
private _zone: NgZone,
private renderer: Renderer,
private domCtrl: DomController,
_navParams: NavParams,
_config: Config,
_sanitizer: DomSanitizer
Expand All @@ -53,7 +54,7 @@ export class ImageViewerComponent extends Ion implements OnInit, OnDestroy {

ngOnInit() {
let gestureCallBack = () => this._nav.pop();
this._zone.runOutsideAngular(() => this.dragGesture = new ImageViewerGesture(this, gestureCallBack));
this._zone.runOutsideAngular(() => this.dragGesture = new ImageViewerGesture(this, this.domCtrl, gestureCallBack));
}

ngOnDestroy() {
Expand Down

0 comments on commit f557753

Please sign in to comment.