![]() ![]() This is the base class for most of the Sketch components and defines methods to manipulate them. In order to trigger a Smart Layout resize in an instance, for example after changing an override value, call the resizeWithSmartLayout() method on the SymbolInstance layer. If the override is selected (or undefined if it’s the override of a Symbol Source).Ĭonst SmartLayout = require ( ' sketch ' ). If the value of the override can be changed. It will be an immutable version of the layer. If the override hasn’t been changed and is the default value.ĪffectedLayer Text / Image / Symbol Instance The value of the override which can be change. If the override is a nested Symbol override. Mutating the returned array will update the document gradients. Mutating the returned array will update the document swatches.Ī list of gradient assets defined in the document. Mutating the returned array will update the document colors.Ī list of swatches defined in the document. The list of all shared text styles defined in the document.Ī list of color assets defined in the document. The list of all shared layer styles defined in the document. The path to the document (or the appcast URL in case of a Document from a remote Library). The Selection of the layers that the user has selected in the currently selected page. Var Document = require ( ' sketch/dom ' ). If it’s undefined, it means that we couldn’t match the native object and that we returned a really lightweight wrapper. ![]() componentInstance.type returns a string that represent the type of the component.If that is the case, you won’t be able to mutate the object (setting any property will be a no-op). componentInstance.isImmutable() returns true if the component is wrapping an immutable version of a native Sketch model object.componentInstance.sketchObject returns the native Sketch model object.new Component(properties) creates a new native Sketch model object and returns a wrapped object.Component.toJSON() return a JSON object that represent the component.omNative(sketchObject) returns a wrapped object from a native Sketch model object.These are thin wrappers, and contain no state - they just exist as a way to provide a cleaner and more stable coding interface to the underlying model. The approach taken by the API is to wrap the native Sketch model objects inside javascript objects. You access it by calling the global require function. The API comes bundled inside Sketch, so no installation is required. Var sketch = require ( ' sketch/dom ' ) var async = require ( ' sketch/async ' ) var DataSupplier = require ( ' sketch/data-supplier ' ) var UI = require ( ' sketch/ui ' ) var Settings = require ( ' sketch/settings ' ) // a more convenient require which exposes everything (might be a bit slower) var sketch = require ( ' sketch ' ) ![]()
0 Comments
Leave a Reply. |