@ -47,6 +47,7 @@ define([
var $colors = $ ( '#colors' ) ;
var $colors = $ ( '#colors' ) ;
var $cursors = $ ( '#cursors' ) ;
var $cursors = $ ( '#cursors' ) ;
var $toggle = $ ( '#toggleDraw' ) ;
var $width = $ ( '#width' ) ;
var $width = $ ( '#width' ) ;
var $widthLabel = $ ( 'label[for="width"]' ) ;
var $widthLabel = $ ( 'label[for="width"]' ) ;
@ -82,6 +83,11 @@ define([
//context.stroke();
//context.stroke();
var img = ccanvas . toDataURL ( "image/png" ) ;
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' ;
canvas . freeDrawingCursor = 'url(' + img + ') ' + size / 2 + ' ' + size / 2 + ', crosshair' ;
} ;
} ;
@ -143,12 +149,20 @@ define([
setColor ( color ) ;
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 ) {
var setEditable = function ( bool ) {
if ( readOnly && bool ) { return ; }
if ( readOnly && bool ) { return ; }
if ( bool ) { $controls . show ( ) ; }
if ( bool ) { $controls . show ( ) ; }
else { $controls . hide ( ) ; }
else { $controls . hide ( ) ; }
canvas . isDrawingMode = bool ;
canvas . isDrawingMode = bool ? module . draw : false ;
if ( ! bool ) {
if ( ! bool ) {
canvas . deactivateAll ( ) ;
canvas . deactivateAll ( ) ;
canvas . renderAll ( ) ;
canvas . renderAll ( ) ;