diff --git a/bin/web/js/artboard.js b/bin/web/js/artboard.js index c0d0f51..065f091 100644 --- a/bin/web/js/artboard.js +++ b/bin/web/js/artboard.js @@ -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')) { diff --git a/bin/web/js/exporter.js b/bin/web/js/exporter.js index 7d21b19..36a1ad2 100644 --- a/bin/web/js/exporter.js +++ b/bin/web/js/exporter.js @@ -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);