This file contains hidden or 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(); | |
| dom.addNewRectangle({ left: 0, top: 0, right: dom.width, bottom: dom.height }, 0); |
This file contains hidden or 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 |
This file contains hidden or 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
| // to access a file, create a new instance of the File class by passing in | |
| // a standard OS-style path to the constructor. I've only tested this on | |
| // Windows, but a standard path on OS X should work, too. | |
| var f = new File("C:\\test.txt"); | |
| // unlike the file references created by the Files object, these have some | |
| // useful properties, like length, which is the file size in bytes |
This file contains hidden or 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 r = [], t; | |
| if (el && el.textRuns) { | |
| t = el.textChars; | |
| r = ["chars:", t.length,"words:", t.split(/\s+/).length]; | |
| } | |
| r.join(" "); |
This file contains hidden or 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
| // =========================================================================== | |
| try { (function() { | |
| if (!fw.selection || !fw.selection.length) { | |
| return; | |
| } | |
| var element = fw.selection[0], | |
| info = { | |
| name: element.name, |
This file contains hidden or 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
| // embed a local copy of the dojo JSON library, which has been changed | |
| // to not depend on any other part of dojo. that way, we don't have to | |
| // rely on external libraries. unlike Crockford's library, the dojo | |
| // implementation doesn't change the prototypes of basic types, which | |
| // caused problems for the Path panel, and possibly others. | |
| var dojo = {}; | |
| dojo.fromJson = function(/*String*/ json){ | |
| return eval("(" + json + ")"); // Object | |
| } |
This file contains hidden or 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
| private const SupportedFWEvents:Object = { | |
| onFwActiveDocumentChange: 1, | |
| onFwActiveSelectionChange: 1, | |
| onFwActiveToolChange: 1, | |
| ... | |
| }; | |
| private function onPreinitialize() : void | |
| { | |
| // we need to register these callbacks early in the startup process. |
This file contains hidden or 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 dp = [], | |
| files = []; | |
| // concat the two directories into one array of paths. note that the object | |
| // returned by enumFiles isn't a real array, so we can't call concat on it. | |
| files = files.concat(Files.enumFiles(fw.appSmartShapesDir), | |
| Files.enumFiles(fw.appSmartShapeToolsDir)); | |
| for (var i = 0, len = files.length; i < len; i++) { | |
| var file = files[i], |
This file contains hidden or 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
| /* | |
| This code takes a 2D transformation matrix described as a one-dimensional array | |
| (in column order, top to bottom and left to right) and decomposes it using the dojo | |
| matrix library. This input matrix should produce a 45-deg X skew: | |
| 1 1 0 | |
| 0 1 0 | |
| 0 0 1 | |
| The output of decompose() looks like this: |
This file contains hidden or 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
| onButtonDown = function(event) | |
| { | |
| event.result = [ | |
| ["save", "enabled", false], | |
| ["Pass", "enabled", false], | |
| ["save", "label", waitingFrase()] | |
| ]; | |
| } | |
| onButtonClick = function(event){ |