Skip to content

Commit f185a67

Browse files
authored
Merge pull request #10 from clarivate/mohan/customize_interface
Clean up and localization support
2 parents 0432d6a + eee1a1b commit f185a67

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

projects/angular-image-viewer/src/lib/angular-image-viewer.component.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<div [appScreenfull]="fullscreen" class="img-container" [style.backgroundColor]="config.containerBackgroundColor"
22
(wheel)="scrollZoom($event)">
33
<div class="image-name" *ngIf="imageName">
4-
<span>{{ imageName }}</span>
4+
<span>{{imageName}}</span>
55
</div>
66

77
<div cdkDrag class="drag-element">
88
<img [src]="src[index]" [ngStyle]="style" alt=""
99
(cdkDragStarted)="onDragStart($event)"
10-
(load)="onLoad(src[index])" (loadstart)="onLoadStart(src[index])" (error)="imageNotFound(src[index])" />
10+
(load)="onLoad()" (loadstart)="onLoadStart()" (error)="imageNotFound()" />
1111
</div>
1212

1313
<div class="spinner-container" *ngIf="loading">
@@ -59,10 +59,10 @@
5959
</button>
6060
</div>
6161
<div class="footer-section">
62-
<div class="image-txt-count-left-align"><span>Image {{index + 1}} of {{src.length}}</span></div>
62+
<div class="image-txt-count-left-align"><span>{{footerTexts[0]}} {{index + 1}} {{footerTexts[1]}} {{src.length}}</span></div>
6363
<div class="footer-txt-right-align">
64-
<span class="footer-txt-right-align-title" [style.color]="config.primaryColor" >View previous or next image</span>
65-
<span class="footer-txt-right-align-note">using < > on the keyboard</span>
64+
<span class="footer-txt-right-align-title" [style.color]="config.primaryColor">{{footerTexts[2]}}</span>
65+
<span class="footer-txt-right-align-note">{{footerTexts[3]}}</span>
6666
</div>
6767
</div>
6868
</div>

projects/angular-image-viewer/src/lib/angular-image-viewer.component.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ export class AngularImageViewerComponent implements OnInit, OnChanges {
4343
@Input()
4444
src: string[];
4545

46+
@Input()
47+
config: ImageViewerConfig;
48+
4649
@Input()
4750
screenHeightOccupied: 0; // In Px
4851

@@ -53,7 +56,12 @@ export class AngularImageViewerComponent implements OnInit, OnChanges {
5356
imageName: string;
5457

5558
@Input()
56-
config: ImageViewerConfig;
59+
footerTexts = [
60+
'Image',
61+
'of',
62+
'View previous or next image',
63+
'using < > on the keyboard'
64+
];
5765

5866
@Output()
5967
indexChange: EventEmitter<number> = new EventEmitter();
@@ -74,8 +82,7 @@ export class AngularImageViewerComponent implements OnInit, OnChanges {
7482
private rotation = 0;
7583
private hovered = false;
7684

77-
constructor(@Optional() @Inject('config') public moduleConfig: ImageViewerConfig,
78-
private sanitizer: DomSanitizer) { }
85+
constructor(@Optional() @Inject('config') public moduleConfig: ImageViewerConfig) { }
7986

8087
ngOnChanges(changes: SimpleChanges) {
8188
if (changes.screenHeightOccupied) {
@@ -140,15 +147,15 @@ export class AngularImageViewerComponent implements OnInit, OnChanges {
140147
this.updateStyle();
141148
}
142149

143-
onLoad(url) {
150+
onLoad() {
144151
this.loading = false;
145152
}
146153

147-
onLoadStart(url) {
154+
onLoadStart() {
148155
this.loading = true;
149156
}
150157

151-
imageNotFound(url) {
158+
imageNotFound() {
152159
}
153160

154161
onDragStart(evt) {

src/app/app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="container">
22
<angular-image-viewer [src]="images" [(config)]="config" [(index)]="imageIndex" [imageName]="'Image Name ' + imageIndex"
3-
[screenHeightOccupied]='0' (customImageEvent)="handleEvent($event)">
3+
[screenHeightOccupied]='0' (customImageEvent)="handleEvent($event)" [footerTexts]="footerTexts">
44
</angular-image-viewer>
55
</div>

src/app/app.component.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ export class AppComponent {
1818
];
1919
imageIndex = 0;
2020
imageName: string;
21+
footerTexts = [
22+
'Image',
23+
'of',
24+
'View previous or next image',
25+
'using < > on the keyboard'
26+
];
2127
config: ImageViewerConfig = {
2228
wheelZoom: true,
2329
allowKeyboardNavigation: true,

0 commit comments

Comments
 (0)