Created
February 12, 2013 01:01
-
-
Save fwextensions/4759119 to your computer and use it in GitHub Desktop.
How to create a new layer at the top of the stack, add objects to it, and lock it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dom = fw.getDocumentDOM(), | |
currentLayerIndex = dom.currentLayerNum, | |
newLayerIndex; | |
dom.addNewLayer(null, false); | |
// currentLayerNum is set to the newly added layer | |
newLayerIndex = dom.currentLayerNum; | |
// put the new layer before the last layer. note that this won't work | |
// if the Web layer has sublayers. | |
dom.reorderLayer(newLayerIndex, dom.layers.length - 1, 0, 1); | |
// add an object to the new layer and lock it | |
dom.addNewRectangle({ left: 0, top: 0, right: 100, bottom: 100 }, 0); | |
dom.setLayerLocked(-1, -1, true, false); | |
// focus the previously active layer | |
dom.currentLayerNum = currentLayerIndex; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment