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

initialisation doesn't trigger form changed anymore

delayed redraw of canvas to display non cached background images
parent 0bbc0cb9
No related branches found
No related tags found
1 merge request!27Punktetool
......@@ -41,6 +41,7 @@ $(function (n) {
this.isDown = false;
this.origX = 0;
this.origY = 0;
this.userChangePossible = false;
// Handles button states and generation of said buttons. Should be renamed.
function ModeSettings() {
......@@ -247,6 +248,11 @@ $(function (n) {
}
this.setBackground();
this.setBrush();
var that = this;
setTimeout(function() {
that.canvas.renderAll();
that.userChangePossible = true;
}, 1000);
};
n.Fabric.prototype.generateCanvas = function() {
......@@ -602,11 +608,16 @@ $(function (n) {
n.Fabric.prototype.defaultChangeHandler = function (e) {
var that = this;
this.canvas.calcOffset();
this.outputField.val(JSON.stringify(that.canvas.toJSON()));
var $saveButton = $("#save-button");
$saveButton.removeClass("disabled");
$saveButton.addClass($saveButton.data('class-on-change') || 'alert-warning');
$saveButton.removeAttr("disabled");
console.log("Changehandler called.");
/* Important! Changes only possible after initialisation */
if (this.userChangePossible) {
console.log("User Change detected");
this.outputField.val(JSON.stringify(that.canvas.toJSON()));
var $saveButton = $("#save-button");
$saveButton.removeClass("disabled");
$saveButton.addClass($saveButton.data('class-on-change') || 'alert-warning');
$saveButton.removeAttr("disabled");
}
};
/*
......
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