Skip to content

Commit

Permalink
anvaka panzoom fixed the problem
Browse files Browse the repository at this point in the history
  • Loading branch information
folsze committed Mar 21, 2023
1 parent d6e1ea5 commit 841c817
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 1 deletion.
67 changes: 67 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@panzoom/panzoom": "^4.5.1",
"ionicons": "^6.0.3",
"ng-inline-svg-2": "^15.0.1",
"panzoom": "^9.4.3",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
Expand Down
17 changes: 17 additions & 0 deletions src/app/anvaka-panzoom/anvaka-panzoom-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { AnvakaPanzoomPage } from './anvaka-panzoom.page';

const routes: Routes = [
{
path: '',
component: AnvakaPanzoomPage
}
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class AnvakaPanzoomPageRoutingModule {}
24 changes: 24 additions & 0 deletions src/app/anvaka-panzoom/anvaka-panzoom.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';

import { IonicModule } from '@ionic/angular';

import { AnvakaPanzoomPageRoutingModule } from './anvaka-panzoom-routing.module';

import { AnvakaPanzoomPage } from './anvaka-panzoom.page';
import {InlineSVGModule} from 'ng-inline-svg-2';
import {HttpClientModule} from '@angular/common/http';

@NgModule({
imports: [
HttpClientModule,
CommonModule,
FormsModule,
IonicModule,
AnvakaPanzoomPageRoutingModule,
InlineSVGModule
],
declarations: [AnvakaPanzoomPage]
})
export class AnvakaPanzoomPageModule {}
12 changes: 12 additions & 0 deletions src/app/anvaka-panzoom/anvaka-panzoom.page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<ion-header>
<ion-toolbar>
<ion-title>anvaka-panzoom</ion-title>
</ion-toolbar>
</ion-header>

<ion-content>
<div
class="panzoom-bug-and-inline-svg-wrapper"
inlineSVG="assets/svgs/id1.svg"
></div>
</ion-content>
9 changes: 9 additions & 0 deletions src/app/anvaka-panzoom/anvaka-panzoom.page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.panzoom-bug-and-inline-svg-wrapper {
width: 100%;
height: 100%;
}

.whole-svg-area {
width: 100%;
height: 100%;
}
24 changes: 24 additions & 0 deletions src/app/anvaka-panzoom/anvaka-panzoom.page.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';

import { AnvakaPanzoomPage } from './anvaka-panzoom.page';

describe('AnvakaPanzoomPage', () => {
let component: AnvakaPanzoomPage;
let fixture: ComponentFixture<AnvakaPanzoomPage>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ AnvakaPanzoomPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();

fixture = TestBed.createComponent(AnvakaPanzoomPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));

it('should create', () => {
expect(component).toBeTruthy();
});
});
24 changes: 24 additions & 0 deletions src/app/anvaka-panzoom/anvaka-panzoom.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {Component, ViewEncapsulation} from '@angular/core';
import panzoom from 'panzoom';

@Component({
selector: 'app-anvaka-panzoom',
templateUrl: './anvaka-panzoom.page.html',
styleUrls: ['./anvaka-panzoom.page.scss'],
encapsulation: ViewEncapsulation.None
})
export class AnvakaPanzoomPage {

constructor() { }

ionViewDidEnter() {
let element: SVGElement = document.querySelector('svg') as SVGElement;
panzoom(element!, {
maxZoom: 10,
minZoom: 1,
bounds: true,
boundsPadding: 1
});
}

}
6 changes: 5 additions & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{
path: '',
redirectTo: 'panzoom',
redirectTo: 'anvaka-panzoom',
pathMatch: 'full'
},
{
path: 'panzoom',
loadChildren: () => import('./panzoom/panzoom.module').then( m => m.PanzoomPageModule)
},
{
path: 'anvaka-panzoom',
loadChildren: () => import('./anvaka-panzoom/anvaka-panzoom.module').then( m => m.AnvakaPanzoomPageModule)
},
];

@NgModule({
Expand Down
1 change: 1 addition & 0 deletions src/app/panzoom/panzoom.page.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.panzoom-bug-and-inline-svg-wrapper {
width: 100%;
height: 100%;
}

.whole-svg-area {
Expand Down

0 comments on commit 841c817

Please sign in to comment.