@ -8,27 +8,28 @@ var css = csjs`
. containerDraggableModal {
position : absolute ;
z - index : 1000 ;
background - color : $ { styles . appProperties . quaternary _BackgroundColor } ;
background - color : $ { styles . appProperties . light _BackgroundColor } ;
text - align : center ;
width : 500 px ;
height : 500 px ;
border : 2 px solid $ { styles . appProperties . solidBorderBox _BorderColor } ;
border : 1 px solid $ { styles . appProperties . solidBorderBox _BorderColor } ;
}
. headerDraggableModal {
cursor : move ;
z - index : 10 ;
color : $ { styles . appProperties . mainText _Color } ;
background - color : $ { styles . appProperties . quatern ary_BackgroundColor } ;
border - bottom : 2 px solid $ { styles . appProperties . solidBorderBox _BorderColor } ;
background - color : $ { styles . appProperties . prim ary_BackgroundColor } ;
border - bottom : 1 px solid $ { styles . appProperties . solidBorderBox _BorderColor } ;
text - overflow : ellipsis ;
overflow - x : hidden ;
}
. modalActions {
float : right ;
color : $ { styles . appProperties . solidBorderBox _BorderColor } ;
}
. modalAction {
padding - right : 1 px ;
padding - left : 1 px ;
@ -41,6 +42,7 @@ module.exports =
class DraggableContent {
constructor ( closeCb ) {
this . closeCb = closeCb
this . isMaximised = false
}
render ( title , url , content ) {
@ -52,7 +54,7 @@ module.exports =
< div class = $ { css . modalActions } >
< i onclick = $ { ( ) => { this . minimize ( ) } } class = "fa fa-window-minimize ${css.modalAction}" > < / i >
< i onclick = $ { ( ) => { this . maximise ( ) } } class = "fa fa-window-maximize ${css.modalAction}" > < / i >
< i onclick = $ { ( ) => { this . close ( ) } } class = "fa fa-window-close ${css.modalAction}" > < / i >
< i onclick = $ { ( ) => { this . close ( ) } } class = "fa fa-window-close-o ${css.modalAction}" > < / i >
< / d i v >
< / d i v >
< / d i v >
@ -68,6 +70,7 @@ module.exports =
this . el . querySelector ( '.title span' ) . innerHTML = title
}
minimize ( ) {
this . isMaximised = false
this . content . style . display = 'none'
this . el . style . height = 'inherit'
this . el . style . width = '150px'
@ -75,8 +78,12 @@ module.exports =
}
maximise ( ) {
this . content . style . display = 'block'
this . el . style . height = '500px'
this . el . style . width = '500px'
var body = document . querySelector ( 'body' )
this . el . style . height = this . isMaximised ? '500px' : body . offsetHeight + 'px'
this . el . style . width = this . isMaximised ? '500px' : body . offsetWidth + 'px'
this . isMaximised = ! this . isMaximised
this . el . style . top = this . isMaximised ? '0%' : '20%'
this . el . style . left = this . isMaximised ? '0%' : '50%'
this . el . querySelector ( '.title' ) . style . width = 'inherit'
}
close ( ) {
@ -97,6 +104,7 @@ function dragElement (elmnt) {
function dragMouseDown ( e ) {
e = e || window . event
if ( e . button !== 0 ) return
e . preventDefault ( )
// get the mouse cursor position at startup:
pos3 = e . clientX