Merge branch 'master' into interactivity
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var config = require('../config');
|
||||||
|
|
||||||
function FrameHandler(viewport) {
|
function FrameHandler(viewport) {
|
||||||
var _frames;
|
var _frames;
|
||||||
var _frameType;
|
var _frameType;
|
||||||
@@ -18,7 +20,7 @@ function FrameHandler(viewport) {
|
|||||||
* Sets the 4 rectangles which are used when current canvas should be framed
|
* Sets the 4 rectangles which are used when current canvas should be framed
|
||||||
*/
|
*/
|
||||||
function initFrames() {
|
function initFrames() {
|
||||||
var frame = new fabric.Rect({ fill: '#000000', stroke: '#000000', width: 1, height: 1 });
|
var frame = new fabric.Rect(config.frames.default);
|
||||||
|
|
||||||
_frames = {
|
_frames = {
|
||||||
top: frame.clone(),
|
top: frame.clone(),
|
||||||
@@ -90,21 +92,12 @@ function FrameHandler(viewport) {
|
|||||||
_frames.right.height -= (viewport.getData().ppmm * 29) * 2;
|
_frames.right.height -= (viewport.getData().ppmm * 29) * 2;
|
||||||
_frames.left.height = _frames.right.height;
|
_frames.left.height = _frames.right.height;
|
||||||
|
|
||||||
frameargs = {
|
frameargs = config.frames.image;
|
||||||
fill: 'rgba(0,0,0,0.2)',
|
|
||||||
strokeWidth: 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
} else if (frameType === 'white') {
|
} else if (frameType === 'white') {
|
||||||
frameargs = {
|
frameargs = config.frames.white;
|
||||||
fill: '#ffffff',
|
|
||||||
strokeWidth: 0,
|
|
||||||
};
|
|
||||||
} else if (frameType === 'black') {
|
} else if (frameType === 'black') {
|
||||||
frameargs = {
|
frameargs = config.frames.black;
|
||||||
fill: '#000000',
|
|
||||||
strokeWidth: 0,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getFramesAsArray().forEach(function (o) {
|
getFramesAsArray().forEach(function (o) {
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ function ImageEditor(canvasId, args) {
|
|||||||
*/
|
*/
|
||||||
if (_canvas.__type === 'canvas') {
|
if (_canvas.__type === 'canvas') {
|
||||||
_canvas.getButtonMenu()
|
_canvas.getButtonMenu()
|
||||||
.addItem('3D', function () {
|
|
||||||
self.toggle3D(true);
|
|
||||||
})
|
|
||||||
.addItem('Flat', function () {
|
.addItem('Flat', function () {
|
||||||
self.toggle3D(false);
|
self.toggle3D(false);
|
||||||
})
|
})
|
||||||
|
.addItem('3D', function () {
|
||||||
|
self.toggle3D(true);
|
||||||
|
})
|
||||||
.render();
|
.render();
|
||||||
} else {
|
} else {
|
||||||
_canvas.getButtonMenu()
|
_canvas.getButtonMenu()
|
||||||
|
|||||||
@@ -39,11 +39,10 @@ function Viewport(canvas) {
|
|||||||
if (canvas.__type !== 'canvas') {
|
if (canvas.__type !== 'canvas') {
|
||||||
drawBeams();
|
drawBeams();
|
||||||
} else {
|
} else {
|
||||||
// drawFrames
|
self.setFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.getDragbars().apply();
|
canvas.getDragbars().apply();
|
||||||
self.setFrame();
|
|
||||||
// Apertures sometimes overlaps the viewports bounding rect.
|
// Apertures sometimes overlaps the viewports bounding rect.
|
||||||
// Solve this by bringing it to the front after apertures are applied.
|
// Solve this by bringing it to the front after apertures are applied.
|
||||||
_rect.bringToFront();
|
_rect.bringToFront();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
frames: require('./config/frames'),
|
||||||
textButton: require('./config/text-button'),
|
textButton: require('./config/text-button'),
|
||||||
buttonMenu: require('./config/button-menu'),
|
buttonMenu: require('./config/button-menu'),
|
||||||
rulerHandle: require('./config/ruler-handle'),
|
rulerHandle: require('./config/ruler-handle'),
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
canvas: {
|
canvas: {
|
||||||
margin: 0,
|
margin: 5,
|
||||||
text: {
|
text: {
|
||||||
fill: '#ffffff',
|
fill: '#ffffff',
|
||||||
activeFill: '#000000',
|
activeFill: '#ffffff',
|
||||||
},
|
},
|
||||||
rect: {
|
rect: {
|
||||||
fill: '#444444',
|
fill: '#000000',
|
||||||
activeFill: '#ffffff',
|
activeFill: '#444444',
|
||||||
width: 100,
|
width: 100,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
default: {
|
||||||
|
fill: '#000000',
|
||||||
|
stroke: '#f31fb3',
|
||||||
|
width: 1,
|
||||||
|
height: 1,
|
||||||
|
},
|
||||||
|
|
||||||
|
image: {
|
||||||
|
fill: 'rgba(0,0,0,0.2)',
|
||||||
|
strokeWidth: 1,
|
||||||
|
},
|
||||||
|
|
||||||
|
black: {
|
||||||
|
fill: '#000000',
|
||||||
|
strokeWidth: 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
white: {
|
||||||
|
fill: '#ffffff',
|
||||||
|
strokeWidth: 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user