mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
fixed a verry subtle issure with .config...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
599d572f3a
commit
197fcf3829
@ -311,7 +311,7 @@ module.makeWorkspaceConfigLoader = function(keys, callback){
|
|||||||
|
|
||||||
keys = typeof(keys) == typeof(function(){}) ? keys() : keys
|
keys = typeof(keys) == typeof(function(){}) ? keys() : keys
|
||||||
|
|
||||||
// load statusbar data...
|
// load data...
|
||||||
keys.forEach(function(key){
|
keys.forEach(function(key){
|
||||||
// the key exists...
|
// the key exists...
|
||||||
if(key in workspace){
|
if(key in workspace){
|
||||||
|
|||||||
@ -1830,94 +1830,93 @@ var ControlActions = actions.Actions({
|
|||||||
threshold: this.config['ribbon-pan-threshold'],
|
threshold: this.config['ribbon-pan-threshold'],
|
||||||
})
|
})
|
||||||
|
|
||||||
r
|
r.on('pan', function(evt){
|
||||||
.on('pan', function(evt){
|
//evt.stopPropagation()
|
||||||
//evt.stopPropagation()
|
|
||||||
|
|
||||||
// XXX stop all previous animations...
|
// XXX stop all previous animations...
|
||||||
//r.velocity("stop")
|
//r.velocity("stop")
|
||||||
|
|
||||||
var d = that.ribbons.dom
|
var d = that.ribbons.dom
|
||||||
var s = that.scale
|
var s = that.scale
|
||||||
var g = evt.gesture
|
var g = evt.gesture
|
||||||
|
|
||||||
var data = r.data('drag-data')
|
var data = r.data('drag-data')
|
||||||
|
|
||||||
// we just started...
|
// we just started...
|
||||||
if(!data){
|
if(!data){
|
||||||
that.__control_in_progress = (that.__control_in_progress || 0) + 1
|
that.__control_in_progress = (that.__control_in_progress || 0) + 1
|
||||||
|
|
||||||
// hide and remove current image indicator...
|
// hide and remove current image indicator...
|
||||||
// NOTE: it will be reconstructed on
|
// NOTE: it will be reconstructed on
|
||||||
// next .focusImage(..)
|
// next .focusImage(..)
|
||||||
var m = that.ribbons.viewer
|
var m = that.ribbons.viewer
|
||||||
.find('.current-marker')
|
.find('.current-marker')
|
||||||
.velocity({opacity: 0}, {
|
.velocity({opacity: 0}, {
|
||||||
duration: 100,
|
duration: 100,
|
||||||
complete: function(){
|
complete: function(){
|
||||||
m.remove()
|
m.remove()
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
// store initial position...
|
// store initial position...
|
||||||
var data = {
|
var data = {
|
||||||
left: d.getOffset(this).left,
|
left: d.getOffset(this).left,
|
||||||
pointers: g.pointers.length,
|
pointers: g.pointers.length,
|
||||||
}
|
|
||||||
r.data('drag-data', data)
|
|
||||||
}
|
}
|
||||||
|
r.data('drag-data', data)
|
||||||
|
}
|
||||||
|
|
||||||
// do the actual move...
|
// do the actual move...
|
||||||
d.setOffset(this, data.left + (g.deltaX / s))
|
d.setOffset(this, data.left + (g.deltaX / s))
|
||||||
|
|
||||||
|
|
||||||
// update ribbon when "pulling" with two fingers...
|
// update ribbon when "pulling" with two fingers...
|
||||||
if(g.pointers.length != data.pointers){
|
if(g.pointers.length != data.pointers){
|
||||||
data.pointers = g.pointers.length
|
data.pointers = g.pointers.length
|
||||||
|
|
||||||
// load stuff if needed...
|
// load stuff if needed...
|
||||||
that.updateRibbon(that.ribbons.getImageByPosition('center', r))
|
that.updateRibbon(that.ribbons.getImageByPosition('center', r))
|
||||||
}
|
}
|
||||||
|
|
||||||
// when done...
|
// when done...
|
||||||
if(g.isFinal){
|
if(g.isFinal){
|
||||||
r.removeData('drag-data')
|
r.removeData('drag-data')
|
||||||
|
|
||||||
// XXX this seems to have trouble with off-screen images...
|
// XXX this seems to have trouble with off-screen images...
|
||||||
var central = that.ribbons.getImageByPosition('center', r)
|
var central = that.ribbons.getImageByPosition('center', r)
|
||||||
|
|
||||||
// load stuff if needed...
|
// load stuff if needed...
|
||||||
that.updateRibbon(central)
|
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....
|
// focus central image in a normal manner...
|
||||||
/* XXX
|
} else if(that.config['focus-central-image']){
|
||||||
console.log('!!!!', g.velocityX)
|
that.focusImage(that.ribbons.getElemGID(central))
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
setTimeout(function(){
|
||||||
|
that.__control_in_progress -= 1
|
||||||
|
if(that.__control_in_progress <= 0){
|
||||||
|
delete that.__control_in_progress
|
||||||
|
}
|
||||||
|
}, 50)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -233,9 +233,11 @@ body {
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.__devtools_failsafe = setTimeout(function(){
|
if(window.require && window.nw){
|
||||||
typeof(require) != 'undefined' && nw.Window.get().showDevTools()
|
window.__devtools_failsafe = setTimeout(function(){
|
||||||
}, 1000)
|
nw.Window.get().showDevTools()
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -102,19 +102,19 @@ module.FeatureProto = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// merge config...
|
// merge config...
|
||||||
// XXX should this use inheritance???
|
// NOTE: this will merge the actual config in .config.__proto__
|
||||||
// XXX do we need to clone .config?
|
// keeping the .config clean for the user to lay with...
|
||||||
if(this.config != null
|
if(this.config != null
|
||||||
|| (this.actions != null
|
|| (this.actions != null
|
||||||
&& this.actions.config != null)){
|
&& this.actions.config != null)){
|
||||||
var config = this.config = this.config || this.actions.config
|
var config = this.config = this.config || this.actions.config
|
||||||
|
|
||||||
if(actions.config == null){
|
if(actions.config == null){
|
||||||
actions.config = {}
|
actions.config = Object.create({})
|
||||||
}
|
}
|
||||||
Object.keys(config).forEach(function(n){
|
Object.keys(config).forEach(function(n){
|
||||||
// NOTE: this will overwrite existing values...
|
// NOTE: this will overwrite existing values...
|
||||||
actions.config[n] = config[n]
|
actions.config.__proto__[n] = config[n]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -340,6 +340,10 @@ function CSSClassToggler(elem, classes, callback_a, callback_b){
|
|||||||
: classes_set
|
: classes_set
|
||||||
classes = typeof(classes) == typeof('str') ? ['none', classes] : classes
|
classes = typeof(classes) == typeof('str') ? ['none', classes] : classes
|
||||||
|
|
||||||
|
if(classes == null){
|
||||||
|
console.log('!!!!!!')
|
||||||
|
}
|
||||||
|
|
||||||
// remove the dot from class names...
|
// remove the dot from class names...
|
||||||
// NOTE: this is here because I've made the error of including a
|
// NOTE: this is here because I've made the error of including a
|
||||||
// leading "." almost every time I use this after I forget
|
// leading "." almost every time I use this after I forget
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
"toolbar": false,
|
"toolbar": false,
|
||||||
"show": false
|
"show": false
|
||||||
},
|
},
|
||||||
"chromium-args": "",
|
"chromium-args": "--disable-gpu-compositing",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"app-module-path": "^1.0.6",
|
"app-module-path": "^1.0.6",
|
||||||
"commander": "^2.9.0",
|
"commander": "^2.9.0",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user