Skip to content

Commit

Permalink
Merge pull request #31 from gwkimsey/fix-absolute-rect-sync-issue
Browse files Browse the repository at this point in the history
Replace deprecated absoluteInfluenceRect call, fixing sync error
  • Loading branch information
inderjits1 authored Jun 5, 2023
2 parents 2a189e8 + 5614366 commit 56fd0ad
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions RealtimeBoard.sketchplugin/Contents/Sketch/core/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ' }';
Expand Down

0 comments on commit 56fd0ad

Please sign in to comment.