cursor()

Set the cursor to a new value.

Syntax cursor(value)

Return Type Mouse

Description

Set the cursor to a new value. This can be any value that the CSS property cursor accepts.

Return Value

Mouse. Returns the mouse module itself.

Examples

Example 1

We create a core instance and a rectangle and add it to the canvas. Then we bind handlers to both the mouseenter event and the mouseleave event. In the handlers we set the cursor to "pointer" and "default" which makes it change cursor when hovering the rectangle.

View Example
Code
var canvas = oCanvas.create({
	canvas: "#canvas",
	background: "#ccc"
});

var rectangle = canvas.display.rectangle({
	x: 77,
	y: 74,
	width: 200,
	height: 100,
	fill: "#000"
});

canvas.addChild(rectangle);

rectangle.bind("mouseenter", function () {
	canvas.mouse.cursor("pointer");
}).bind("mouseleave", function () {
	canvas.mouse.cursor("default");
});
Output