2013-11-30 22:24:56 +04:00
|
|
|
/**********************************************************************
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
|
|
//var DEBUG = DEBUG != null ? DEBUG : true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************/
|
|
|
|
|
|
2013-12-01 05:58:12 +04:00
|
|
|
var toggleEditor = createCSSClassToggler(
|
|
|
|
|
'.viewer',
|
|
|
|
|
'.editor-visible',
|
2013-12-01 05:44:00 +04:00
|
|
|
function(action){
|
|
|
|
|
var ed = $('.panel')
|
|
|
|
|
|
|
|
|
|
if(action == 'on'){
|
|
|
|
|
// create the editor if this is first init...
|
|
|
|
|
if(ed.length == 0){
|
|
|
|
|
$('.viewer')
|
|
|
|
|
.append(makeEditorControls('.current.image')
|
2013-12-02 04:22:57 +04:00
|
|
|
//.draggable('option', 'snap', '.viewer')
|
2013-12-01 07:59:07 +04:00
|
|
|
.css({
|
|
|
|
|
// prevent the editor from moving under
|
|
|
|
|
// the title bar, that will prevent us from
|
|
|
|
|
// ever moving it away or closing it...
|
|
|
|
|
'margin-top': '20px',
|
2013-12-02 04:22:57 +04:00
|
|
|
top: '50px',
|
|
|
|
|
left: '5px',
|
2013-12-01 07:59:07 +04:00
|
|
|
})
|
2013-12-02 06:23:19 +04:00
|
|
|
// XXX add handlers for saving data to images...
|
|
|
|
|
// XXX
|
2013-12-01 05:44:00 +04:00
|
|
|
// make clicks on unfocusable elements remove focus...
|
2013-12-05 03:58:13 +04:00
|
|
|
.on('panelClosing', function(){
|
|
|
|
|
toggleEditor('off')
|
|
|
|
|
})
|
2013-12-01 05:44:00 +04:00
|
|
|
.click(function(){
|
|
|
|
|
if(event.target != $('.panel :focus')[0]){
|
|
|
|
|
$('.panel :focus').blur()
|
|
|
|
|
}
|
|
|
|
|
}))
|
|
|
|
|
// setup the event to update the editor...
|
|
|
|
|
.on('focusingImage', function(){
|
|
|
|
|
if(toggleEditor('?') == 'on'){
|
2013-12-02 06:23:19 +04:00
|
|
|
// XXX save previous settings if changes...
|
|
|
|
|
// XXX
|
2013-12-01 05:44:00 +04:00
|
|
|
reloadControls('.current.image')
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// show the editor...
|
|
|
|
|
} else {
|
|
|
|
|
ed.show()
|
2013-11-30 22:24:56 +04:00
|
|
|
}
|
2013-12-05 03:58:13 +04:00
|
|
|
|
2013-12-01 05:44:00 +04:00
|
|
|
// update the state...
|
|
|
|
|
reloadControls('.current.image')
|
|
|
|
|
|
|
|
|
|
// hide...
|
|
|
|
|
} else {
|
|
|
|
|
ed.hide()
|
|
|
|
|
}
|
|
|
|
|
})
|
2013-11-30 22:24:56 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* vim:set ts=4 sw=4 : */
|