Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
227
Merge Requests
227
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
f381336d
Commit
f381336d
authored
Oct 22, 2008
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Patch
#323965
by mfer: update farbtastic widgetCoords to use jQuery.
parent
0adaec35
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
48 deletions
+2
-48
misc/farbtastic/farbtastic.js
misc/farbtastic/farbtastic.js
+2
-48
No files found.
misc/farbtastic/farbtastic.js
View file @
f381336d
...
...
@@ -101,54 +101,8 @@ jQuery._farbtastic = function (container, callback) {
* of the widget.
*/
fb
.
widgetCoords
=
function
(
event
)
{
var
x
,
y
;
var
el
=
event
.
target
||
event
.
srcElement
;
var
reference
=
fb
.
wheel
;
// If the offset from the relative element is undefined calculate it.
if
(
typeof
event
.
offsetX
==
'
undefined
'
&&
typeof
event
.
offsetY
==
'
undefined
'
)
{
var
offset
=
$
(
event
.
target
).
offset
(
false
);
event
.
offsetX
=
event
.
pageX
-
offset
.
left
;
event
.
offsetY
=
event
.
pageY
-
offset
.
top
;
}
// Use offset coordinates and find common offsetParent
var
pos
=
{
x
:
event
.
offsetX
,
y
:
event
.
offsetY
};
// Send the coordinates upwards through the offsetParent chain.
var
e
=
el
;
while
(
e
)
{
e
.
mouseX
=
pos
.
x
;
e
.
mouseY
=
pos
.
y
;
pos
.
x
+=
e
.
offsetLeft
;
pos
.
y
+=
e
.
offsetTop
;
e
=
e
.
offsetParent
;
}
// Look for the coordinates starting from the wheel widget.
var
e
=
reference
;
var
offset
=
{
x
:
0
,
y
:
0
};
while
(
e
)
{
if
(
typeof
e
.
mouseX
!=
'
undefined
'
)
{
x
=
e
.
mouseX
-
offset
.
x
;
y
=
e
.
mouseY
-
offset
.
y
;
break
;
}
offset
.
x
+=
e
.
offsetLeft
;
offset
.
y
+=
e
.
offsetTop
;
e
=
e
.
offsetParent
;
}
// Reset stored coordinates
e
=
el
;
while
(
e
)
{
e
.
mouseX
=
undefined
;
e
.
mouseY
=
undefined
;
e
=
e
.
offsetParent
;
}
// Subtract distance to middle
return
{
x
:
x
-
fb
.
width
/
2
,
y
:
y
-
fb
.
width
/
2
};
var
offset
=
$
(
fb
.
wheel
).
offset
();
return
{
x
:
(
event
.
pageX
-
offset
.
left
)
-
fb
.
width
/
2
,
y
:
(
event
.
pageY
-
offset
.
top
)
-
fb
.
width
/
2
};
};
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment