Skip to content
Snippets Groups Projects
Commit f945c9f7 authored by bbaer's avatar bbaer
Browse files

updated to fabric 5

parent 03f93d8a
No related branches found
No related tags found
1 merge request!451Fabric update
Pipeline #7416 passed
This diff is collapsed.
......@@ -330,7 +330,7 @@ $(function (n) {
this.canvas.loadFromJSON(fabricJSON, function() {
this.firstLoad = true;
that.setBackground();
that.resizeCanvas();
//that.resizeCanvas();
if(!isReadOnly) { that.setBrush(); }
that.canvas.renderAll();
that.userChangePossible = true;
......@@ -546,14 +546,12 @@ $(function (n) {
if (this.backgroundImage) {
fabric.Image.fromURL(this.backgroundImage, function(img) {
img.set({
width: that.canvas.width,
height: that.canvas.height,
originX: 'left',
originY: 'top',
lockUniScaling: true,
centeredScaling: true,
centeredRotation: true
});
img.scaleX = that.canvas.width / img.width;
img.scaleY = that.canvas.height / img.height;
that.canvas.setBackgroundImage(img, function() {
that.canvas.renderAll.bind(that.canvas);
that.canvas.renderAll();
......@@ -564,14 +562,14 @@ $(function (n) {
$image.onload = function() {
console.log("Image loaded");
var img = new fabric.Image(this, {
width: that.canvas.width,
height: that.canvas.height,
originX: 'left',
originY: 'top',
lockUniScaling: true,
centeredScaling: true,
centeredRotation: true
});
img.scaleX = that.canvas.width / img.width;
img.scaleY = that.canvas.height / img.height;
img.rotate(that.rotation);
that.canvas.setBackgroundImage(img, function() {
that.canvas.renderAll.bind(that.canvas);
......@@ -664,9 +662,9 @@ $(function (n) {
// for Fabric 1.x and current Fabric 2.0 beta has a major drawing bug.
n.Fabric.prototype.deleteActiveGroup = function() {
var that = this;
if (this.canvas.getActiveGroup()) {
this.canvas.getActiveGroup().forEachObject(function(o) { that.canvas.remove(o) });
this.canvas.discardActiveGroup().renderAll();
if (this.canvas.getActiveObjects()) {
this.canvas.getActiveObjects().forEach(function(o) { that.canvas.remove(o) });
this.canvas.discardActiveObject().renderAll();
} else {
this.canvas.remove(this.canvas.getActiveObject());
}
......@@ -1048,13 +1046,14 @@ $(function (n) {
}
var that = this;
this.outputField.val(JSON.stringify(that.canvas.toJSON()));
/*
if (this.qfqPage.qfqForm) {
this.qfqPage.qfqForm.eventEmitter.emitEvent('form.changed', n.EventEmitter.makePayload(that, null));
this.qfqPage.qfqForm.changeHandler();
this.qfqPage.qfqForm.form.formChanged = true;
} else {
throw("Error: Couldn't initialize qfqForm - not possible to send form.changed event");
}
}*/
}
};
......
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