From 76d07892d1b91b418815e889767454fb5ded69b3 Mon Sep 17 00:00:00 2001 From: Samuel Asensi Date: Tue, 9 Oct 2018 22:05:22 +0200 Subject: [PATCH] Add Item#locked to documentation (#1556) Closes #1436 --- src/item/Item.js | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/item/Item.js b/src/item/Item.js index 75341949..031b0233 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -433,12 +433,39 @@ new function() { // Injection scope for various item event handlers // injection scope above. /** - * Specifies whether the item is locked. + * Specifies whether the item is locked. When set to `true`, item + * interactions with the mouse are disabled. * * @name Item#locked * @type Boolean * @default false - * @ignore + * + * @example {@paperscript} + * var unlockedItem = new Path.Circle({ + * center: view.center - [35, 0], + * radius: 30, + * fillColor: 'springgreen', + * onMouseDown: function() { + * this.fillColor = Color.random(); + * } + * }); + * + * var lockedItem = new Path.Circle({ + * center: view.center + [35, 0], + * radius: 30, + * fillColor: 'crimson', + * locked: true, + * // This event won't be triggered because the item is locked. + * onMouseDown: function() { + * this.fillColor = Color.random(); + * } + * }); + * + * new PointText({ + * content: 'Click on both circles to see which one is locked.', + * point: view.center - [0, 35], + * justification: 'center' + * }); */ /**