Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
3bda45a5
Commit
3bda45a5
authored
Dec 12, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small fixes
parent
b7a94aa2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
ChartTooltip.tsx
ui/shared/chart/ChartTooltip.tsx
+12
-3
pointerTracker.tsx
ui/shared/chart/utils/pointerTracker.tsx
+2
-3
No files found.
ui/shared/chart/ChartTooltip.tsx
View file @
3bda45a5
...
@@ -141,7 +141,7 @@ const ChartTooltip = ({ chartId, xScale, yScale, width, height, data, anchorEl,
...
@@ -141,7 +141,7 @@ const ChartTooltip = ({ chartId, xScale, yScale, width, height, data, anchorEl,
const
createPointerTracker
=
React
.
useCallback
((
event
:
PointerEvent
,
isSubsequentCall
?:
boolean
)
=>
{
const
createPointerTracker
=
React
.
useCallback
((
event
:
PointerEvent
,
isSubsequentCall
?:
boolean
)
=>
{
let
isShown
=
false
;
let
isShown
=
false
;
let
isPressed
=
event
.
pointerType
===
'
mouse
'
&&
event
.
type
===
'
pointerdown
'
&&
!
isSubsequentCall
;
let
isPressed
=
event
.
pointerType
===
'
mouse
'
&&
(
event
.
type
===
'
pointerdown
'
||
event
.
type
===
'
pointerenter
'
)
&&
!
isSubsequentCall
;
if
(
isPressed
)
{
if
(
isPressed
)
{
hideContent
();
hideContent
();
...
@@ -181,11 +181,20 @@ const ChartTooltip = ({ chartId, xScale, yScale, width, height, data, anchorEl,
...
@@ -181,11 +181,20 @@ const ChartTooltip = ({ chartId, xScale, yScale, width, height, data, anchorEl,
React
.
useEffect
(()
=>
{
React
.
useEffect
(()
=>
{
const
anchorD3
=
d3
.
select
(
anchorEl
);
const
anchorD3
=
d3
.
select
(
anchorEl
);
let
isMultiTouch
=
false
;
// disabling creation of new tracker in multi touch mode
anchorD3
anchorD3
.
on
(
'
touchmove.tooltip
'
,
(
event
:
PointerEvent
)
=>
event
.
preventDefault
())
// prevent scrolling
.
on
(
'
touchmove.tooltip
'
,
(
event
:
TouchEvent
)
=>
event
.
preventDefault
())
// prevent scrolling
.
on
(
`touchstart.tooltip`
,
(
event
:
TouchEvent
)
=>
{
isMultiTouch
=
event
.
touches
.
length
>
1
;
})
.
on
(
`touchend.tooltip`
,
(
event
:
TouchEvent
)
=>
{
if
(
isMultiTouch
&&
event
.
touches
.
length
===
0
)
{
isMultiTouch
=
false
;
}
})
.
on
(
'
pointerenter.tooltip pointerdown.tooltip
'
,
(
event
:
PointerEvent
)
=>
{
.
on
(
'
pointerenter.tooltip pointerdown.tooltip
'
,
(
event
:
PointerEvent
)
=>
{
createPointerTracker
(
event
);
!
isMultiTouch
&&
createPointerTracker
(
event
);
});
});
return
()
=>
{
return
()
=>
{
...
...
ui/shared/chart/utils/pointerTracker.tsx
View file @
3bda45a5
...
@@ -38,9 +38,8 @@ export function trackPointer(event: PointerEvent, { start, move, out, end }: Poi
...
@@ -38,9 +38,8 @@ export function trackPointer(event: PointerEvent, { start, move, out, end }: Poi
const
target
=
sourceEvent
.
target
as
Element
;
const
target
=
sourceEvent
.
target
as
Element
;
const
touches
=
d3
.
pointers
(
sourceEvent
,
target
);
const
touches
=
d3
.
pointers
(
sourceEvent
,
target
);
if
(
touches
.
length
>
1
)
{
// disable current tracker when entering to multi touch mode
untrack
(
sourceEvent
);
touches
.
length
>
1
&&
untrack
(
sourceEvent
);
}
})
})
.
on
(
`pointerup.
${
id
}
pointercancel.
${
id
}
lostpointercapture.
${
id
}
`
,
(
sourceEvent
:
PointerEvent
)
=>
{
.
on
(
`pointerup.
${
id
}
pointercancel.
${
id
}
lostpointercapture.
${
id
}
`
,
(
sourceEvent
:
PointerEvent
)
=>
{
if
(
sourceEvent
.
pointerId
!==
id
)
{
if
(
sourceEvent
.
pointerId
!==
id
)
{
...
...
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