diff --git a/CHANGELOG.md b/CHANGELOG.md
index bd93515b..6c08fe12 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,14 +5,16 @@
- engine
- electron 0.37.2 (chrome 49)
- ui
- - new style !
+ - new flat ui
- tab system rewritten : inactive tabs are detached from the DOM tree, thus improving performances.
- widget categories in editor's context menu
- features
- logarithmic scaling (log10) support added to knob, fader & xy
- mousewheel support added to knob and fader (ctrlKey for fine control)
- - new widgets : plot, visualizer & meter. Fader built-in feedback meter option
+ - new widgets : plot, visualizer & meter. Fader built-in feedback meter option
- traversing gestures switch in sidepanel
+ - custom color property for all widgets with inheritance (containers)
+ - editor pasting function now smartly increments widget's id and path while keeping label if different from default
- misc
- sync/link event handling improved
- stylesheets cannot be recompiled on the fly anymore (`--c` switch removed)
diff --git a/browser/js/app/editor/data-workers.js b/browser/js/app/editor/data-workers.js
index 99ed0b82..ba7bc3db 100644
--- a/browser/js/app/editor/data-workers.js
+++ b/browser/js/app/editor/data-workers.js
@@ -107,7 +107,58 @@ var updateDom = function(container,data) {
}
+
+var incrementWidget = function(data){
+
+ delete data.linkId
+
+ var id = data.id,
+ label = data.label,
+ path = data.path
+
+ if (id && id==label) {
+ data.label = 'auto'
+ }
+ if (id && path == '/'+id) {
+
+ data.path = 'auto'
+
+ } else if (path){
+
+ while (WIDGETS_ID_BY_PATH[path]) {
+ path = path.replace(/([0-9]*)$/,function(m){
+ var n = parseInt(m)+1
+ n = isNaN(n)?1:n
+ return n
+ })
+ }
+ data.path = path
+
+ }
+
+ if (id) {
+ while (WIDGETS[id]) {
+ id = id.replace(/([0-9]*)$/,function(m){
+ var n = parseInt(m)+1
+ n = isNaN(n)?1:n
+ return n
+ })
+ }
+ data.id = id
+
+ }
+
+
+ for (i in data) {
+ if (typeof data[i] == 'object') data[i] = incrementWidget(data[i])
+ }
+
+ return data
+
+}
+
module.exports = {
updateDom:updateDom,
- getObjectData:getObjectData
+ getObjectData:getObjectData,
+ incrementWidget:incrementWidget
}
diff --git a/browser/js/app/editor/edit-objects.js b/browser/js/app/editor/edit-objects.js
index ced1b16d..09a0280d 100644
--- a/browser/js/app/editor/edit-objects.js
+++ b/browser/js/app/editor/edit-objects.js
@@ -208,9 +208,7 @@ var editObject = function(container, data, refresh){
if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-s')) data.height = Math.max(ui.size.height,30)/PXSCALE
if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-e')) data.width = Math.max(ui.size.width,30)/PXSCALE
updateDom(container,data)
- },
- snap:'.tab.on .widget, .tab.on',
- snapTolerance:5
+ }
})
}
diff --git a/browser/js/app/editor/init.js b/browser/js/app/editor/init.js
index 1400a092..da954643 100644
--- a/browser/js/app/editor/init.js
+++ b/browser/js/app/editor/init.js
@@ -1,6 +1,7 @@
var data = require('./data-workers'),
getObjectData = data.getObjectData,
updateDom = data.updateDom,
+ incrementWidget = data.incrementWidget,
edit = require('./edit-objects'),
editObject = edit.editObject,
editSession = edit.editSession,
@@ -76,22 +77,31 @@ var init = function(){
if (CLIPBOARD!=null) {
actions[' Paste'] = {
- ' New ID':function(){
+ ' ID + 1':function(){
data.widgets = data.widgets || []
- var newData = JSON.parse(JSON.stringify(CLIPBOARD).replace(/\"(id|label|linkId|path)\"\:\"([^\"]*)\"\,?/g,'').replace(/\,\}/g,'\}'))
+ var newData = incrementWidget(JSON.parse(JSON.stringify(CLIPBOARD)))
+
+
if (!target.attr('data-tab')) {
newData.top = e.offsetY
newData.left= e.offsetX
+ } else {
+ delete newData.top
+ delete newData.left
}
+
data.widgets.push(newData)
updateDom(container,data)
},
- ' Same ID':function(){
+ ' Clone':function(){
data.widgets = data.widgets || []
var newData = JSON.parse(JSON.stringify(CLIPBOARD))
if (!target.attr('data-tab')) {
newData.top = e.offsetY
newData.left= e.offsetX
+ } else {
+ delete newData.top
+ delete newData.left
}
data.widgets.push(newData)
updateDom(container,data)