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.
@1nd/fabric-history-pure-browser
Advanced tools
Undo and redo implementations on fabric-pure-browser version of fabric.js
Fabric.js history implementation
npm i fabric-history
import 'fabric-history';
<script src="https://raw.githubusercontent.com/lyzerk/fabric-history/master/src/index.js"></script>
Following commands will undo and redo the canvas.
canvas.undo();
canvas.redo();
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Fabric with history</title>
</head>
<body>
<canvas></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/3.4.0/fabric.min.js"></script>
<script src="//raw.githubusercontent.com/lyzerk/fabric-history/master/src/index.js"></script>
<script>
const canvas = new fabric.Canvas(document.querySelector('canvas'), {
isDrawingMode: true
})
document.addEventListener('keyup', ({ keyCode, ctrlKey } = event) => {
// Check Ctrl key is pressed.
if (!ctrlKey) {
return
}
// Check pressed button is Z - Ctrl+Z.
if (keyCode === 90) {
canvas.undo()
}
// Check pressed button is Y - Ctrl+Y.
if (keyCode === 89) {
canvas.redo()
}
})
</script>
</body>
</html>
You can find an advanced example on demo folder.
canvas.undo(function() {
console.log('post undo');
});
canvas.redo(function() {
console.log('post redo');
});
FAQs
Undo and redo implementations on fabric-pure-browser version of fabric.js
The npm package @1nd/fabric-history-pure-browser receives a total of 0 weekly downloads. As such, @1nd/fabric-history-pure-browser popularity was classified as not popular.
We found that @1nd/fabric-history-pure-browser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.