modal, file: add click option
This commit is contained in:
parent
9961fb73b4
commit
b016724d04
2 changed files with 6 additions and 4 deletions
|
|
@ -19,6 +19,7 @@ export default class File extends Widget {
|
|||
align: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Set to `left` or `right` to change text alignment (otherwise center)'},
|
||||
hidePath: {type: 'boolean', value: false, help: 'Set to `true` to only display the filename (the whole path will still be used as value)'},
|
||||
mode: {type: 'string', value: 'open', choices: ['open', 'save'], help: 'File browser mode'},
|
||||
click: {type: 'boolean', value: false, help: 'Set to `true` to activate upon click event instead of tap'},
|
||||
},
|
||||
class_specific: {
|
||||
directory: {type: 'string', value: 'auto', help: 'Default browsing directory'},
|
||||
|
|
@ -50,7 +51,7 @@ export default class File extends Widget {
|
|||
ext = '(' + ext.join('|') + ')'
|
||||
}
|
||||
|
||||
this.on('fast-click', (e)=>{
|
||||
this.on(this.getProp('click') ? 'click' : 'fast-click', (e)=>{
|
||||
|
||||
if (e.capturedByEditor === true) return
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ class Modal extends Panel {
|
|||
|
||||
return super.defaults().extend({
|
||||
class_specific: {
|
||||
doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the modal require a double tap to open instead of a single tap'},
|
||||
doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the modal require a double tap to open instead of a single tap (allows scrolling when touching the modal button)'},
|
||||
click: {type: 'boolean', value: false, help: 'Set to `true` to make the modal open/close upon click event instead of tap (allows scrolling when touching the modal button)'},
|
||||
},
|
||||
geometry: {
|
||||
_separator_modal_geometry: 'Modal geometry',
|
||||
|
|
@ -93,7 +94,7 @@ class Modal extends Panel {
|
|||
|
||||
var closer = DOM.get(this.popup, '.closer')[0]
|
||||
|
||||
this.on('draginit',(e)=>{
|
||||
this.on(this.getProp('click') ? 'click' : 'draginit',(e)=>{
|
||||
if ((e.target === this.popup || e.target === closer) && this.value == 1) {
|
||||
this.setValue(0, {sync:true, send:true})
|
||||
} else if (!this.getProp('doubleTap') && e.target === this.toggle) {
|
||||
|
|
@ -105,7 +106,7 @@ class Modal extends Panel {
|
|||
if (this.getProp('doubleTap')) {
|
||||
doubleTap(this, ()=>{
|
||||
this.setValue(1, {sync:true, send:true})
|
||||
}, {element: this.toggle})
|
||||
}, {element: this.toggle, click: this.getProp('click')})
|
||||
}
|
||||
|
||||
this.escapeKeyHandler = ((e)=>{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue