@ -668,6 +668,23 @@ define([
return toinsert ;
} ;
dblclick _to _reset _size = function ( img ) {
/ * *
* Double - click on an image toggles confinement to notebook width
*
* img : jQuery element
* /
img . dblclick ( function ( ) {
// dblclick toggles *raw* size, disabling max-width confinement.
if ( img . hasClass ( 'unconfined' ) ) {
img . removeClass ( 'unconfined' ) ;
} else {
img . addClass ( 'unconfined' ) ;
}
} ) ;
} ;
var set _width _height = function ( img , md , mime ) {
/ * *
* set width and height of an img element from metadata
@ -676,6 +693,9 @@ define([
if ( height !== undefined ) img . attr ( 'height' , height ) ;
var width = _get _metadata _key ( md , 'width' , mime ) ;
if ( width !== undefined ) img . attr ( 'width' , width ) ;
if ( _get _metadata _key ( md , 'unconfined' , mime ) ) {
img . addClass ( 'unconfined' ) ;
}
} ;
var append _png = function ( png , md , element , handle _inserted ) {
@ -689,6 +709,7 @@ define([
}
img [ 0 ] . src = 'data:image/png;base64,' + png ;
set _width _height ( img , md , 'image/png' ) ;
dblclick _to _reset _size ( img ) ;
toinsert . append ( img ) ;
element . append ( toinsert ) ;
return toinsert ;
@ -706,6 +727,7 @@ define([
}
img [ 0 ] . src = 'data:image/jpeg;base64,' + jpeg ;
set _width _height ( img , md , 'image/jpeg' ) ;
dblclick _to _reset _size ( img ) ;
toinsert . append ( img ) ;
element . append ( toinsert ) ;
return toinsert ;