![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
react-focal
Advanced tools
react-focal
helps users define the focal point of their images. This allows
the developer to create suitable crops for all kinds of resolutions which will
always be centered around the subject of any image.
react-focal
can be found on npm, so to install it, run:
$ npm install --save react-focal
Once it's installed you can use it as such:
import React from 'react';
import Focal from 'react-focal';
export default function MyComponent() {
return (
<Focal
width={640}
height={480}
/>
);
}
This will render the most basic instance of Focal which doesn't really do much.
It becomes more interesting when you add an onChange
handler to the component.
import Focal from 'react-focal';
export default class MyComponent extends React.Component {
constructor() {
super();
this.state = {
x: 50,
y: 50,
};
this.onChange = this.onChange.bind(this);
}
onChange(x, y) {
this.setState({ x, y });
}
render() {
return (
<div>
<Focal
width={640}
height={480}
onChange={this.onChange}
/>
<input type="hidden" name="x" value={this.state.x} />
<input type="hidden" name="y" value={this.state.y} />
</div>
);
}
}
The above example updates two hidden inputs with the new focal point coordinates every time they change. You could do something like this, or similar, in order to store the focal point in your database and then make custom crops as required.
MIT © Poki BV
FAQs
Component to help select the focal point in an image
We found that react-focal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.