0.7.7-alpha: Merge branch 'main' into release

This commit is contained in:
Skyler Lehmkuhl 2025-01-13 22:35:01 -05:00
commit 3f0fcbb626
3 changed files with 37 additions and 4 deletions

View File

@ -1,3 +1,8 @@
# 0.7.7-alpha:
Bugfixes:
- Fix pasting multiple times
- Hack around broken files
# 0.7.6-alpha:
Bugfixes:
- Fix errors when images are not present in a saved file

View File

@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Lightningbeam",
"version": "0.7.6-alpha",
"version": "0.7.7-alpha",
"identifier": "org.lightningbeam.core",
"build": {
"frontendDist": "../src"

View File

@ -705,8 +705,32 @@ let actions = {
duplicateObject: {
create: (items) => {
redoStack.length = 0;
function deepCopyWithIdxMapping(obj, dictionary = {}) {
if (Array.isArray(obj)) {
return obj.map(item => deepCopyWithIdxMapping(item, dictionary));
}
if (obj === null || typeof obj !== 'object') {
return obj;
}
const newObj = {};
for (const key in obj) {
let value = obj[key];
if (key === 'idx' && !(value in dictionary)) {
dictionary[value] = uuidv4();
}
newObj[key] = value in dictionary ? dictionary[value] : value;
if (typeof newObj[key] === 'object' && newObj[key] !== null) {
newObj[key] = deepCopyWithIdxMapping(newObj[key], dictionary);
}
}
return newObj;
}
let action = {
items: items,
items: deepCopyWithIdxMapping(items),
object: context.activeObject.idx,
frame: context.activeObject.currentFrame.idx,
uuid: uuidv4(),
@ -2940,7 +2964,7 @@ class BaseShape {
// }
if (this.filled) {
ctx.beginPath();
if (this.fillImage) {
if (this.fillImage && this.fillImage instanceof Element) {
let pat;
if (this.fillImage instanceof Element ||
Object.keys(this.fillImage).length !== 0) {
@ -3315,7 +3339,11 @@ class Shape extends BaseShape {
// }
newShape.updateVertices();
newShape.fillStyle = this.fillStyle;
newShape.fillImage = this.fillImage;
if (this.fillImage instanceof Element) {
newShape.fillImage = this.fillImage.cloneNode(true)
} else {
newShape.fillImage = this.fillImage;
}
newShape.strokeStyle = this.strokeStyle;
newShape.lineWidth = this.lineWidth;
newShape.filled = this.filled;