Effortlessly manage image and video focus for modern, responsive layouts with NGX Focus Point. Whether your image needs to adapt to portrait, landscape, or square spaces, this Angular component ensures your subject always stays in the spotlight.
No more awkward clipping, misplaced subjects, or resizing issues. NGX Focus Point lets you define the perfect focal point for your media, giving you seamless results across all screen sizes and layouts. 🚀
npm i @believablecreations/ngx-focus-point
yarn add @believablecreations/ngx-focus-point
import { NgxFocusPointModule } from './ngx-focus-point/ngx-focus-point.module';
As of Angular 19, you can use standalone components. Just import the component and use it directly in your template:
import { Component } from '@angular/core';
import { NgxFocusPointComponent } from './ngx-focus-point.component';
@Component({
selector: 'app-root',
standalone: true,
imports: [NgxFocusPointComponent],
template: `
<div>
<h1>Welcome to Angular 19 Standalone Components!</h1>
<app-ngx-focus-point>
<img src="your-image.jpg" alt="Sample Image" />
</app-ngx-focus-point>
</div>
`,
})
export class AppComponent {}
Define your focal point using focusX
and focusY
:
<ngx-focus-point [focusX]="0.0" [focusY]="0.0">
<img src="your-image.jpg" />
</ngx-focus-point>
<ngx-focus-point [focusX]="0.0" [focusY]="0.0">
<video autoplay loop muted="true" playsinline webkit-playsinline="true">
<source src="your-video.mp4" />
</video>
</ngx-focus-point>
Capture the focal point dynamically:
<ngx-focus-point-select (positionChange)="updateFocus($event)" src="your-image.jpg"></ngx-focus-point-select>
PositionModel Structure:
PositionModel {
x: number;
y: number;
w: number;
h: number;
s?: number;
}
Built with ❤️ by Believable Creations.