Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kayak UI 0.11
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
Bevy Forks
Kayak UI 0.11
Commits
ad3f0112
Commit
ad3f0112
authored
3 years ago
by
MrGVSV
Browse files
Options
Downloads
Patches
Plain Diff
Added default prevention
parent
1706aa56
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kayak_core/src/event.rs
+14
-0
14 additions, 0 deletions
kayak_core/src/event.rs
with
14 additions
and
0 deletions
kayak_core/src/event.rs
+
14
−
0
View file @
ad3f0112
...
...
@@ -10,6 +10,8 @@ pub struct Event {
pub
event_type
:
EventType
,
/// Indicates whether this event should propagate or not
pub
(
crate
)
should_propagate
:
bool
,
/// Indicates whether the default action of this event (if any) has been prevented
pub
(
crate
)
default_prevented
:
bool
,
}
impl
Default
for
Event
{
...
...
@@ -19,6 +21,7 @@ impl Default for Event {
current_target
:
Default
::
default
(),
event_type
:
EventType
::
Click
,
should_propagate
:
true
,
default_prevented
:
false
,
}
}
}
...
...
@@ -34,6 +37,7 @@ impl Event {
current_target
:
target
,
event_type
,
should_propagate
:
event_type
.propagates
(),
default_prevented
:
false
,
}
}
...
...
@@ -46,6 +50,16 @@ impl Event {
pub
fn
stop_propagation
(
&
mut
self
)
{
self
.should_propagate
=
false
;
}
/// Returns whether this event's default action has been prevented or not
pub
fn
is_default_prevented
(
&
self
)
->
bool
{
self
.default_prevented
}
/// Prevents this event's default action (if any) from being executed
pub
fn
prevent_default
(
&
mut
self
)
{
self
.default_prevented
=
true
;
}
}
#[derive(Debug,
Clone,
Copy,
PartialEq,
Eq,
Hash)]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment