From 5614366a62742ff4a94f33edfecbb705bbd89e5e Mon Sep 17 00:00:00 2001 From: Grant Kimsey Date: Tue, 9 May 2023 10:01:36 -0400 Subject: [PATCH] Replace deprecated absoluteInfluenceRect call, fixing sync error --- .../Contents/Sketch/core/api.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/RealtimeBoard.sketchplugin/Contents/Sketch/core/api.js b/RealtimeBoard.sketchplugin/Contents/Sketch/core/api.js index 6d9dedd..baad61c 100644 --- a/RealtimeBoard.sketchplugin/Contents/Sketch/core/api.js +++ b/RealtimeBoard.sketchplugin/Contents/Sketch/core/api.js @@ -284,11 +284,14 @@ function Api() { var resourceId = context.command.valueForKey_onLayer_forPluginIdentifier(boardId, artboard, "rtb_sync"); var originalId = context.command.valueForKey_onLayer_forPluginIdentifier("originalId", artboard, "rtb_sync"); var objectId = [artboard objectID]; - var absoluteInfluenceRect = [artboard absoluteInfluenceRect]; - var xPos = absoluteInfluenceRect.origin.x; - var yPos = absoluteInfluenceRect.origin.y; - var width = absoluteInfluenceRect.size.width; - var height = absoluteInfluenceRect.size.height; + + const document = [artboard documentData]; + const immutable = [artboard immutableModelObject]; + const relativeInfluenceRect = immutable.influenceRectForBoundsInDocument(document); + var xPos = relativeInfluenceRect.origin.x; + var yPos = relativeInfluenceRect.origin.y; + var width = relativeInfluenceRect.size.width; + var height = relativeInfluenceRect.size.height; var centralXPos = width / 2 + xPos; var centralYPos = height / 2 + yPos; var transformationData = '\\"positionData\\":{\\"x\\": ' + centralXPos + ', \\"y\\":' + centralYPos + ' }';