aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZachary Zhang <zacharyzhang7@gmail.com>2024-06-18 14:53:35 -0400
committerZachary Zhang <zacharyzhang7@gmail.com>2024-06-18 14:53:35 -0400
commitebb77ad1c5d7a6edb83668bed3688799bd2fc4fe (patch)
treeed22c1c96aafd0c9dcf1ad35a5674a8eb18394ee /src
parent6d8249f4f54a00bcbef740a3cd2114a6ddd77c55 (diff)
working line lock
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/DiagramBox.tsx26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/client/views/nodes/DiagramBox.tsx b/src/client/views/nodes/DiagramBox.tsx
index 15e569949..fcf6e580b 100644
--- a/src/client/views/nodes/DiagramBox.tsx
+++ b/src/client/views/nodes/DiagramBox.tsx
@@ -318,20 +318,34 @@ export class DiagramBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
});
const inkToDelete:Doc=lineArray[j];
- if(typeof closestStartRect.x==='number'&&typeof closestStartRect.y==='number'&&typeof closestEndRect.x==='number'&&typeof closestEndRect.y==='number'&&typeof closestStartRect.width==='number'&&typeof closestStartRect.height==='number'){
+ if(typeof closestStartRect.x==='number'&&typeof closestStartRect.y==='number'&&typeof closestEndRect.x==='number'&&typeof closestEndRect.y==='number'&&typeof closestStartRect.width==='number'&&typeof closestStartRect.height==='number'&&typeof closestEndRect.height==='number'&&typeof closestEndRect.width==='number'){
const points: PointData[] = [
{ X: closestStartRect.x, Y: closestStartRect.y },
{ X: closestStartRect.x, Y: closestStartRect.y },
{ X: closestEndRect.x, Y: closestEndRect.y },
{ X: closestEndRect.x, Y: closestEndRect.y }
];
+ let inkX=0;
+ let inkY=0;
+ if(this.getMidPoint(closestEndRect).X<this.getMidPoint(closestStartRect).X){
+ inkX=this.getMidPoint(closestEndRect).X
+ }
+ else{
+ inkX=this.getMidPoint(closestStartRect).X
+ }
+ if(this.getMidPoint(closestEndRect).Y<this.getMidPoint(closestStartRect).Y){
+ inkY=this.getMidPoint(closestEndRect).Y
+ }
+ else{
+ inkY=this.getMidPoint(closestStartRect).Y
+ }
const newInkDoc:Doc=Docs.Create.InkDocument(
points,
{ title: 'stroke',
- x: closestStartRect.x+closestStartRect.width/2,
- y: closestStartRect.y+closestStartRect.height/2,
- _width: closestStartRect.width,
- _height: closestStartRect.height,
+ x: inkX,
+ y: inkY,
+ _width: Math.abs(closestEndRect.x+closestEndRect.width/2-closestStartRect.x-closestStartRect.width/2),
+ _height: Math.abs(closestEndRect.y+closestEndRect.height/2-closestStartRect.y-closestStartRect.height/2),
stroke_showLabel: BoolCast(Doc.UserDoc().activeInkHideTextLabels)}, // prettier-ignore
1)
@@ -341,7 +355,7 @@ export class DiagramBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
if(!inkToDelete.transformed){
docViewForYourCollection.ComponentView?.removeDocument(inkToDelete)
docViewForYourCollection.ComponentView?.addDocument(newInkDoc);
- newInkDoc.transformed=true;
+ newInkDoc.transformed=false;
}
const bruh2= DocListCast(this.Document.data).filter(doc => doc.title === 'line' || doc.title === 'stroke').map(doc => DocumentManager.Instance.getDocumentView(doc, this.DocumentView?.())).filter(inkView => inkView?.ComponentView instanceof InkingStroke).map(stroke => stroke?.ComponentView);