Skip to content
Snippets Groups Projects
Commit f79e4d2c authored by jojohoch's avatar jojohoch
Browse files

[player] Hide magnifier when mouse is not over image.

The magnifier is always visible in the editor
parent de3be1d8
No related branches found
No related tags found
No related merge requests found
......@@ -8,13 +8,16 @@ import { ValueChangeElement } from '../models/uI-element';
template: `
<div [style.display]="'flex'"
[style.height.%]="100"
[style.width.%]="100">
[style.width.%]="100"
(mouseover)="magnifierVisible = true"
(mouseenter)="magnifierVisible = true"
(mouseleave)="magnifierVisible = false">
<div class="image-container">
<img #image
[src]="elementModel.src | safeResourceUrl"
[alt]="'imageNotFound' | translate"
[class]="elementModel.dynamicPositioning? 'dynamic-image' : 'static-image'">
<app-magnifier *ngIf="elementModel.magnifier"
<app-magnifier *ngIf="elementModel.magnifier && ( magnifierVisible || project === 'editor')"
[imageId]="elementModel.id"
[size]="elementModel.magnifierSize"
[zoom]="elementModel.magnifierZoom"
......@@ -33,5 +36,6 @@ import { ValueChangeElement } from '../models/uI-element';
})
export class ImageComponent extends ElementComponent {
@Output() elementValueChanged = new EventEmitter<ValueChangeElement>();
magnifierVisible = false;
elementModel!: ImageElement;
}
......@@ -43,8 +43,8 @@ export class Magnifier {
this.used = true;
this.elementValueChanged.emit({ id: this.imageId, values: [false, true] });
}
this.left = this.calculateGlassPosition(this.image.width, event.offsetX);
this.top = this.calculateGlassPosition(this.image.height, event.offsetY);
this.left = this.calculateGlassPosition(this.image.width, event.offsetX) - 1;
this.top = this.calculateGlassPosition(this.image.height, event.offsetY) - 1;
this.backgroundPosition =
`-${
this.calculateBackgroundPosition(this.image.width, event.offsetX)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment