MDL-48062 atto_image: Add image select on single click

This commit is contained in:
Daniel Thies
2014-12-18 18:26:28 -06:00
parent 981f06fad5
commit eb8b2425a6
4 changed files with 30 additions and 24 deletions
@@ -214,7 +214,8 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi
tags: 'img',
tagMatchRequiresAll: false
});
this.editor.delegate('dblclick', this._handleDoubleClick, 'img', this);
this.editor.delegate('dblclick', this._displayDialogue, 'img', this);
this.editor.delegate('click', this._handleClick, 'img', this);
this.editor.on('drop', this._handleDragDrop, this);
},
@@ -330,21 +331,22 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi
}
return false;
},
},
/**
* Handle a double click on an image.
* Handle a click on an image.
*
* @method _handleDoubleClick
* @method _handleClick
* @param {EventFacade} e
* @private
*/
_handleDoubleClick: function(e) {
_handleClick: function(e) {
var image = e.target;
var selection = this.get('host').getSelectionFromNode(image);
this.get('host').setSelection(selection);
this._displayDialogue();
if (this.get('host').getSelection() !== selection) {
this.get('host').setSelection(selection);
}
},
/**
File diff suppressed because one or more lines are too long
@@ -214,7 +214,8 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi
tags: 'img',
tagMatchRequiresAll: false
});
this.editor.delegate('dblclick', this._handleDoubleClick, 'img', this);
this.editor.delegate('dblclick', this._displayDialogue, 'img', this);
this.editor.delegate('click', this._handleClick, 'img', this);
this.editor.on('drop', this._handleDragDrop, this);
},
@@ -330,21 +331,22 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi
}
return false;
},
},
/**
* Handle a double click on an image.
* Handle a click on an image.
*
* @method _handleDoubleClick
* @method _handleClick
* @param {EventFacade} e
* @private
*/
_handleDoubleClick: function(e) {
_handleClick: function(e) {
var image = e.target;
var selection = this.get('host').getSelectionFromNode(image);
this.get('host').setSelection(selection);
this._displayDialogue();
if (this.get('host').getSelection() !== selection) {
this.get('host').setSelection(selection);
}
},
/**
+9 -7
View File
@@ -212,7 +212,8 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi
tags: 'img',
tagMatchRequiresAll: false
});
this.editor.delegate('dblclick', this._handleDoubleClick, 'img', this);
this.editor.delegate('dblclick', this._displayDialogue, 'img', this);
this.editor.delegate('click', this._handleClick, 'img', this);
this.editor.on('drop', this._handleDragDrop, this);
},
@@ -328,21 +329,22 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi
}
return false;
},
},
/**
* Handle a double click on an image.
* Handle a click on an image.
*
* @method _handleDoubleClick
* @method _handleClick
* @param {EventFacade} e
* @private
*/
_handleDoubleClick: function(e) {
_handleClick: function(e) {
var image = e.target;
var selection = this.get('host').getSelectionFromNode(image);
this.get('host').setSelection(selection);
this._displayDialogue();
if (this.get('host').getSelection() !== selection) {
this.get('host').setSelection(selection);
}
},
/**