21 lines
591 B
JavaScript
21 lines
591 B
JavaScript
// Canvas size duplicate helpers.
|
|
|
|
function buildDuplicateCanvasSizeName(name) {
|
|
const source = String(name || 'Canvas size').trim() || 'Canvas size';
|
|
return 'Copy of ' + source;
|
|
}
|
|
|
|
function buildDuplicateCanvasSize(canvasSize, duplicateName) {
|
|
const source = canvasSize || {};
|
|
return {
|
|
id: null,
|
|
name: String(duplicateName || buildDuplicateCanvasSizeName(source.name)).trim(),
|
|
width: Math.max(1, Number(source.width || 1920)),
|
|
height: Math.max(1, Number(source.height || 1080))
|
|
};
|
|
}
|
|
|
|
module.exports = {
|
|
buildDuplicateCanvasSizeName,
|
|
buildDuplicateCanvasSize
|
|
}; |