File tree Expand file tree Collapse file tree 8 files changed +28
-5
lines changed Expand file tree Collapse file tree 8 files changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -31,8 +31,11 @@ var frame = require("ui/frame");
3131function getDrawing (args ) {
3232 // get reference to the drawing pad
3333 var pad = frame .topmost ().currentPage .getViewById (" drawingPad" );
34- // then access the 'drawing' property of the signaturepad;
34+ // then access the 'drawing' property (Bitmap on Android) of the signaturepad
3535 var drawingImage = pad .drawing ;
36+
37+ // If you want to clear the signature/drawing...
38+ pad .clearDrawing ();
3639}
3740exports .getDrawing = getDrawing;
3841```
Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ function padLoaded(args) {
2323}
2424exports . padLoaded = padLoaded ;
2525
26-
2726function getDrawing ( args ) {
2827 var pad = frame . topmost ( ) . currentPage . getViewById ( "drawingPad" ) ;
2928 var pic = pad . drawing ;
@@ -33,6 +32,6 @@ exports.getDrawing = getDrawing;
3332
3433function clearDrawing ( args ) {
3534 var pad = frame . topmost ( ) . currentPage . getViewById ( "drawingPad" ) ;
36- pad . clear ( ) ;
35+ pad . clearDrawing ( ) ;
3736}
3837exports . clearDrawing = clearDrawing ;
Original file line number Diff line number Diff line change 1818 penWidth =" 3" />
1919
2020 <Button text =" Get Drawing" tap =" getDrawing" />
21- <!-- < button text="Clear Drawing" tap="clearDrawing" /> -- >
21+ <button text =" Clear Drawing" tap =" clearDrawing" />
2222 </StackLayout >
2323 </ScrollView >
2424</Page >
Original file line number Diff line number Diff line change @@ -44,6 +44,14 @@ var SignaturePad = (function (_super) {
4444 enumerable : true ,
4545 configurable : true
4646 } ) ;
47+ SignaturePad . prototype . clearDrawing = function ( ) {
48+ try {
49+ this . _android . clear ( ) ;
50+ }
51+ catch ( ex ) {
52+ console . log ( "Error clearing the pad: " + ex ) ;
53+ }
54+ } ;
4755 return SignaturePad ;
4856} ) ( common . SignaturePad ) ;
4957exports . SignaturePad = SignaturePad ;
Original file line number Diff line number Diff line change @@ -34,4 +34,12 @@ export class SignaturePad extends common.SignaturePad {
3434 }
3535 }
3636
37+ public clearDrawing ( ) {
38+ try {
39+ this . _android . clear ( ) ;
40+ } catch ( ex ) {
41+ console . log ( "Error clearing the pad: " + ex ) ;
42+ }
43+ }
44+
3745}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ declare module "signaturepad" {
99 /**
1010 * Represents a Signature Pad (drawing pad) component.
1111 */
12- export class Video extends view . View {
12+ export class SignaturePad extends view . View {
1313 public static penColorProperty : dependencyObservable . Property ;
1414 public static penWidthProperty : dependencyObservable . Property ;
1515
@@ -37,6 +37,11 @@ declare module "signaturepad" {
3737 * Gets or set the stroke width attribute
3838 */
3939 penWidth : any ;
40+
41+ /*
42+ * Use this to clear/erase the pad
43+ */
44+ clearDrawing : Function ;
4045 }
4146
4247 /**
You can’t perform that action at this time.
0 commit comments