diff --git a/src/data.js b/src/data.js index 6922bad..974c124 100644 --- a/src/data.js +++ b/src/data.js @@ -1538,7 +1538,7 @@ export class DrawObjectPicture extends DrawObject { commitPreshift(target) { if (!this.preshift && !this.uncommitted) return if (target) { - const newstorage = Math.floor(this.posy + (this.preshift.y ?? 0)) + const newstorage = Math.floor(this.posy + (this.preshift?.y ?? 0)) if (newstorage !== this.storagenum() || this.uncommitted) { // ok we have to delete the old obj and create a new one let newobjid @@ -1552,8 +1552,8 @@ export class DrawObjectPicture extends DrawObject { null, newobjid, null, - this.posx + (this.preshift.x ?? 0), - this.posy + (this.preshift.y ?? 0), + this.posx + (this.preshift?.x ?? 0), + this.posy + (this.preshift?.y ?? 0), this.width, this.height, this.uuid @@ -1566,8 +1566,8 @@ export class DrawObjectPicture extends DrawObject { null, this.objid, null, - this.posx + (this.preshift.x ?? 0), - this.posy + (this.preshift.y ?? 0) + this.posx + (this.preshift?.x ?? 0), + this.posy + (this.preshift?.y ?? 0) ) } } @@ -1578,8 +1578,8 @@ export class DrawObjectPicture extends DrawObject { const newobj = new DrawObjectPicture(target.newobjid(this.objid)) newobj.uncommitted = true newobj.addPicture( - this.posx + (this.preshift.x ?? 0) + shift.x, - this.posy + (this.preshift.y ?? 0) + shift.y, + this.posx + (this.preshift?.x ?? 0) + shift.x, + this.posy + (this.preshift?.y ?? 0) + shift.y, this.width, this.height, this.uuid, @@ -1874,7 +1874,7 @@ export class DrawObjectForm extends DrawObject { commitPreshift(target) { if (!this.preshift && !this.uncommitted) return if (target) { - const newstorage = Math.floor(this.posy + (this.preshift.y ?? 0)) + const newstorage = Math.floor(this.posy + (this.preshift?.y ?? 0)) if (newstorage !== this.storagenum() || this.uncommitted) { // ok we have to delete the old obj and create a new one let newobjid @@ -1888,8 +1888,8 @@ export class DrawObjectForm extends DrawObject { null, newobjid, null, - this.posx + (this.preshift.x ?? 0), - this.posy + (this.preshift.y ?? 0), + this.posx + (this.preshift?.x ?? 0), + this.posy + (this.preshift?.y ?? 0), this.width, this.height, this.formtype, @@ -1905,8 +1905,8 @@ export class DrawObjectForm extends DrawObject { null, this.objid, null, - this.posx + (this.preshift.x ?? 0), - this.posy + (this.preshift.y ?? 0) + this.posx + (this.preshift?.x ?? 0), + this.posy + (this.preshift?.y ?? 0) ) } } @@ -1917,8 +1917,8 @@ export class DrawObjectForm extends DrawObject { const newobj = new DrawObjectForm(target.newobjid(this.objid)) newobj.uncommitted = true newobj.addForm( - this.posx + (this.preshift.x ?? 0) + shift.x, - this.posy + (this.preshift.y ?? 0) + shift.y, + this.posx + (this.preshift?.x ?? 0) + shift.x, + this.posy + (this.preshift?.y ?? 0) + shift.y, this.width, this.height, this.formtype, @@ -2084,7 +2084,7 @@ export class DrawObjectGlyph extends DrawObject { if (!this.preshift && !this.uncommitted) return if (target && this.pathpoints.length > 0) { const newstorage = Math.floor( - (this.preshift.y ?? 0) + this.pathpoints[0].y * this.isvgscale + (this.preshift?.y ?? 0) + this.pathpoints[0].y * this.isvgscale ) const oldstorage = this.storagenum() if (newstorage !== oldstorage || this.uncommitted) { @@ -2100,8 +2100,8 @@ export class DrawObjectGlyph extends DrawObject { null, newobjid, null, - this.pathpoints[0].x * this.isvgscale + (this.preshift.x ?? 0), - this.pathpoints[0].y * this.isvgscale + (this.preshift.y ?? 0), + this.pathpoints[0].x * this.isvgscale + (this.preshift?.x ?? 0), + this.pathpoints[0].y * this.isvgscale + (this.preshift?.y ?? 0), this.gtype, Color(this.color).rgbNumber(), this.penwidth * this.isvgscale, @@ -2112,8 +2112,8 @@ export class DrawObjectGlyph extends DrawObject { null, newobjid, null, - this.pathpoints[i].x * this.isvgscale + (this.preshift.x ?? 0), - this.pathpoints[i].y * this.isvgscale + (this.preshift.y ?? 0), + this.pathpoints[i].x * this.isvgscale + (this.preshift?.x ?? 0), + this.pathpoints[i].y * this.isvgscale + (this.preshift?.y ?? 0), this.pathpoints[i].press ) } @@ -2128,8 +2128,8 @@ export class DrawObjectGlyph extends DrawObject { null, this.objid, null, - this.pathpoints[0].x * this.isvgscale + (this.preshift.x ?? 0), - this.pathpoints[0].y * this.isvgscale + (this.preshift.y ?? 0) + this.pathpoints[0].x * this.isvgscale + (this.preshift?.x ?? 0), + this.pathpoints[0].y * this.isvgscale + (this.preshift?.y ?? 0) ) } } @@ -2140,8 +2140,8 @@ export class DrawObjectGlyph extends DrawObject { const newobj = new DrawObjectGlyph(target.newobjid(this.objid)) newobj.uncommitted = true newobj.startPath( - this.pathpoints[0].x * this.isvgscale + (this.preshift.x ?? 0) + shift.x, - this.pathpoints[0].y * this.isvgscale + (this.preshift.y ?? 0) + shift.y, + this.pathpoints[0].x * this.isvgscale + (this.preshift?.x ?? 0) + shift.x, + this.pathpoints[0].y * this.isvgscale + (this.preshift?.y ?? 0) + shift.y, this.gtype, Color( this.color.rgbNumber(), @@ -2152,10 +2152,10 @@ export class DrawObjectGlyph extends DrawObject { for (let i = 1; i < this.pathpoints.length; i++) { newobj.addToPath( this.pathpoints[i].x * this.isvgscale + - (this.preshift.x ?? 0) + + (this.preshift?.x ?? 0) + shift.x, this.pathpoints[i].y * this.isvgscale + - (this.preshift.y ?? 0) + + (this.preshift?.y ?? 0) + shift.y, this.pathpoints[i].press )