new wcPlayEditor(container [, options])
Provides a visual interface for editing a Play script. Requires HTML5 canvas.
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
container |
external:jQuery~Object | external:jQuery~Selector | external:domNode | The container element. | |
options |
wcPlayEditor~Options |
<optional> |
Custom options. |
Methods
-
function __drawDetailsPopup(node) -
Draws the detail popup box for the node.
Parameters:
Name Type Description nodewcNode The node to draw for. -
function __drawPalettePopup(pos [, linkNode] [, linkName] [, linkType] [, onFinished]) -
Draws the popup that allows the user to select a node type.
Parameters:
Name Type Argument Description poswcPlay~Coordinates The position to center the popup. linkNodewcNode <optional>
If supplied, the source node to link with. linkNamestring <optional>
If supplied, the name of the source link. linkTypewcNode.LINK_TYPE <optional>
If supplying a node, this is the type of link you are attaching to. onFinishedwcPlayEditor~OnPalettePopupFinished <optional>
A callback function to call when the popup has resolved. -
function center() -
Positions the canvas view to the center of all nodes.
-
function clearModified() -
Clears the modified state of the current script. Note, this is done automatically when saving the script, use this only under special circumstances.
-
function engine( [engine]) -> wcPlay -
Gets, or Sets the wcPlay engine that this renderer will render.
Parameters:
Name Type Argument Description enginewcPlay <optional>
If supplied, will assign a new wcPlay engine to render. Returns:
- The current wcPlay engine.- Type
- wcPlay
-
function error(args) -
Outputs an error message.
Parameters:
Name Type Argument Description argsstring <repeatable>
The log messages. -
function focus(nodes) -
Scrolls the canvas view until a given set of nodes are within view.
Parameters:
Name Type Description nodeswcNode A list of nodes to focus the view on. -
function focusRect(rect) -
Scrolls the canvas view and centers on a given bounding rectangle.
Parameters:
Name Type Description rectwcPlayEditor~Rect The rectangle to focus on. -
function isModified() -> boolean -
Retrieves whether unsaved changes exist in the current script.
Returns:
- Whether the script has unsaved changes.- Type
- boolean
-
function log(args) -
Outputs a log message.
Parameters:
Name Type Argument Description argsstring <repeatable>
The log messages. -
function menu() -> wcMenu -
Retrieves the menu instance.
Returns:
- The wcMenu object.- Type
- wcMenu
-
function onBeforeImport(func) -> boolean -
Binds an event handler for when we are about to save our script.
Parameters:
Name Type Description funcfunction Assigns the function to handle this event. Returns:
- Success or failure.- Type
- boolean
-
function onBeforeLoad(func) -> boolean -
Binds an event handler for when we are about to save our script.
Parameters:
Name Type Description funcfunction Assigns the function to handle this event. Returns:
- Success or failure.- Type
- boolean
-
function onBeforeSave(func) -> boolean -
Binds an event handler for when we are about to save our script.
Parameters:
Name Type Description funcfunction Assigns the function to handle this event. Returns:
- Success or failure.- Type
- boolean
-
function onBeginUndoGroup(description) -
Event that is called to begin an undo manager group operation.
Parameters:
Name Type Description descriptionstring The description of the undo event. -
function onDisconnectEntryChains(node, linkName) -
Disconnects all chains attached to a node's entry link.
Parameters:
Name Type Description nodewcNode The node to disconnect from. linkNamestring The name of the link. -
function onDisconnectExitChains(node, linkName) -
Disconnects all chains attached to a node's exit link.
Parameters:
Name Type Description nodewcNode The node to disconnect from. linkNamestring The name of the link. -
function onDisconnectInputChains(node, linkName) -
Disconnects all chains attached to a node's input link.
Parameters:
Name Type Description nodewcNode The node to disconnect from. linkNamestring The name of the link. -
function onDisconnectOutputChains(node, linkName) -
Disconnects all chains attached to a node's output link.
Parameters:
Name Type Description nodewcNode The node to disconnect from. linkNamestring The name of the link. -
function onEndUndoGroup() -
Event that is called to end an undo manager group operation.
-
function onImported(func) -> boolean -
Binds an event handler for when we are about to save our script.
Parameters:
Name Type Description funcfunction Assigns the function to handle this event. Returns:
- Success or failure.- Type
- boolean
-
function onLoaded(func) -> boolean -
Binds an event handler for when we are about to save our script.
Parameters:
Name Type Description funcfunction Assigns the function to handle this event. Returns:
- Success or failure.- Type
- boolean
-
function onResized() -
Event that is called when the container view is resized.
-
function onSaved(func) -> boolean -
Binds an event handler for when we are about to save our script.
Parameters:
Name Type Description funcfunction Assigns the function to handle this event. Returns:
- Success or failure.- Type
- boolean
-
function triggerEvent(eventName, args) -
Triggers a previously bound event handler.
Parameters:
Name Type Description eventNamestring The name of the event to trigger. argsArray.<Object> Any parameter arguments you wish to send to the triggered event nodes. These parameters are based on the node being triggered. -
<inner> functionMenuDescriptionFunc(editor, engine) -
A callback that retrieves the description string for a menu option.
Parameters:
Name Type Description editorwcPlayEditor The instance of the editor invoking the menu option. enginewcPlay The instance of the script engine being viewed by the editor. - Source:
-
<inner> functionMenuIconFunc(editor, engine) -
A callback that retrieves the icon class for a menu option.
Parameters:
Name Type Description editorwcPlayEditor The instance of the editor invoking the menu option. enginewcPlay The instance of the script engine being viewed by the editor. - Source:
Type Definitions
-
typedef var BoundingData -
Bounding information for links on a node.
Type:
- Object
- Source:
Properties:
Name Type Description rectwcPlayEditor~Rect The bounding rectangle. pointwcPlay~Coordinates The anchor point where lines will attach to this link. nameString The name of the bounded object. -
typedef var CategoryOptions -
Category display options.
Type:
- Object
- Source:
Properties:
Name Type Description itemsArray.<String> A list of categories to show in the palette. isBlacklistBoolean If true, the items list will be treated as a blacklist of categories to hide. -
typedef var DrawNodeData -
Data associated with a drawn node.
Type:
- Object
- Source:
Properties:
Name Type Description nodewcNode The node instance. rectwcPlayEditor~Rect Bounding rectangle of the node (not including links that stick out). entryBoundsArray.<wcPlayEditor~BoundingData> Bounding data of entry links. exitBoundsArray.<wcPlayEditor~BoundingData> Bounding data of exit links. inputBoundsArray.<wcPlayEditor~BoundingData> Bounding data of property input links. outputBoundsArray.<wcPlayEditor~BoundingData> Bounding data of property output links. valueBoundsArray.<wcPlayEditor~BoundingData> Bounding data of property value text. initialBoundsArray.<wcPlayEditor~BoundingData> Bounding data of property initial value text. -
typedef var MenuOptions -
Custom options for a menu option.
Type:
- Object
- Source:
Properties:
Name Type Argument Description iconString | wcPlayEditor~MenuIconFunc <optional>
A classname to apply as an icon for the option. If this is a function, it will be called during the update call and should return the icon class. description|wcPlayEditor~MenuDescriptionFuncString <optional>
The description to show as a tooltip for this option. itemIndexNumber <optional>
An insertion index to insert the item within the menu category, default is to append to the end. categoryIndexNumber <optional>
If this creates a new category, it will be inserted at this index in the top level menu. toolbarIndexBoolean <optional>
If supplied, creates a toolbar button for this option and inserts it in the tab bar at the specified index. -1 will append it to the end. hotkeysString <optional>
A string that describes hotkeys for your control, the format is 'Ctrl+Z' or 'Alt+Shift+L,Shift+L' for multiple. conditionfunction <optional>
A function to call during the update to determine if the menu option should be enabled or disabled. Return false to disable the option. -
typedef function OnMenuActivated(event, editor, engine) -
On click handler for menu and toolbar options.
Parameters:
Name Type Description eventObject The mouse click event object. editorwcPlayEditor The instance of the editor invoking the menu option. enginewcPlay The instance of the script engine being viewed by the editor. - Source:
-
typedef var OnPalettePopupFinished -
A callback handler when a node has been created.
-
typedef var Options -
Custom options available when constructing a new wcPlay instance.
Type:
- Object
- Source:
Properties:
Name Type Argument Default Description readOnlyBoolean <optional>
false If true, the script will not be editable. playableBoolean <optional>
true Whether the script can be played using the live debugger. categorywcPlayEditor~CategoryOptions <optional>
Options that determine what categories appear in the palette. By default, all categories are visible. -
typedef var Rect -
The 2D bounds of a rectangle.
Type:
- Object
- Source:
Properties:
Name Type Description topNumber leftNumber widthNumber heightNumber