@ -47,6 +47,7 @@ define([
var $colors = $ ( '#colors' ) ;
var $cursors = $ ( '#cursors' ) ;
var $toggle = $ ( '#toggleDraw' ) ;
var $width = $ ( '#width' ) ;
var $widthLabel = $ ( 'label[for="width"]' ) ;
@ -82,6 +83,11 @@ define([
//context.stroke();
var img = ccanvas . toDataURL ( "image/png" ) ;
var $img = $ ( '<img>' , {
src : img ,
title : 'Current brush'
} ) ;
$controls . find ( '.selected' ) . html ( '' ) . append ( $img ) ;
canvas . freeDrawingCursor = 'url(' + img + ') ' + size / 2 + ' ' + size / 2 + ', crosshair' ;
} ;
@ -143,12 +149,20 @@ define([
setColor ( color ) ;
} ) ;
module . draw = true ;
var toggleDrawMode = function ( ) {
module . draw = ! module . draw ;
canvas . isDrawingMode = module . draw ;
$toggle . text ( module . draw ? Messages . canvas _disable : Messages . canvas _enable ) ;
} ;
$toggle . click ( toggleDrawMode ) ;
var setEditable = function ( bool ) {
if ( readOnly && bool ) { return ; }
if ( bool ) { $controls . show ( ) ; }
else { $controls . hide ( ) ; }
canvas . isDrawingMode = bool ;
canvas . isDrawingMode = bool ? module . draw : false ;
if ( ! bool ) {
canvas . deactivateAll ( ) ;
canvas . renderAll ( ) ;