Visualize border change in 3D mode

This commit is contained in:
Rikard Bartholf
2017-05-19 11:32:11 +02:00
parent 3a0fe9fde5
commit 4531f35979
3 changed files with 12 additions and 3 deletions
+1 -1
View File
@@ -12,7 +12,7 @@
<h1>Test</h1> <h1>Test</h1>
<form id="form-control"> <form id="form-control">
<div> <div>
<input type="text" name="image_id" value="45809" /> <input type="text" name="image_id" value="45810" />
<input type="text" name="w" value="100" /> <input type="text" name="w" value="100" />
<input type="text" name="h" value="100" /> <input type="text" name="h" value="100" />
Mirror: <input type="checkbox" class="image-control" name="mirror" /> Mirror: <input type="checkbox" class="image-control" name="mirror" />
+8 -2
View File
@@ -7,7 +7,8 @@ function ThreeDHandler(canvas) {
function init() { function init() {
_overlay _overlay
.set({ .set({
visible: false visible: false,
left: 0
}) })
.addWithUpdate(new fabric.Rect({ .addWithUpdate(new fabric.Rect({
width: canvas.width, width: canvas.width,
@@ -16,6 +17,7 @@ function ThreeDHandler(canvas) {
left: 0, left: 0,
fill: canvas.backgroundColor, fill: canvas.backgroundColor,
})); }));
canvas.add(_overlay); canvas.add(_overlay);
} }
@@ -33,7 +35,11 @@ function ThreeDHandler(canvas) {
* @return {ThreeDHandler} * @return {ThreeDHandler}
*/ */
this.enable = function () { this.enable = function () {
_overlay.setVisible(true).canvas.renderAll(); _overlay
.set({
width: canvas.width,
visible: true
}).bringToFront().canvas.renderAll();
return this; return this;
}; };
@@ -140,6 +140,9 @@ function Viewport(canvas) {
*/ */
this.setFrame = function (frameType) { this.setFrame = function (frameType) {
this.getFrameHandler().setFrames(frameType); this.getFrameHandler().setFrames(frameType);
if (canvas.get3dHandler().isEnabled()) {
canvas.toggle3D(true);
}
}; };
this.getData = function () { this.getData = function () {