mirror of
https://github.com/awatertrevi/xamarin-neo4j.git
synced 2026-09-22 09:05:29 +00:00
GraphPage: hide double-tap hint after first user interaction
Hint overlay is dismissed on first pan/zoom/click via iframe app://interaction signal from the vis.js event handler. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,25 @@
|
||||
Title="Graph"
|
||||
x:Class="Xamarin.Neo4j.Pages.GraphPage">
|
||||
<ContentPage.Content>
|
||||
<WebView x:Name="webView" Source="{Binding Source}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" />
|
||||
<Grid>
|
||||
<WebView x:Name="webView" Source="{Binding Source}"
|
||||
HorizontalOptions="FillAndExpand"
|
||||
VerticalOptions="FillAndExpand" />
|
||||
|
||||
<!-- Double-tap hint — hidden after first interaction -->
|
||||
<Border x:Name="hintBorder"
|
||||
VerticalOptions="End"
|
||||
HorizontalOptions="Center"
|
||||
Margin="16,0,16,16"
|
||||
BackgroundColor="#CC000000"
|
||||
StrokeThickness="0"
|
||||
StrokeShape="RoundRectangle 12"
|
||||
Padding="12,8">
|
||||
<Label Text="Double-tap a node to expand its relationships"
|
||||
TextColor="White"
|
||||
FontSize="13"
|
||||
HorizontalTextAlignment="Center" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
|
||||
@@ -33,6 +33,13 @@ namespace Xamarin.Neo4j.Pages
|
||||
{
|
||||
Console.WriteLine($"[Graph] Navigating: {e.Url}");
|
||||
|
||||
if (e.Url.Contains("interaction"))
|
||||
{
|
||||
e.Cancel = true;
|
||||
hintBorder.IsVisible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!e.Url.Contains("expand") || !e.Url.Contains("nodeId")) return;
|
||||
|
||||
e.Cancel = true;
|
||||
|
||||
@@ -440,6 +440,16 @@
|
||||
|
||||
// ---- interaction handling (touch + mouse/pointer) ----
|
||||
var ptrStartX, ptrStartY, ptrEndX, ptrEndY, ptrStartTime, dragging = null, panning = false, mouseDown = false;
|
||||
var interacted = false;
|
||||
function notifyInteraction() {
|
||||
if (interacted) return;
|
||||
interacted = true;
|
||||
var f = document.createElement('iframe');
|
||||
f.style.display = 'none';
|
||||
f.src = 'app://interaction';
|
||||
document.body.appendChild(f);
|
||||
setTimeout(function () { document.body.removeChild(f); }, 200);
|
||||
}
|
||||
|
||||
function edgeAt(sx, sy) {
|
||||
var w = toWorld(sx, sy);
|
||||
@@ -477,6 +487,7 @@
|
||||
|
||||
function handleStart(e) {
|
||||
if (e.touches) e.preventDefault();
|
||||
notifyInteraction();
|
||||
var p = coordFromEvent(e);
|
||||
ptrStartX = ptrEndX = p.x;
|
||||
ptrStartY = ptrEndY = p.y;
|
||||
|
||||
Reference in New Issue
Block a user