Autodesk Creative Platform UI Toolkit Version 1.5.0
Comprehensive set of reusable HTML5 controls and templates

Controls.Sketch2D Overview

An HTML5 control that allows an user to modify a Sketch2D. For an interactive demonstration please see: Interactive Control Demos.

Introduced in Version: 1.0.0

1 Example:

function CreateSketcher() {
	//Downloads the Creative Platform UI Toolkit using the runtime
	creativePlatformRuntime.require(
		//List of libraries that we're interested in
		[{id: "aZS9YbvfqUX", version: 0}],

		//Callback when successful
		function(library) {
			var controls = library.Controls;
			var params = {
					'id':'sketchControl',
					'parent': '2dsketch', // or $('#2dsketch'),
					'width': 250, 
					'height': 250, 
					'css': 'sketchControl'
				};
			var sketch2d = new controls.Sketch2D(params);
		},

		//Callback when failed
		function() {
			alert('Failed to load uitoolkit');
		}
	);
}

Class Member Summary

Class Member Details

• Controls.Sketch2D (params) | Constructor

The following parameters can be specified in the constructor:

EventSource beginchange

Event will be fired when user start modifying sketch.

Controls.Sketch2D bind (sketch)

Bind a Sketch2D control to specific dom element.
  • sketch: Object - A DOM or jQuery object to which you want to bind this Sketch2D object.

EventSource change

Event will be fired when sketch changes.

EventSource endchange

Event will be fired after sketch change.

• remove()

Removes the control's underlying DOM and marks it for removal

• resize (size)

Resize sketch control. Client can call this method to dynamically resize sketch control based on parent sizing.
  • size: Number - Width & height will be set to size.

Boolean snap | Default: false

Enable/Disable snapping

Sketch2D value

Get/Set an underlying Sketch2D object from which control is drawn.