Fixes for 3D image

* URL needs to be URI encoded, else Firefox won't cope
* Hide / Show 3D overlay instead of removing / re-adding
This commit is contained in:
Rikard Bartholf
2017-05-18 18:45:57 +02:00
parent 982931db5d
commit 6e605d21d7
2 changed files with 16 additions and 18 deletions
+14 -15
View File
@@ -6,34 +6,33 @@ function ThreeDHandler(canvas) {
var self = this;
function init() {
_overlay.addWithUpdate(new fabric.Rect({
width: canvas.width,
height: canvas.height - 60,
top: 60,
left: 0,
fill: canvas.backgroundColor,
}));
_overlay
.set({
visible: false
})
.addWithUpdate(new fabric.Rect({
width: canvas.width,
height: canvas.height - 60,
top: 60,
left: 0,
fill: canvas.backgroundColor,
}));
canvas.add(_overlay);
}
init();
this.disable = function () {
canvas.remove(_overlay);
canvas.renderAll();
_overlay.setVisible(false).canvas.renderAll();
return this;
};
this.enable = function () {
if (!_overlay.canvas) {
canvas.add(_overlay);
}
canvas.renderAll();
_overlay.setVisible(true).canvas.renderAll();
return this;
};
this.setImage = function (img) {
this.enable();
img.set({
originX: 'center',
originY: 'center',
@@ -43,7 +42,7 @@ function ThreeDHandler(canvas) {
.remove(_image)
.add(_image = img);
return this;
return this.enable();
};
}