fixed a verry subtle issure with .config...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-05-11 03:22:39 +03:00
parent 599d572f3a
commit 197fcf3829
6 changed files with 86 additions and 81 deletions

View File

@ -311,7 +311,7 @@ module.makeWorkspaceConfigLoader = function(keys, callback){
keys = typeof(keys) == typeof(function(){}) ? keys() : keys
// load statusbar data...
// load data...
keys.forEach(function(key){
// the key exists...
if(key in workspace){

View File

@ -1830,94 +1830,93 @@ var ControlActions = actions.Actions({
threshold: this.config['ribbon-pan-threshold'],
})
r
.on('pan', function(evt){
//evt.stopPropagation()
r.on('pan', function(evt){
//evt.stopPropagation()
// XXX stop all previous animations...
//r.velocity("stop")
// XXX stop all previous animations...
//r.velocity("stop")
var d = that.ribbons.dom
var s = that.scale
var g = evt.gesture
var d = that.ribbons.dom
var s = that.scale
var g = evt.gesture
var data = r.data('drag-data')
var data = r.data('drag-data')
// we just started...
if(!data){
that.__control_in_progress = (that.__control_in_progress || 0) + 1
// we just started...
if(!data){
that.__control_in_progress = (that.__control_in_progress || 0) + 1
// hide and remove current image indicator...
// NOTE: it will be reconstructed on
// next .focusImage(..)
var m = that.ribbons.viewer
.find('.current-marker')
.velocity({opacity: 0}, {
duration: 100,
complete: function(){
m.remove()
},
})
// hide and remove current image indicator...
// NOTE: it will be reconstructed on
// next .focusImage(..)
var m = that.ribbons.viewer
.find('.current-marker')
.velocity({opacity: 0}, {
duration: 100,
complete: function(){
m.remove()
},
})
// store initial position...
var data = {
left: d.getOffset(this).left,
pointers: g.pointers.length,
}
r.data('drag-data', data)
// store initial position...
var data = {
left: d.getOffset(this).left,
pointers: g.pointers.length,
}
r.data('drag-data', data)
}
// do the actual move...
d.setOffset(this, data.left + (g.deltaX / s))
// do the actual move...
d.setOffset(this, data.left + (g.deltaX / s))
// update ribbon when "pulling" with two fingers...
if(g.pointers.length != data.pointers){
data.pointers = g.pointers.length
// update ribbon when "pulling" with two fingers...
if(g.pointers.length != data.pointers){
data.pointers = g.pointers.length
// load stuff if needed...
that.updateRibbon(that.ribbons.getImageByPosition('center', r))
}
// load stuff if needed...
that.updateRibbon(that.ribbons.getImageByPosition('center', r))
}
// when done...
if(g.isFinal){
r.removeData('drag-data')
// when done...
if(g.isFinal){
r.removeData('drag-data')
// XXX this seems to have trouble with off-screen images...
var central = that.ribbons.getImageByPosition('center', r)
// XXX this seems to have trouble with off-screen images...
var central = that.ribbons.getImageByPosition('center', r)
// load stuff if needed...
that.updateRibbon(central)
// load stuff if needed...
that.updateRibbon(central)
// XXX add inertia....
/* XXX
console.log('!!!!', g.velocityX)
r.velocity({
translateX: (data.left + g.deltaX + (g.velocityX * 10)) +'px'
}, 'easeInSine')
*/
// silently focus central image...
if(that.config['focus-central-image'] == 'silent'){
var gid = that.ribbons.getElemGID(central)
// XXX is this the right way to do this???
that.data.focusImage(gid)
that.ribbons.focusImage(gid)
// XXX add inertia....
/* XXX
console.log('!!!!', g.velocityX)
r.velocity({
translateX: (data.left + g.deltaX + (g.velocityX * 10)) +'px'
}, 'easeInSine')
*/
// silently focus central image...
if(that.config['focus-central-image'] == 'silent'){
var gid = that.ribbons.getElemGID(central)
// XXX is this the right way to do this???
that.data.focusImage(gid)
that.ribbons.focusImage(gid)
// focus central image in a normal manner...
} else if(that.config['focus-central-image']){
that.focusImage(that.ribbons.getElemGID(central))
}
setTimeout(function(){
that.__control_in_progress -= 1
if(that.__control_in_progress <= 0){
delete that.__control_in_progress
}
}, 50)
// focus central image in a normal manner...
} else if(that.config['focus-central-image']){
that.focusImage(that.ribbons.getElemGID(central))
}
})
setTimeout(function(){
that.__control_in_progress -= 1
if(that.__control_in_progress <= 0){
delete that.__control_in_progress
}
}, 50)
}
})
}
}

View File

@ -233,9 +233,11 @@ body {
</style>
<script>
window.__devtools_failsafe = setTimeout(function(){
typeof(require) != 'undefined' && nw.Window.get().showDevTools()
}, 1000)
if(window.require && window.nw){
window.__devtools_failsafe = setTimeout(function(){
nw.Window.get().showDevTools()
}, 1000)
}
</script>

View File

@ -102,19 +102,19 @@ module.FeatureProto = {
}
// merge config...
// XXX should this use inheritance???
// XXX do we need to clone .config?
// NOTE: this will merge the actual config in .config.__proto__
// keeping the .config clean for the user to lay with...
if(this.config != null
|| (this.actions != null
&& this.actions.config != null)){
var config = this.config = this.config || this.actions.config
if(actions.config == null){
actions.config = {}
actions.config = Object.create({})
}
Object.keys(config).forEach(function(n){
// NOTE: this will overwrite existing values...
actions.config[n] = config[n]
actions.config.__proto__[n] = config[n]
})
}

View File

@ -340,6 +340,10 @@ function CSSClassToggler(elem, classes, callback_a, callback_b){
: classes_set
classes = typeof(classes) == typeof('str') ? ['none', classes] : classes
if(classes == null){
console.log('!!!!!!')
}
// remove the dot from class names...
// NOTE: this is here because I've made the error of including a
// leading "." almost every time I use this after I forget

View File

@ -13,7 +13,7 @@
"toolbar": false,
"show": false
},
"chromium-args": "",
"chromium-args": "--disable-gpu-compositing",
"dependencies": {
"app-module-path": "^1.0.6",
"commander": "^2.9.0",