mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
some work on supporting firefox event habbits...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
93dbd67da9
commit
05fa1d376c
@ -61,8 +61,9 @@ function(context, cls, data){
|
|||||||
// make container...
|
// make container...
|
||||||
var controls = $('<div>')
|
var controls = $('<div>')
|
||||||
.addClass('buttons '+ cls.join('.'))
|
.addClass('buttons '+ cls.join('.'))
|
||||||
.on('mouseover', function(){
|
.on('mouseover', function(evt){
|
||||||
var t = $(event.target)
|
evt = window.event || evt
|
||||||
|
var t = $(evt.target)
|
||||||
|
|
||||||
var info = t.attr('info') || t.parents('[info]').attr('info') || ''
|
var info = t.attr('info') || t.parents('[info]').attr('info') || ''
|
||||||
|
|
||||||
@ -1931,6 +1932,7 @@ module.ContextActionMenu = core.ImageGridFeatures.Feature({
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
handlers: [
|
handlers: [
|
||||||
|
// XXX FireFox: get actual event...
|
||||||
['imageMenu.pre',
|
['imageMenu.pre',
|
||||||
function(gid){
|
function(gid){
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
@ -1940,6 +1942,7 @@ module.ContextActionMenu = core.ImageGridFeatures.Feature({
|
|||||||
.focusImage(gid)
|
.focusImage(gid)
|
||||||
.browseActions('/Image/')
|
.browseActions('/Image/')
|
||||||
}],
|
}],
|
||||||
|
// XXX FireFox: get actual event...
|
||||||
['imageOuterBlockMenu.pre',
|
['imageOuterBlockMenu.pre',
|
||||||
function(gid){
|
function(gid){
|
||||||
// only show image menu in ribbon mode...
|
// only show image menu in ribbon mode...
|
||||||
@ -1966,9 +1969,10 @@ module.ContextActionMenu = core.ImageGridFeatures.Feature({
|
|||||||
!viewer.data('context-menu')
|
!viewer.data('context-menu')
|
||||||
&& viewer
|
&& viewer
|
||||||
.data('context-menu', true)
|
.data('context-menu', true)
|
||||||
.on('contextmenu', function(){
|
.on('contextmenu', function(evt){
|
||||||
event.preventDefault()
|
evt = window.event || evt
|
||||||
event.stopPropagation()
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
|
|
||||||
that.browseActions()
|
that.browseActions()
|
||||||
})
|
})
|
||||||
|
|||||||
@ -927,15 +927,16 @@ module.Cursor = core.ImageGridFeatures.Feature({
|
|||||||
var handler
|
var handler
|
||||||
= this.__cursor_show_handler
|
= this.__cursor_show_handler
|
||||||
= (this.__cursor_show_handler
|
= (this.__cursor_show_handler
|
||||||
|| function(){
|
|| function(evt){
|
||||||
|
evt = window.event || evt
|
||||||
var threshold = that.config['cursor-show-threshold'] || 0
|
var threshold = that.config['cursor-show-threshold'] || 0
|
||||||
x = x || event.clientX
|
x = x || evt.clientX
|
||||||
y = y || event.clientY
|
y = y || evt.clientY
|
||||||
|
|
||||||
// show only if cursor moved outside of threshold...
|
// show only if cursor moved outside of threshold...
|
||||||
if(threshold > 0){
|
if(threshold > 0){
|
||||||
if(Math.max(Math.abs(x - event.clientX),
|
if(Math.max(Math.abs(x - evt.clientX),
|
||||||
Math.abs(y - event.clientY)) > threshold){
|
Math.abs(y - evt.clientY)) > threshold){
|
||||||
x = y = null
|
x = y = null
|
||||||
that.toggleHiddenCursor('off')
|
that.toggleHiddenCursor('off')
|
||||||
}
|
}
|
||||||
@ -1418,13 +1419,14 @@ var ControlActions = actions.Actions({
|
|||||||
&& (y >= dh && y <= H-dh)
|
&& (y >= dh && y <= H-dh)
|
||||||
}
|
}
|
||||||
var makeImageHandler = function(outerBlockEvt, blockEvt, imageEvt, focus){
|
var makeImageHandler = function(outerBlockEvt, blockEvt, imageEvt, focus){
|
||||||
return function(){
|
return function(evt){
|
||||||
var img = img || $(event.target)
|
evt = window.event || evt
|
||||||
|
var img = img || $(evt.target)
|
||||||
var gid = that.ribbons.elemGID(img)
|
var gid = that.ribbons.elemGID(img)
|
||||||
var x = event.offsetX
|
var x = evt.offsetX
|
||||||
var y = event.offsetY
|
var y = evt.offsetY
|
||||||
|
|
||||||
var clicked_image = isImageClicked(event, img)
|
var clicked_image = isImageClicked(evt, img)
|
||||||
|
|
||||||
var inner = function(){
|
var inner = function(){
|
||||||
focus ?
|
focus ?
|
||||||
@ -1863,8 +1865,9 @@ var ControlActions = actions.Actions({
|
|||||||
})
|
})
|
||||||
|
|
||||||
// horizontal scroll...
|
// horizontal scroll...
|
||||||
r.on('wheel', function(){
|
r.on('wheel', function(evt){
|
||||||
event.preventDefault()
|
evt = window.event || evt
|
||||||
|
evt.preventDefault()
|
||||||
|
|
||||||
var s = that.config['mouse-wheel-scale'] || 1
|
var s = that.config['mouse-wheel-scale'] || 1
|
||||||
var vmin = Math.min(document.body.offsetWidth, document.body.offsetHeight)
|
var vmin = Math.min(document.body.offsetWidth, document.body.offsetHeight)
|
||||||
@ -1889,7 +1892,7 @@ var ControlActions = actions.Actions({
|
|||||||
|
|
||||||
// do the actual move...
|
// do the actual move...
|
||||||
r.transform({
|
r.transform({
|
||||||
x: ((left - (event.deltaX * s)) / vmin * 100) + 'vmin',
|
x: ((left - (evt.deltaX * s)) / vmin * 100) + 'vmin',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -233,7 +233,7 @@ function parseActionCall(txt, context){
|
|||||||
var event2key =
|
var event2key =
|
||||||
module.event2key =
|
module.event2key =
|
||||||
function event2key(evt){
|
function event2key(evt){
|
||||||
evt = evt || event
|
evt = evt || window.event
|
||||||
// NOTE: we do not care about the jQuery wrapper here...
|
// NOTE: we do not care about the jQuery wrapper here...
|
||||||
evt = evt.originalEvent || evt
|
evt = evt.originalEvent || evt
|
||||||
|
|
||||||
@ -1159,7 +1159,7 @@ function makeKeyboardHandler(keyboard, unhandled, actions){
|
|||||||
return function(key, no_match){
|
return function(key, no_match){
|
||||||
no_match = no_match || unhandled
|
no_match = no_match || unhandled
|
||||||
var did_handling = false
|
var did_handling = false
|
||||||
var evt = event
|
var evt = window.event
|
||||||
var res
|
var res
|
||||||
|
|
||||||
//if(key instanceof Event || key instanceof $.Event){
|
//if(key instanceof Event || key instanceof $.Event){
|
||||||
|
|||||||
@ -516,13 +516,14 @@ if(typeof(jQuery) != typeof(undefined)){
|
|||||||
.attr('tabindex', '0')
|
.attr('tabindex', '0')
|
||||||
.addClass('editable-field')
|
.addClass('editable-field')
|
||||||
.keydown(events.keydown = function(evt){
|
.keydown(events.keydown = function(evt){
|
||||||
|
evt = window.event || evt
|
||||||
if(!that.prop('contenteditable')){
|
if(!that.prop('contenteditable')){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
event.stopPropagation()
|
evt.stopPropagation()
|
||||||
|
|
||||||
var n = keyboard.code2key(event.keyCode)
|
var n = keyboard.code2key(evt.keyCode)
|
||||||
|
|
||||||
// abort...
|
// abort...
|
||||||
if((options.abort_keys || ['Esc']).indexOf(n) >= 0){
|
if((options.abort_keys || ['Esc']).indexOf(n) >= 0){
|
||||||
@ -531,15 +532,15 @@ if(typeof(jQuery) != typeof(undefined)){
|
|||||||
// done -- single line...
|
// done -- single line...
|
||||||
} else if(n == 'Enter'
|
} else if(n == 'Enter'
|
||||||
&& !options.multiline){
|
&& !options.multiline){
|
||||||
event.preventDefault()
|
evt.preventDefault()
|
||||||
|
|
||||||
that.trigger('edit-commit', that.text())
|
that.trigger('edit-commit', that.text())
|
||||||
|
|
||||||
// done -- multi-line...
|
// done -- multi-line...
|
||||||
} else if(n == 'Enter'
|
} else if(n == 'Enter'
|
||||||
&& (event.ctrlKey || event.metaKey)
|
&& (evt.ctrlKey || evt.metaKey)
|
||||||
&& options.multiline){
|
&& options.multiline){
|
||||||
event.preventDefault()
|
evt.preventDefault()
|
||||||
|
|
||||||
that.trigger('edit-commit', that.text())
|
that.trigger('edit-commit', that.text())
|
||||||
|
|
||||||
|
|||||||
@ -19,21 +19,25 @@ var OverlayClassPrototype = {
|
|||||||
var that = this
|
var that = this
|
||||||
var overlay = $('<div>')
|
var overlay = $('<div>')
|
||||||
.addClass('overlay-widget modal-widget')
|
.addClass('overlay-widget modal-widget')
|
||||||
.on(options.nonPropagatedEvents.join(' '), function(){
|
.on(options.nonPropagatedEvents.join(' '), function(evt){
|
||||||
event.stopPropagation()
|
evt = window.event || evt
|
||||||
|
evt.stopPropagation()
|
||||||
})
|
})
|
||||||
.on('contextmenu', function(){
|
.on('contextmenu', function(evt){
|
||||||
event.preventDefault()
|
evt = window.event || evt
|
||||||
event.stopPropagation()
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
})
|
})
|
||||||
.append($('<div>')
|
.append($('<div>')
|
||||||
.addClass('content')
|
.addClass('content')
|
||||||
.click(function(){
|
.click(function(evt){
|
||||||
event.stopPropagation()
|
evt = window.event || evt
|
||||||
|
evt.stopPropagation()
|
||||||
})
|
})
|
||||||
.on('contextmenu', function(){
|
.on('contextmenu', function(evt){
|
||||||
event.preventDefault()
|
evt = window.event || evt
|
||||||
event.stopPropagation()
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
})
|
})
|
||||||
.append(client))
|
.append(client))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user