From ad2872961e851f1971e3d42f76bb25e384af1cb0 Mon Sep 17 00:00:00 2001 From: bordun Date: Fri, 2 Oct 2020 18:18:55 +0200 Subject: [PATCH] editor: holding `alt` extends the north-west handle to the widget's size to ease dragging image: broken value validation --- CHANGELOG.md | 8 +++++++- resources/docs/docs/user-interface/editor.md | 3 +-- src/client/ui/ui-dragresize.js | 9 +++++++++ src/client/widgets/frames/image.js | 2 +- src/scss/ui/dragresize.scss | 9 +++++++++ 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 162cb09b..18acdc51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,15 @@ ## 1.4.2 +- bug fixes + - image: broken value validation + +- editor + - holding `alt` extends the north-west handle to the widget's size to ease dragging + - widgets - remove `colorBg` for all widgets except containers - - widgets background color is now transparent by default (can be overridden with css) + - widgets background color is now transparent by default (can be overridden with css) ## 1.4.1 diff --git a/resources/docs/docs/user-interface/editor.md b/resources/docs/docs/user-interface/editor.md index 002ed2ad..6a8a1584 100644 --- a/resources/docs/docs/user-interface/editor.md +++ b/resources/docs/docs/user-interface/editor.md @@ -46,11 +46,10 @@ The project tree displays the whole widget structure of the session. Widgets can ## Widget resizing / dragging -Selected widget can be resized using its south, south-east and east handles. It can be dragged with its north-west handle. If the widget's position/size was written in percents, the editor will try to keep using percents. +Selected widget can be resized using its south, south-east and east handles. It can be dragged with its north-west handle (holding ++alt++ extends this handle to the widget's size to ease dragging). If the widget's position/size was written in percents, the editor will try to keep using percents. When the grid is enabled, widget resizing / dragging snaps to a 10 pixel wide grid. - ## Multi-widgets editing Multiple widgets can be edited at once. diff --git a/src/client/ui/ui-dragresize.js b/src/client/ui/ui-dragresize.js index 1d745f03..179f792f 100644 --- a/src/client/ui/ui-dragresize.js +++ b/src/client/ui/ui-dragresize.js @@ -1,4 +1,5 @@ var UiWidget = require('./ui-widget'), + keyboardJS = require('keyboardjs/dist/keyboard.min.js'), html = require('nanohtml'), Tab, Root @@ -101,6 +102,14 @@ class UiDragResize extends UiWidget { // this.handles[0]._ignore_css_transforms = true + keyboardJS.withContext('editing', ()=>{ + keyboardJS.bind('alt', (e)=>{ + this.handles[0].classList.add('full') + }, (e)=>{ + this.handles[0].classList.remove('full') + }) + }) + } clear() { diff --git a/src/client/widgets/frames/image.js b/src/client/widgets/frames/image.js index da396f08..61f46074 100644 --- a/src/client/widgets/frames/image.js +++ b/src/client/widgets/frames/image.js @@ -55,7 +55,7 @@ module.exports = class Image extends StaticProperties(Widget, {bypass: true}) { setValue(v, options={}) { - if (typeof this.value !== 'string') return + if (typeof v !== 'string') return var s = v==null ? '' : '' + v, cache_query = '' diff --git a/src/scss/ui/dragresize.scss b/src/scss/ui/dragresize.scss index ad8d57ca..2c427dc0 100644 --- a/src/scss/ui/dragresize.scss +++ b/src/scss/ui/dragresize.scss @@ -86,6 +86,15 @@ } + &.full { + width: var(--width); + height: var(--height); + top: 0; + left: 0; + opacity: 0.1; + z-index: 1; + margin:0; + } } }