Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
abdullh.alsoleman
Front-End
Commits
22f26be8
Commit
22f26be8
authored
Nov 12, 2015
by
Jason Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the interactive_flex example for the new event handlers
parent
4b03a9ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
8 deletions
+22
-8
interactive_flex.dart
examples/rendering/interactive_flex.dart
+22
-8
No files found.
examples/rendering/interactive_flex.dart
View file @
22f26be8
...
@@ -4,9 +4,13 @@
...
@@ -4,9 +4,13 @@
import
'dart:ui'
as
ui
;
import
'dart:ui'
as
ui
;
import
'dart:math'
as
math
;
import
'dart:math'
as
math
;
import
'dart:typed_data'
;
import
'package:flutter/services.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:mojo/bindings.dart'
as
bindings
;
import
'package:mojo/core.dart'
as
core
;
import
'package:sky_services/pointer/pointer.mojom.dart'
;
import
'lib/solid_color_box.dart'
;
import
'lib/solid_color_box.dart'
;
...
@@ -33,15 +37,24 @@ class RenderImageGrow extends RenderImage {
...
@@ -33,15 +37,24 @@ class RenderImageGrow extends RenderImage {
RenderImageGrow
image
;
RenderImageGrow
image
;
final
Map
<
int
,
Touch
>
touches
=
<
int
,
Touch
>{};
void
handleEvent
(
String
eventType
,
double
timeStamp
)
{
void
handleEvent
(
event
)
{
if
(
eventType
==
"back"
)
if
(
event
is
ui
.
PointerEvent
)
{
if
(
event
.
type
==
'pointermove'
)
image
.
growth
=
math
.
max
(
0.0
,
image
.
growth
+
event
.
x
-
touches
[
event
.
pointer
].
x
);
touches
[
event
.
pointer
]
=
new
Touch
(
event
.
x
,
event
.
y
);
}
if
(
event
.
type
==
"back"
)
{
activity
.
finishCurrentActivity
();
activity
.
finishCurrentActivity
();
}
final
Map
<
int
,
Touch
>
touches
=
<
int
,
Touch
>{};
void
handlePointerPacket
(
ByteData
serializedPacket
)
{
bindings
.
Message
message
=
new
bindings
.
Message
(
serializedPacket
,
<
core
.
MojoHandle
>[]
);
PointerPacket
packet
=
PointerPacket
.
deserialize
(
message
);
for
(
Pointer
pointer
in
packet
.
pointers
)
{
if
(
pointer
.
type
==
PointerType
.
MOVE
)
image
.
growth
=
math
.
max
(
0.0
,
image
.
growth
+
pointer
.
x
-
touches
[
pointer
.
pointer
].
x
);
touches
[
pointer
.
pointer
]
=
new
Touch
(
pointer
.
x
,
pointer
.
y
);
}
}
}
}
...
@@ -102,4 +115,5 @@ Pancetta meatball tongue tenderloin rump tail jowl boudin.""";
...
@@ -102,4 +115,5 @@ Pancetta meatball tongue tenderloin rump tail jowl boudin.""";
updateTaskDescription
(
'Interactive Flex'
,
topColor
);
updateTaskDescription
(
'Interactive Flex'
,
topColor
);
new
FlutterBinding
(
root:
root
);
new
FlutterBinding
(
root:
root
);
ui
.
window
.
onEvent
=
handleEvent
;
ui
.
window
.
onEvent
=
handleEvent
;
ui
.
window
.
onPointerPacket
=
handlePointerPacket
;
}
}
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