error handling, launcher ui, read-only mode, rm plot/smooth
This commit is contained in:
parent
b215c41c5b
commit
eadd2f5b7f
59 changed files with 1299 additions and 781 deletions
|
|
@ -13,7 +13,7 @@ var multiSelectKey = (navigator.platform || '').match('Mac') ? 'metaKey' : 'ctrl
|
|||
|
||||
var handleClick = function(event) {
|
||||
|
||||
if (!EDITING) return
|
||||
if (!editor.enabled) return
|
||||
|
||||
if (!event.detail[multiSelectKey] && event.type !== 'fast-right-click' && (
|
||||
event.target.classList.contains('no-widget-select') ||
|
||||
|
|
@ -171,6 +171,10 @@ var handleClick = function(event) {
|
|||
|
||||
}
|
||||
|
||||
if (actions.length) actions.push({
|
||||
separator: true
|
||||
})
|
||||
|
||||
actions.push({
|
||||
label: icon('plus') + ' ' + locales('editor_addwidget'),
|
||||
action: addActions
|
||||
|
|
@ -195,10 +199,18 @@ var handleClick = function(event) {
|
|||
|
||||
}
|
||||
|
||||
actions.push({
|
||||
label: icon('trash') + ' ' + locales('editor_delete'),
|
||||
action: editor.deleteWidget.bind(editor)
|
||||
})
|
||||
if (parent !== widgetManager) {
|
||||
|
||||
actions.push({
|
||||
separator: true
|
||||
})
|
||||
|
||||
actions.push({
|
||||
label: icon('trash') + ' ' + locales('editor_delete'),
|
||||
action: editor.deleteWidget.bind(editor)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
contextMenu.open(eventData, actions)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ var {updateWidget, incrementWidget} = require('./data-workers'),
|
|||
UiInspector = require('../ui/ui-inspector'),
|
||||
UiTree = require('../ui/ui-tree'),
|
||||
UiDragResize = require('../ui/ui-dragresize'),
|
||||
sidepanel = require('../ui/ui-sidepanel'),
|
||||
{leftUiSidePanel, rightUiSidePanel} = require('../ui/'),
|
||||
ipc = require('../ipc'),
|
||||
html = require('nanohtml'),
|
||||
sessionManager
|
||||
|
|
@ -326,15 +326,14 @@ class Editor {
|
|||
|
||||
if (READ_ONLY) return
|
||||
|
||||
EDITING = true
|
||||
this.enabled = true
|
||||
|
||||
document.body.classList.add('editor-enabled')
|
||||
|
||||
this.widgetTree.updateTree(this.selectedWidgets)
|
||||
|
||||
sidepanel.left.enable()
|
||||
sidepanel.right.enable()
|
||||
leftUiSidePanel.enable()
|
||||
rightUiSidePanel.enable()
|
||||
|
||||
keyboardJS.setContext('editing')
|
||||
|
||||
|
|
@ -347,8 +346,6 @@ class Editor {
|
|||
|
||||
disable() {
|
||||
|
||||
EDITING = false
|
||||
this.enabled = false
|
||||
|
||||
this.unselect()
|
||||
this.selectedWidgets = []
|
||||
|
|
@ -360,13 +357,15 @@ class Editor {
|
|||
this.oscContainer.removeEventListener('mousemove', this.mouveMoveHandler)
|
||||
this.oscContainer.removeEventListener('mouseleave', this.mouveLeaveHandler)
|
||||
|
||||
sidepanel.left.disable()
|
||||
sidepanel.right.disable()
|
||||
leftUiSidePanel.disable()
|
||||
rightUiSidePanel.disable()
|
||||
this.widgetTree.clear()
|
||||
this.inspector.clear()
|
||||
|
||||
this.selectarea.disable()
|
||||
|
||||
this.enabled = false
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -385,6 +384,8 @@ class Editor {
|
|||
|
||||
select(widget, options={}){
|
||||
|
||||
if (!this.enabled) return
|
||||
|
||||
if (Array.isArray(widget)) {
|
||||
|
||||
this.selectedWidgets = widget
|
||||
|
|
|
|||
|
|
@ -19,13 +19,18 @@ function pointerDownHandler(event) {
|
|||
targets[event.pointerId] = event.target
|
||||
|
||||
if (event.traversingStack) {
|
||||
event.traversingStack.firstType = event.target.closest('.drag-event')._drag_widget.getProp('type')
|
||||
var local = event.traversingStack.stack[event.traversingStack.stack.length - 1]
|
||||
|
||||
var widget = event.target.closest('.drag-event')._drag_widget,
|
||||
local = event.traversingStack.stack[event.traversingStack.stack.length - 1]
|
||||
|
||||
if (widget.getProp) event.traversingStack.firstType = widget.getProp('type')
|
||||
|
||||
if (local.mode === TRAVERSING_SAMEWIDGET && local.type && local.type !== event.traversingStack.firstType) {
|
||||
event.traversing = false
|
||||
} else {
|
||||
event.traversing = true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
previousPointers[event.pointerId] = event
|
||||
|
|
@ -156,6 +161,8 @@ function touchMultiWrapper(event) {
|
|||
}
|
||||
|
||||
function touchDownCapture(event, multitouch) {
|
||||
console.log('down')
|
||||
|
||||
event.preventDefault()
|
||||
for (var i in event.changedTouches) {
|
||||
if (isNaN(i) || !event.changedTouches[i]) continue
|
||||
|
|
@ -216,7 +223,6 @@ function triggerWidgetEvent(target, name, event) {
|
|||
// init
|
||||
|
||||
DOM.ready(()=>{
|
||||
|
||||
if (!iOS) document.addEventListener('mousemove', mouseMoveCapture, true)
|
||||
if (!iOS) document.addEventListener('mouseup', mouseUpCapture, true)
|
||||
document.addEventListener('touchmove', touchMoveCapture, true)
|
||||
|
|
|
|||
|
|
@ -3,20 +3,13 @@ location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi, (s,k,v)=>{
|
|||
ARGV[k]=v
|
||||
})
|
||||
|
||||
window.ELECTRON_FULLSCREEN = window.ELECTRON_FULLSCREEN || false
|
||||
|
||||
window.LANG = ARGV.lang === 'debug' ? 'debug' : (ARGV.lang || navigator.language || '').substr(0, 2).toLowerCase()
|
||||
|
||||
window.PACKAGE = require('../../package.json')
|
||||
document.title = PACKAGE.productName + ' v' + PACKAGE.version
|
||||
|
||||
window.LOADING = null
|
||||
|
||||
|
||||
window.CLIPBOARD = null
|
||||
|
||||
window.READ_ONLY = false
|
||||
window.EDITING = false
|
||||
window.GRIDWIDTH = 10
|
||||
|
||||
|
||||
|
|
@ -33,4 +26,4 @@ window.JSON.parseFlex = require('json5').parse
|
|||
|
||||
window.DOM = require('./dom')
|
||||
|
||||
require('cardinal-spline-js/curve.min.js')
|
||||
window.TITLE = PACKAGE.productName + ' v' + PACKAGE.version
|
||||
|
|
|
|||
|
|
@ -2,10 +2,13 @@ require('./stacktrace')
|
|||
require('./globals')
|
||||
|
||||
var uiLoading = require('./ui/ui-loading'),
|
||||
locales = require('./locales')
|
||||
locales = require('./locales'),
|
||||
html = require('nanohtml')
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function(event) {
|
||||
|
||||
DOM.get(document, '#osc-greeting-header')[0].appendChild(html`${PACKAGE.productName} <span class="version">v${PACKAGE.version}</span>`)
|
||||
|
||||
DOM.init()
|
||||
|
||||
LOADING = uiLoading(locales('loading_server'))
|
||||
|
|
@ -18,6 +21,8 @@ document.addEventListener('DOMContentLoaded', function(event) {
|
|||
|
||||
require('./ui/init')
|
||||
|
||||
document.title = TITLE
|
||||
|
||||
ipc.send('ready', {backupId: ARGV.backupId})
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ var utils = require('../ui/utils'),
|
|||
notifications = require('../ui/notifications'),
|
||||
{TRAVERSING_SAMEWIDGET} = require('../events/utils'),
|
||||
raw = require('nanohtml/raw'),
|
||||
ipc = require('./'),
|
||||
windowTitle = document.title
|
||||
ipc = require('./')
|
||||
|
||||
module.exports = {
|
||||
|
||||
|
|
@ -96,8 +95,6 @@ module.exports = {
|
|||
|
||||
readOnly: function(){
|
||||
READ_ONLY = true
|
||||
$('.editor-menu .btn').remove()
|
||||
$('.editor-menu .title').addClass('disabled')
|
||||
if (editor.enabled) editor.disable()
|
||||
},
|
||||
|
||||
|
|
@ -191,7 +188,7 @@ module.exports = {
|
|||
|
||||
setTitle: function(data) {
|
||||
|
||||
document.title = windowTitle + (data ? ' (' + data + ')' : '')
|
||||
document.title = TITLE + (data ? ' (' + data + ')' : '')
|
||||
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ var SessionManager = class SessionManager {
|
|||
parentNode: DOM.get('#osc-container')[0]
|
||||
})
|
||||
editor.clearHistory()
|
||||
DOM.get(document, '#osc-greeting-header')[0].classList.add('hidden')
|
||||
|
||||
} catch (err) {
|
||||
loader.close()
|
||||
|
|
|
|||
8
src/client/ui/index.js
Normal file
8
src/client/ui/index.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
var UiSidePanel = require('./ui-sidepanel'),
|
||||
locales = require('../locales')
|
||||
|
||||
|
||||
module.exports = {
|
||||
leftUiSidePanel: new UiSidePanel({selector: 'osc-panel-container.left', label: locales('editor_tree')}),
|
||||
rightUiSidePanel: new UiSidePanel({selector: 'osc-panel-container.right', label: locales('editor_inspector')})
|
||||
}
|
||||
|
|
@ -4,13 +4,23 @@ var iOS
|
|||
|
||||
if (navigator.platform.match(/iPhone|iPod|iPad/)) {
|
||||
|
||||
var supportsPassiveOption = false;
|
||||
try {
|
||||
document.createElement("div").addEventListener("test", function() {}, {
|
||||
get passive() {
|
||||
supportsPassiveOption = true
|
||||
return false
|
||||
}
|
||||
})
|
||||
} catch(e) {}
|
||||
|
||||
iOS = true
|
||||
|
||||
var preventNextMove = false
|
||||
|
||||
document.addEventListener('touchstart', (e)=>{
|
||||
if (e.touches.length === 1 && !e.target._drag_widget) preventNextMove = true
|
||||
}, false)
|
||||
}, supportsPassiveOption ? {passive: false} : false)
|
||||
|
||||
document.addEventListener('touchmove', (e)=>{
|
||||
// preventDefault the first overscrolling touchmove
|
||||
|
|
@ -18,7 +28,7 @@ if (navigator.platform.match(/iPhone|iPod|iPad/)) {
|
|||
preventNextMove = false
|
||||
e.preventDefault()
|
||||
}
|
||||
}, false)
|
||||
}, supportsPassiveOption ? {passive: false} : false)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class UiDragResize extends UiWidget {
|
|||
this.on('draginit', (event)=>{
|
||||
|
||||
var node = event.firstTarget
|
||||
if (event.shiftKey || !this.handles.includes(node)) return
|
||||
if (event.shiftKey || !this.handles.includes(node)) return
|
||||
|
||||
this.initLeft = this.left
|
||||
this.initTop = this.top
|
||||
|
|
@ -51,7 +51,8 @@ class UiDragResize extends UiWidget {
|
|||
|
||||
this.container.classList.add('dragging')
|
||||
this.dragging = node.getAttribute('data-action').split(',')
|
||||
event.traversing = false
|
||||
delete event.traversingStack
|
||||
delete event.traversing
|
||||
|
||||
}, {element: this.container})
|
||||
|
||||
|
|
|
|||
|
|
@ -116,14 +116,6 @@ class UiInspector extends UiWidget {
|
|||
|
||||
this.widget = widget
|
||||
|
||||
// this.form.appendChild(html`
|
||||
// <div class="separator">
|
||||
// <span class="${this.selectedWidgets.length > 1 ? 'accent' : ''}">
|
||||
// Widget${multi ? 's' : ''}: ${multi ? this.selectedWidgets.length + ' selected': widget.getProp('id')}
|
||||
// </span>
|
||||
// </div>
|
||||
// `)
|
||||
|
||||
let category
|
||||
|
||||
for (let propName in props) {
|
||||
|
|
@ -147,7 +139,7 @@ class UiInspector extends UiWidget {
|
|||
|
||||
category = html`<osc-inspector-category class="${this.foldedCategories.indexOf(props[propName]) > -1 ? 'folded' : ''}"></osc-inspector-category>`
|
||||
|
||||
field = html`<div class="category-header" data-name="${props[propName]}">${props[propName]}</div>`
|
||||
field = html`<div class="category-header" data-name="${props[propName]}">${props[propName]}${propName === '_widget' && widgets.length > 1 ? `s (${widgets.length})` : ''}</div>`
|
||||
|
||||
} else if (widget.props[propName] === undefined) {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
var UiWidget = require('./ui-widget'),
|
||||
locales = require('../locales')
|
||||
var UiWidget = require('./ui-widget')
|
||||
|
||||
class UiSidePanel extends UiWidget {
|
||||
|
||||
|
|
@ -7,14 +6,16 @@ class UiSidePanel extends UiWidget {
|
|||
|
||||
super(options)
|
||||
|
||||
DOM.get(this.container, 'osc-panel-header')[0].textContent = options.label
|
||||
if (options.label) DOM.get(this.container, 'osc-panel-header')[0].textContent = options.label
|
||||
|
||||
this.vertical = this.container.classList.contains('bottom') || this.container.classList.contains('tpop')
|
||||
this.resizeDirection = this.container.classList.contains('left') ? 1 : -1
|
||||
this.resizeHandle = DOM.get(this.container, '.resize-handle')[0]
|
||||
this.toggleButton = DOM.get(this.container, '.toggle-button')[0]
|
||||
this.content = DOM.get(this.container, 'osc-panel-inner')[0]
|
||||
this.content = DOM.get(this.container, 'osc-panel-content')[0]
|
||||
|
||||
this.minWidth = 250
|
||||
this.width = 250
|
||||
this.minWidth = options.size || 250
|
||||
this.width = options.size || 250
|
||||
|
||||
this.disabled = false
|
||||
this.minimized = false
|
||||
|
|
@ -22,14 +23,14 @@ class UiSidePanel extends UiWidget {
|
|||
|
||||
this.on('drag', (event)=>{
|
||||
|
||||
this.width += this.resizeDirection * event.movementX / PXSCALE
|
||||
this.container.style.width = this.width + 'rem'
|
||||
this.width += this.resizeDirection * event[this.vertical ? 'movementY' : 'movementX'] / PXSCALE
|
||||
this.container.style[this.vertical ? 'height' : 'width'] = this.width + 'rem'
|
||||
|
||||
}, {element: this.resizeHandle})
|
||||
|
||||
this.on('dragend', (event)=>{
|
||||
|
||||
this.width = parseInt(this.container.offsetWidth) / PXSCALE
|
||||
this.width = parseInt(this.container[this.vertical ? 'offsetHeight' : 'offsetWidth']) / PXSCALE
|
||||
DOM.dispatchEvent(window, 'resize')
|
||||
|
||||
}, {element: this.resizeHandle})
|
||||
|
|
@ -89,8 +90,8 @@ class UiSidePanel extends UiWidget {
|
|||
|
||||
open() {
|
||||
|
||||
this.container.style.width = this.width + 'rem'
|
||||
this.container.style.minWidth = this.minWidth + 'rem'
|
||||
this.container.style[this.vertical ? 'height' : 'width'] = this.width + 'rem'
|
||||
this.container.style[this.vertical ? 'minHeight' : 'minWidth'] = this.minWidth + 'rem'
|
||||
this.container.classList.remove('minimized')
|
||||
|
||||
DOM.dispatchEvent(window, 'resize')
|
||||
|
|
@ -99,8 +100,8 @@ class UiSidePanel extends UiWidget {
|
|||
|
||||
close() {
|
||||
|
||||
this.container.style.width = 0
|
||||
this.container.style.minWidth = 0
|
||||
this.container.style[this.vertical ? 'height' : 'width'] = 0
|
||||
this.container.style[this.vertical ? 'minHeight' : 'minWidth'] = 0
|
||||
this.container.classList.add('minimized')
|
||||
|
||||
DOM.dispatchEvent(window, 'resize')
|
||||
|
|
@ -109,10 +110,6 @@ class UiSidePanel extends UiWidget {
|
|||
|
||||
}
|
||||
|
||||
var leftUiSidePanel = new UiSidePanel({selector: 'osc-panel-container.left', label: locales('editor_tree')}),
|
||||
rightUiSidePanel = new UiSidePanel({selector: 'osc-panel-container.right', label: locales('editor_inspector')})
|
||||
|
||||
module.exports = {
|
||||
left: leftUiSidePanel,
|
||||
right: rightUiSidePanel
|
||||
}
|
||||
|
||||
module.exports = UiSidePanel
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ var UiWidget = require('./ui-widget'),
|
|||
editor = require('../editor'),
|
||||
sessionManager = require('../managers/session'),
|
||||
stateManager = require('../managers/state'),
|
||||
uiSidePanel = require('./ui-sidepanel')
|
||||
{leftUiSidePanel, rightUiSidePanel} = require('../ui/')
|
||||
|
||||
|
||||
var recentSessions = []
|
||||
|
|
@ -22,7 +22,8 @@ var menuEntries = [
|
|||
action: [
|
||||
{
|
||||
label: locales('session_new'),
|
||||
action: sessionManager.create.bind(sessionManager)
|
||||
action: sessionManager.create.bind(sessionManager),
|
||||
class: ()=>{return READ_ONLY ? 'disabled' :''}
|
||||
},
|
||||
{
|
||||
separator: true
|
||||
|
|
@ -30,7 +31,8 @@ var menuEntries = [
|
|||
{
|
||||
label: locales('file_open'),
|
||||
action: sessionManager.browse.bind(sessionManager),
|
||||
shortcut: 'mod + o'
|
||||
shortcut: 'mod + o',
|
||||
class: ()=>{return READ_ONLY ? 'disabled' :''}
|
||||
},
|
||||
{
|
||||
label: locales('file_open_recent'),
|
||||
|
|
@ -42,23 +44,27 @@ var menuEntries = [
|
|||
{
|
||||
label: locales('file_save'),
|
||||
action: sessionManager.save.bind(sessionManager),
|
||||
shortcut: 'mod + s'
|
||||
shortcut: 'mod + s',
|
||||
class: ()=>{return READ_ONLY ? 'disabled' :''}
|
||||
},
|
||||
{
|
||||
label: locales('file_save_as'),
|
||||
action: sessionManager.saveAs.bind(sessionManager),
|
||||
shortcut: 'mod + shift + s'
|
||||
shortcut: 'mod + shift + s',
|
||||
class: ()=>{return READ_ONLY ? 'disabled' :''}
|
||||
},
|
||||
{
|
||||
separator: true
|
||||
},
|
||||
{
|
||||
label: locales('file_import'),
|
||||
action: sessionManager.import.bind(sessionManager)
|
||||
action: sessionManager.import.bind(sessionManager),
|
||||
class: ()=>{return READ_ONLY ? 'disabled' :''}
|
||||
},
|
||||
{
|
||||
label: locales('file_export'),
|
||||
action: sessionManager.export.bind(sessionManager)
|
||||
action: sessionManager.export.bind(sessionManager),
|
||||
class: ()=>{return READ_ONLY ? 'disabled' :''}
|
||||
},
|
||||
|
||||
]
|
||||
|
|
@ -91,32 +97,37 @@ var menuEntries = [
|
|||
},
|
||||
{
|
||||
label: locales('file_open'),
|
||||
action: stateManager.browse.bind(stateManager)
|
||||
action: stateManager.browse.bind(stateManager),
|
||||
class: ()=>{return READ_ONLY ? 'disabled' :''}
|
||||
},
|
||||
{
|
||||
label: locales('file_save'),
|
||||
action: stateManager.save.bind(stateManager)
|
||||
action: stateManager.save.bind(stateManager),
|
||||
class: ()=>{return READ_ONLY ? 'disabled' :''}
|
||||
},
|
||||
{
|
||||
label: locales('file_save_as'),
|
||||
action: stateManager.saveAs.bind(stateManager)
|
||||
action: stateManager.saveAs.bind(stateManager),
|
||||
class: ()=>{return READ_ONLY ? 'disabled' :''}
|
||||
},
|
||||
{
|
||||
separator: true
|
||||
},
|
||||
{
|
||||
label: locales('file_import'),
|
||||
action: stateManager.import.bind(stateManager)
|
||||
action: stateManager.import.bind(stateManager),
|
||||
class: ()=>{return READ_ONLY ? 'disabled' :''}
|
||||
},
|
||||
{
|
||||
label: locales('file_export'),
|
||||
action: stateManager.export.bind(stateManager)
|
||||
action: stateManager.export.bind(stateManager),
|
||||
class: ()=>{return READ_ONLY ? 'disabled' :''}
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
label: locales('editor'),
|
||||
class: ()=>{return sessionManager.session === null ? 'disabled' : ''},
|
||||
class: ()=>{return sessionManager.session === null || READ_ONLY ? 'disabled' : ''},
|
||||
action: [
|
||||
{
|
||||
label: locales('editor_enabled'),
|
||||
|
|
@ -139,16 +150,16 @@ var menuEntries = [
|
|||
},
|
||||
{
|
||||
label: locales('editor_tree'),
|
||||
class: ()=>{return 'toggle ' + (uiSidePanel.left.minimized ? 'off' : 'on')},
|
||||
action: ()=>{return uiSidePanel.left.minimized ? uiSidePanel.left.restore() : uiSidePanel.left.minimize()},
|
||||
class: ()=>{return 'toggle ' + (leftUiSidePanel.minimized ? 'off' : 'on')},
|
||||
action: ()=>{return leftUiSidePanel.minimized ? leftUiSidePanel.restore() : leftUiSidePanel.minimize()},
|
||||
// shortcut: 'mod + t'
|
||||
|
||||
|
||||
},
|
||||
{
|
||||
label: locales('editor_inspector'),
|
||||
class: ()=>{return 'toggle ' + (uiSidePanel.right.minimized ? 'off' : 'on')},
|
||||
action: ()=>{return uiSidePanel.right.minimized ? uiSidePanel.right.restore() : uiSidePanel.right.minimize()},
|
||||
class: ()=>{return 'toggle ' + (rightUiSidePanel.minimized ? 'off' : 'on')},
|
||||
action: ()=>{return rightUiSidePanel.minimized ? rightUiSidePanel.restore() : rightUiSidePanel.minimize()},
|
||||
// shortcut: 'mod + i'
|
||||
}
|
||||
]
|
||||
|
|
@ -163,7 +174,7 @@ var menuEntries = [
|
|||
if (fullscreen.isEnabled) fullscreen.toggle()
|
||||
},
|
||||
shortcut: 'f11'
|
||||
},
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,3 @@
|
|||
var popupSingleton = null,
|
||||
uploadSingleton = null,
|
||||
locales = require('../locales'),
|
||||
html = require('nanohtml'),
|
||||
raw = require('nanohtml/raw'),
|
||||
ipc = require('../ipc'),
|
||||
EventEmitter = require('../events/event-emitter'),
|
||||
doubleTap = require('../widgets/mixins/double_tap')
|
||||
|
||||
module.exports = {
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class Menu extends Widget {
|
|||
layout: {type: 'string', value: 'circular', choices: ['circular', 'horizontal', 'vertical', 'grid'], help: [
|
||||
'Defines whether the menu\'s layout should be rendered in a circle or in a box'
|
||||
]},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
toggle: {type: 'boolean', value: false, help: 'Set to `true` to make the menu stay opened after mouse/touch release'},
|
||||
doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the menu require a double tap to be opened instead of a single tap'},
|
||||
values: {type: 'array|object', value: [1, 2, 3], help: [
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class Switch extends Widget {
|
|||
_switch:'switch',
|
||||
|
||||
layout: {type: 'string', value: 'vertical', choices: ['vertical', 'horizontal', 'grid'], help:''},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
showValues: {type: 'boolean', value: false, help: 'If values is an object, set to `true` to display both values and labels instead of labels only'},
|
||||
values: {type: 'array|object', value: {'Value 1':1,'Value 2':2}, help: [
|
||||
'`Array` of possible values to switch between : `[1,2,3]`',
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class Toggle extends Widget {
|
|||
if (this.getProp('led')) this.container.classList.add('led')
|
||||
|
||||
var tap = this.getProp('mode') === 'tap',
|
||||
push = this.getProp('mode') === 'push' || tap
|
||||
push = this.getProp('mode') === 'push' || tap
|
||||
|
||||
if (push) {
|
||||
|
||||
|
|
@ -58,6 +58,8 @@ class Toggle extends Widget {
|
|||
this.active = true
|
||||
this.setValue(this.getProp('on'), {sync: true, send: true})
|
||||
|
||||
if (tap) this.container.classList.add('active')
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class Matrix extends StaticProperties(Panel, {scroll: false}) {
|
|||
|
||||
widgetType: {type: 'string', value: 'toggle', help: 'Defines the type of the widgets in the matrix'},
|
||||
layout: {type: 'string', value: 'horizontal', choices: ['horizontal', 'vertical', 'grid'], help:''},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
quantity: {type: 'number', value: 4, help: 'Defines the number of widgets in the matrix'},
|
||||
start: {type: 'integer', value: 0, help: 'First widget\'s index'},
|
||||
traversing: {type: 'boolean', value: true, help: 'Set to `false` to disable traversing gestures'},
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class Modal extends Panel {
|
|||
popupTop: {type: 'number|percentage', value: 'auto', help: 'Modal popup\'s position'},
|
||||
colorPanel: {type: 'string', value: 'auto', help:''},
|
||||
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:''},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
traversing: {type: 'boolean', value: false, help: 'Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget'},
|
||||
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
|
||||
variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ class Panel extends Container() {
|
|||
|
||||
colorPanel: {type: 'string', value: 'auto', help:''},
|
||||
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:''},
|
||||
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
verticalTabs: {type: 'boolean', value: false, help: 'Set to `true` to display for vertical tab layout'},
|
||||
traversing: {type: 'boolean', value: false, help: 'Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget'},
|
||||
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
|
||||
|
|
@ -63,7 +63,7 @@ class Panel extends Container() {
|
|||
} else if (layout === 'vertical' || layout === 'horizontal'){
|
||||
|
||||
var justify = this.getProp('justify')
|
||||
if (justify === 'start' || justify === 'end') justify = 'flex-' + justify
|
||||
if (justify === 'start' || justify === 'end') justify = 'flex-' + justify
|
||||
this.widget.style.justifyContent = justify
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ class Root extends StaticProperties(Panel, {scroll: false, label: false, id: 'ro
|
|||
|
||||
colorPanel: {type: 'string', value: 'auto', help:''},
|
||||
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:''},
|
||||
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
verticalTabs: {type: 'boolean', value: false, help: 'Set to `true` to display for vertical tab layout'},
|
||||
traversing: {type: 'boolean', value: false, help: 'Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget'},
|
||||
variables: {type: '*', value: '', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
|
||||
|
|
@ -58,13 +58,6 @@ class Root extends StaticProperties(Panel, {scroll: false, label: false, id: 'ro
|
|||
DOM.each(this.widget, '> .navigation', (el)=>{
|
||||
el.classList.add('main')
|
||||
})
|
||||
this.trigger('root-nav-changed')
|
||||
|
||||
}
|
||||
|
||||
createNavigation() {
|
||||
|
||||
super.createNavigation()
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,15 +18,15 @@ module.exports = class Tab extends Panel {
|
|||
|
||||
// detached: {type: 'boolean', value: true, help: 'Set to `false` if the tab contains `frame` widgets that should not be reloaded when the tab opens'},
|
||||
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:''},
|
||||
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
verticalTabs: {type: 'boolean', value: false, help: 'Set to `true` to display for vertical tab layout'},
|
||||
traversing: {type: 'boolean', value: false, help: 'Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget'},
|
||||
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
|
||||
variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
|
||||
|
||||
}, [
|
||||
'_geometry', 'left', 'top', 'width', 'height',
|
||||
'_geometry', 'left', 'top', 'width', 'height', 'expand',
|
||||
'colorStroke', 'alphaStroke', 'alphaFillOff', 'alphaFillOn'
|
||||
], {
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ module.exports = class Eq extends StaticProperties(Plot, {rangeX: {min: 20, max:
|
|||
rangeY: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis'},
|
||||
origin: {type: 'number|boolean', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it'},
|
||||
logScaleX: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm\'s base.'},
|
||||
smooth: {type: 'boolean|number', value: false, help: 'Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`)'},
|
||||
|
||||
}, ['interaction', 'decimals', 'typeTags', 'bypass'], {
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ module.exports = class Plot extends StaticProperties(Canvas, {bypass: true, inte
|
|||
origin: {type: 'number', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it.'},
|
||||
dots: {type: 'boolean', value: true, help: ''},
|
||||
bars: {type: 'boolean', value: false, help: 'Set to `true` to use draw bars instead (disables `logScaleX` and forces `x axis` even spacing)'},
|
||||
smooth: {type: 'boolean|number', value: false, help: 'Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`)'},
|
||||
pips:{type: 'boolean', value: true, help: 'Set to `false` to hide the scale'},
|
||||
|
||||
}, ['interaction', 'decimals', 'typeTags', 'bypass'], {
|
||||
|
|
@ -141,18 +140,11 @@ module.exports = class Plot extends StaticProperties(Canvas, {bypass: true, inte
|
|||
|
||||
this.ctx.beginPath()
|
||||
|
||||
if (this.getProp('smooth')) {
|
||||
this.ctx.curve(points, this.smooth, Math.round(this.width/(points.length/2 - 1)))
|
||||
} else {
|
||||
this.ctx.moveTo(points[0], points[1])
|
||||
let i
|
||||
for (i = 2; i < points.length - 2; i += 2) {
|
||||
this.ctx.lineTo(points[i], points[i + 1])
|
||||
}
|
||||
this.ctx.moveTo(points[0], points[1])
|
||||
for (let i = 2; i < points.length - 2; i += 2) {
|
||||
this.ctx.lineTo(points[i], points[i + 1])
|
||||
}
|
||||
|
||||
|
||||
this.ctx.lineTo(points[i], points[i + 1])
|
||||
|
||||
this.ctx.globalAlpha = 1
|
||||
this.ctx.lineWidth = 2 * PXSCALE
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ module.exports = class Keyboard extends Panel {
|
|||
|
||||
super(options)
|
||||
|
||||
this.childrenType = undefined
|
||||
this.value = []
|
||||
|
||||
this.on('change',(e)=>{
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ class CanvasWidget extends Canvas {
|
|||
|
||||
setValue(v, options={}) {
|
||||
|
||||
if (v === null || v === undefined || ((v.length || 1) !== this.getProp('valueLength'))) return
|
||||
if (v === null || v === undefined || ((v.length || 1) !== this.getProp('valueLength'))) return
|
||||
|
||||
this.value = v
|
||||
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ class HueFader extends Fader {
|
|||
this.clear()
|
||||
|
||||
|
||||
this.ctx.strokeStyle = this.gaugeGradient || this.cssVars.colorFill
|
||||
this.ctx.strokeStyle = this.gaugeGradient || this.cssVars.colorFill
|
||||
|
||||
if (flat) {
|
||||
this.ctx.lineWidth = Math.round(width - this.gaugePadding * 2)
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ module.exports = class Fader extends Slider {
|
|||
}
|
||||
|
||||
|
||||
this.ctx.strokeStyle = this.gaugeGradient || this.cssVars.colorFill
|
||||
this.ctx.strokeStyle = this.gaugeGradient || this.cssVars.colorFill
|
||||
|
||||
if (compact) {
|
||||
this.ctx.lineWidth = Math.round(width - this.gaugePadding * 2)
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ class Range extends Fader {
|
|||
}
|
||||
|
||||
|
||||
this.ctx.strokeStyle = this.gaugeGradient || this.cssVars.colorFill
|
||||
this.ctx.strokeStyle = this.gaugeGradient || this.cssVars.colorFill
|
||||
|
||||
if (compact) {
|
||||
this.ctx.lineWidth = Math.round(width - this.gaugePadding * 2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue