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