Skip to content
This repository has been archived by the owner on Oct 26, 2019. It is now read-only.

Commit

Permalink
Add live update to background color in inspetor
Browse files Browse the repository at this point in the history
  • Loading branch information
zachrispoli committed Feb 26, 2018
1 parent a5ec867 commit 130e273
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
6 changes: 5 additions & 1 deletion src/editor/interfaces/Interfaces.Canvas.Backdrop.js
Expand Up @@ -45,7 +45,11 @@ var CanvasBackdrop = function (wickEditor, canvasContainer) {
backdropDiv.style["-webkit-transform"] = transform;
backdropDiv.style["transform"] = transform;

backdropDiv.style.backgroundColor = wickEditor.project.backgroundColor;
self.setColor(wickEditor.project.backgroundColor);
}

self.setColor = function (color) {
backdropDiv.style.backgroundColor = color;
}

}
4 changes: 3 additions & 1 deletion src/editor/interfaces/Interfaces.ColorPicker.js
Expand Up @@ -63,7 +63,9 @@ var ColorPickerInterface = function (wickEditor) {
maxSelectionSize: 6,
move: function (color) {
var colorString = color.toString();
if(previewType) {
if(previewType && previewType === 'background-color') {
wickEditor.canvas.getBackdrop().setColor(colorString)
} else if (previewType) {
wickEditor.project.getSelectedObjects().forEach(function (o) {
if(!o.paper || o.isSymbol) return;
o.paper[previewType] = colorString;
Expand Down
1 change: 1 addition & 0 deletions src/editor/interfaces/Interfaces.Inspector.Properties.js
Expand Up @@ -350,6 +350,7 @@ InspectorInterface.getProperties = function (wickEditor, inspector) {
properties.push(new InspectorInterface.ColorPickerInput({
title: '<img src="resources/inspector-icons/paint.svg" class="inspector-icon"/>',
tooltip: 'Background Color',
previewType: 'background-color',
isActiveFn: function () {
return selectionInfo.type === 'project';
},
Expand Down
6 changes: 3 additions & 3 deletions src/editor/interfaces/Interfaces.Inspector.js
Expand Up @@ -225,11 +225,11 @@ var InspectorInterface = function (wickEditor) {
} else if(selectionInfo.numObjects > 1) {

if(selectionInfo.type === 'wickobject') {
title = "Multiple Objects"
image = null;
title = "<p style='font-size:18px;'>Multiple Objects</p>"
image = './resources/inspector-icons/multipleobjects.svg';
} else if (selectionInfo.type === 'frame') {
title = "Multiple Frames"
image = null;
image = "./resources/inspector-edit-timeline.svg"
}

} else if(selectionInfo.type === 'wickobject') {
Expand Down
16 changes: 9 additions & 7 deletions src/player/WickPlayer.PixiRenderer.js
Expand Up @@ -96,13 +96,15 @@ var WickPixiRenderer = function (canvasContainer) {
}
if(!renderExtraSpace) renderExtraSpace = 1;

graphics.clear();
graphics.beginFill(parseInt(project.backgroundColor.replace("#","0x")));
graphics.moveTo(0, 0);
graphics.lineTo(project.width, 0);
graphics.lineTo(project.width, project.height);
graphics.lineTo(0, project.height);
graphics.endFill();
if(renderExtraSpace === 1) {
graphics.clear();
graphics.beginFill(parseInt(project.backgroundColor.replace("#","0x")));
graphics.moveTo(0, 0);
graphics.lineTo(project.width, 0);
graphics.lineTo(project.width, project.height);
graphics.lineTo(0, project.height);
graphics.endFill();
}

wickProject = project;

Expand Down
Binary file added tests/test.wick
Binary file not shown.

0 comments on commit 130e273

Please sign in to comment.