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