artboard color backwards compatibility
This commit is contained in:
parent
e4ca41c2f0
commit
48c7db3f6e
2 changed files with 15 additions and 2 deletions
|
@ -102,7 +102,7 @@ const Artboard = function(tp, domElement = false, autoInit = true) {
|
|||
let cppProps = JSON.parse(JSON.stringify(_props));
|
||||
let bgIsArray = Array.isArray(cppProps.color);
|
||||
if (bgIsArray && cppProps.color.length === 4) {
|
||||
cppProps.backgroundColor = color;
|
||||
cppProps.backgroundColor = cppProps.color;
|
||||
delete cppProps.color;
|
||||
// nothing to do
|
||||
} else if (!bgIsArray && cppProps.color.hasOwnProperty('r')) {
|
||||
|
|
|
@ -200,7 +200,12 @@ const Exporter = function() {
|
|||
};
|
||||
|
||||
const updateArtboardOptions = () => {
|
||||
options.artboard = {...options.artboard, ...Module.getArtboardProps()};
|
||||
const artboardValues = clone(Module.getArtboardProps());
|
||||
if (typeof artboardValues.backgroundColor === 'object') {
|
||||
artboardValues.color = artboardValues.backgroundColor;
|
||||
delete artboardValues.backgroundColor;
|
||||
}
|
||||
options.artboard = {...options.artboard, ...artboardValues};
|
||||
//options.artboard.width = getArtboard().theatreObject.value.width;
|
||||
//options.artboard.height = getArtboard().theatreObject.value.height;
|
||||
options.artboard.pixelDensity = getArtboard().theatreObject.value.pixelDensity;
|
||||
|
@ -218,6 +223,10 @@ const Exporter = function() {
|
|||
|
||||
const setArtboardPropsToRenderDimensions = () => {
|
||||
const artboardValues = clone(options.artboard);//{...options.artboard, ...renderDimensions};
|
||||
if (typeof artboardValues.backgroundColor === 'object') {
|
||||
artboardValues.color = artboardValues.backgroundColor;
|
||||
delete artboardValues.backgroundColor;
|
||||
}
|
||||
const densityRatio = renderDimensions.width / options.artboard.width;
|
||||
//artboardValues.pixelDensity *= densityRatio;
|
||||
artboardValues.pixelDensity = densityRatio;
|
||||
|
@ -227,6 +236,10 @@ const Exporter = function() {
|
|||
|| currentArtboardValues.height !== artboardCppProps.height
|
||||
|| currentArtboardValues.pixelDensity !== artboardCppProps.pixelDensity) {
|
||||
window.isRenderDirty = true;
|
||||
if (typeof artboardCppProps.color === 'object') {
|
||||
artboardCppProps.backgroundColor = artboardCppProps.color;
|
||||
delete artboardCppProps.color;
|
||||
}
|
||||
Module.setArtboardProps(artboardCppProps);
|
||||
}
|
||||
Module.setTimeScale(renderDimensions.timeScale);
|
||||
|
|
Loading…
Reference in a new issue