diff --git a/src/browser/js/app/callbacks.js b/src/browser/js/app/callbacks.js index d7f8aa64..c2ffec38 100644 --- a/src/browser/js/app/callbacks.js +++ b/src/browser/js/app/callbacks.js @@ -26,7 +26,7 @@ var callbacks = module.exports = { var lobby = $(`
- ${PACKAGE.productName} + ${window.PACKAGE.productName}
@@ -46,12 +46,12 @@ var callbacks = module.exports = { path = path.substr(0,Math.floor((path.length)/2)-(length-max)/2) + '...' + path.substr(Math.ceil((path.length)/2)+(length-max)/2, path.length) } - if (!READ_ONLY) { + if (!window.READ_ONLY) { } list.append(` ${file} (${path}) - ${READ_ONLY? '' : ''+icon('remove')+''} + ${window.READ_ONLY? '' : ''+icon('remove')+''} `) @@ -132,7 +132,7 @@ var callbacks = module.exports = { document.body.appendChild(style) window.GRIDWIDTH = getComputedStyle(document.documentElement).getPropertyValue("--grid-width") if (css.indexOf('--pixel-scale') != -1) { - PXSCALE_RESET() + window.PXSCALE_RESET() } }, @@ -144,11 +144,11 @@ var callbacks = module.exports = { setTimeout(()=>{ $('canvas').trigger('resize',[0,0,true]) },100) - GRIDWIDTH = getComputedStyle(document.documentElement).getPropertyValue("--grid-width") - PXSCALE_RESET() + window.GRIDWIDTH = getComputedStyle(document.documentElement).getPropertyValue("--grid-width") + window.PXSCALE_RESET() }, readOnly: function(){ - READ_ONLY = true + window.READ_ONLY = true } } diff --git a/src/browser/js/app/widgets/containers/modal.js b/src/browser/js/app/widgets/containers/modal.js index f1239000..0ac7d5f8 100644 --- a/src/browser/js/app/widgets/containers/modal.js +++ b/src/browser/js/app/widgets/containers/modal.js @@ -1,8 +1,9 @@ var Panel = require('./panel'), - _widgets_base = require('../common/_widgets_base') + _widgets_base = require('../common/_widgets_base'), + {icon} = require('../../utils') -module.exports = class Modal extends Panel { +module.exports = class Modal extends _widgets_base { static defaults() { @@ -20,6 +21,11 @@ module.exports = class Modal extends Panel { color:'auto', css:'', + _layout:'popup', + + popupWidth:'100%', + popupHeight:'100%', + _layout:'layout', layout:'', @@ -39,21 +45,41 @@ module.exports = class Modal extends Panel { constructor(options) { - super(options) + var html = ` + ` - this.widget.removeClass('noscroll') + super({...options, html:html}) + + this.panel = new Panel({props:{...Panel.defaults(), ...options.props}, container: options.container, parent:options.parent}) + this.panel.widget.appendTo(this.widget.find('.popup-content')) + + this.widget.hide() + + // convert dimensions / coordinates to rem + var width = parseFloat(this.getProp('popupWidth'))==this.getProp('popupWidth')?parseFloat(this.getProp('popupWidth'))+'rem' : this.getProp('popupWidth'), + height = parseFloat(this.getProp('popupHeight'))==this.getProp('popupHeight')?parseFloat(this.getProp('popupHeight'))+'rem' : this.getProp('popupHeight') + + this.widget[0].style.setProperty('--width', width) + this.widget[0].style.setProperty('--height', height) + + this.widget.find('.closer').on('fake-click',(e)=>{ + this.setValue(false) + }) this.light = $('
').appendTo(this.container) - - this.modal = this.widget.detach() - - this.value = false - - this.light.on('fake-click',()=>{ + this.light.on('fake-click',(e)=>{ + if (e.type != 'fake-right-click') this.setValue(!this.value) }) this.parentScroll = [0,0] + this.value = false + this.init = false } @@ -61,11 +87,15 @@ module.exports = class Modal extends Panel { this.value = v ? true : false - this.fixScrolling() + if (!this.init) { + this.widget.find('.popup-title .popup-label').html(this.container.find('> .label span').html()) + this.init = true + } + this.widget.toggle(this.value) this.container.toggleClass('on', this.value) - this.widget.toggleClass('on', this.value) - this.light.toggleClass('on', this.value) + + this.fixScrolling() if (this.value) $(window).resize() diff --git a/src/browser/scss/style.scss b/src/browser/scss/style.scss index 987c3c7a..1e9f8b16 100644 --- a/src/browser/scss/style.scss +++ b/src/browser/scss/style.scss @@ -400,7 +400,7 @@ i { .popup-title { position: relative; padding:15rem; - background:var(--color-raised); + background:var(--color-light-fg); border-bottom: 1rem solid var(--color-bg); box-shadow: 0 1rem 0 0 var(--color-light) inset; @@ -420,7 +420,6 @@ i { display: flex; flex-direction: column; align-items: stretch; - background:var(--color-fg); width:auto; max-width:600rem; margin:0 auto; @@ -433,6 +432,7 @@ i { padding:10rem; overflow-y:auto; white-space: normal; + background:var(--color-fg); } } } diff --git a/src/browser/scss/widgets/_panel.scss b/src/browser/scss/widgets/_panel.scss index 527ba33f..ffc8b8c3 100644 --- a/src/browser/scss/widgets/_panel.scss +++ b/src/browser/scss/widgets/_panel.scss @@ -93,71 +93,39 @@ > .label { top:0; } - - > .panel { - display: none!important; - background: var(--color-fg); - transform: translateZ(0); - cursor: default; - &.on { - transform: translateZ(0); - display: block!important; - &.has-tabs { - display: flex!important; + > .popup { + > .popup-wrapper { + max-width: 100%; + max-height: 100%; + width: var(--width, 100%); + height: var(--height, 100%); + .popup-content { + padding:0; + background: transparent; + > .panel { + background-color: var(--color-fg); + position: relative; + width: 100%; + height:100%; + top:-1rem; + left:-1rem; + } } - position: absolute; - top:var(--nav-height); - left:0; - right:0; - bottom:0; - border-right:0; - height: auto!important; - border-top:1rem solid var(--color-bg); - box-shadow: 0 1rem 0 0 var(--color-bg) inset; } } - + &.editing .popup-wrapper:after { + content:""; + z-index: 999; + position: absolute; + top:0; + left:0; + right:0; + bottom:0; + border:1rem dashed var(--color-accent); + pointer-events: none; + } &.on { - position: fixed; - top:0!important; - left:0!important; - right:0!important; - bottom:0!important; - width: auto!important; - height: auto!important; - border:0; z-index: 99999; - > .light, > .label { - min-height:auto!important; - height:var(--nav-height)!important; - flex:0; - } - > .light { - position: relative; - box-shadow: none; - box-shadow: 0 2rem 0 0 var(--color-bg); - z-index: 1; - } - > .light:after { - content:"\f00d"; - transform: none; - width:calc(var(--nav-height)); - height:var(--nav-height); - line-height: var(--nav-height); - background:var(--color-fg); - padding:0; - opacity: 1; - position: relative; - top: 0; - left: auto; - right: 0; - bottom: 0; - // border-right: 1rem solid var(--color-bg); - box-shadow: -1rem 0 0 0 var(--color-bg), 0 1rem 0 0 var(--color-light) inset; - } - > .light:before { - transition:all .2s; - } } }