Fixed button changing on canvas products
This commit is contained in:
@@ -5,15 +5,17 @@ function ThreeDHandler(canvas) {
|
|||||||
var _image;
|
var _image;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
|
||||||
|
// Width is made bigger as this works better with resizing the editor
|
||||||
_overlay
|
_overlay
|
||||||
.set({
|
.set({
|
||||||
visible: false,
|
visible: false,
|
||||||
left: 0
|
left: 0
|
||||||
})
|
})
|
||||||
.addWithUpdate(new fabric.Rect({
|
.addWithUpdate(new fabric.Rect({
|
||||||
width: canvas.width,
|
width: canvas.width * 2,
|
||||||
height: canvas.height - 50,
|
height: canvas.height,
|
||||||
top: 50,
|
top: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
fill: canvas.backgroundColor,
|
fill: canvas.backgroundColor,
|
||||||
}));
|
}));
|
||||||
@@ -39,7 +41,10 @@ function ThreeDHandler(canvas) {
|
|||||||
.set({
|
.set({
|
||||||
width: canvas.width,
|
width: canvas.width,
|
||||||
visible: true
|
visible: true
|
||||||
}).bringToFront().canvas.renderAll();
|
}).bringToFront();
|
||||||
|
|
||||||
|
canvas.getButtonMenu().bringToFront();
|
||||||
|
canvas.renderAll();
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ var Canvas = fabric.util.createClass(fabric.Canvas, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.on('mouse:up', function () {
|
this.on('mouse:up', function () {
|
||||||
if (this.getImage().__cropped) {
|
if (this.getImage().__cropped && !this.get3dHandler().isEnabled()) {
|
||||||
this.getApertures().setTransparent(false);
|
this.getApertures().setTransparent(false);
|
||||||
|
|
||||||
// Trigger event to tell the image has been dragged.
|
// Trigger event to tell the image has been dragged.
|
||||||
@@ -142,6 +142,11 @@ var Canvas = fabric.util.createClass(fabric.Canvas, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
toggle3D: function (showAs3d) {
|
toggle3D: function (showAs3d) {
|
||||||
|
this.getButtonMenu().getItems().forEach(function(button) {
|
||||||
|
var buttonState = button.getId() === '3d' ? showAs3d : !showAs3d;
|
||||||
|
button.setActive(buttonState);
|
||||||
|
});
|
||||||
|
|
||||||
if (!showAs3d) {
|
if (!showAs3d) {
|
||||||
return this.get3dHandler().disable();
|
return this.get3dHandler().disable();
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
var imageUrl = '//images.photowall.com/products/' + $input.image_id.val() + '.jpg?h=450';
|
var imageUrl = '//images.photowall.com/products/' + $input.image_id.val() + '.jpg?h=450';
|
||||||
|
|
||||||
var editor = new ImageEditor('canvas-editor', {'type': 'wallpaper'})
|
var editor = new ImageEditor('canvas-editor', {'type': 'canvas'})
|
||||||
.loadImage(imageUrl, function() {
|
.loadImage(imageUrl, function() {
|
||||||
$input.w.trigger('input');
|
$input.w.trigger('input');
|
||||||
Event.handleResize();
|
Event.handleResize();
|
||||||
|
|||||||
Reference in New Issue
Block a user