Skip to main content
100%

Adding a view overlay on the Sketch canvas

✓ Published0🌍 Public
KKevinGutowski
Last edited Mar 7, 2020
Created on Mar 7, 2020

This example uses the Sketch JavaScript API to add a fixed-size green view overlay onto the canvas of the currently selected document. The code retrieves the canvas placeholder view and its first subview, then creates an NSView with a green background and adds it as a subview. Layout constraints—using NSLayoutConstraint and relatedBy methods—anchor the overlay to the top-left corner and enforce fixed width and height values of 40 and 100 points, respectively.

AI-generated description

Similar vizzes