Skip to content

Commit

Permalink
feat: Add ScalableTextbox class and retrieve stored fonts from localS…
Browse files Browse the repository at this point in the history
…torage
  • Loading branch information
lebmatter committed Sep 9, 2024
1 parent 51f0b47 commit 9ec9759
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
document.addEventListener('DOMContentLoaded', () => {
// Initialize Fabric.js canvas
var canvas = new fabric.Canvas('comic-artboard');
// Define ScalableTextbox
fabric.ScalableTextbox = fabric.util.createClass(fabric.Textbox, {
type: 'scalableTextbox',
initialize: function(text, options) {
options || (options = {});
this.callSuper('initialize', text, options);
},
_renderText: function(ctx) {
this.callSuper('_renderText', ctx);
ctx.scale(1 / this.scaleX, 1 / this.scaleY);
}
});

// Initialize Fabric.js canvas
var canvas = new fabric.Canvas('comic-artboard');

// Retrieve stored fonts from localStorage
var storedFonts = JSON.parse(localStorage.getItem('customFonts')) || [];
// Retrieve stored fonts from localStorage
var storedFonts = JSON.parse(localStorage.getItem('customFonts')) || [];

// Function to delete selected item
function deleteSelectedItem() {
Expand Down

0 comments on commit 9ec9759

Please sign in to comment.