Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: sky/framework/sky-button/sky-button.sky

Issue 866213004: Switch Sky to pointer events (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: nits Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Copyright 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 --> 5 -->
6 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement" /> 6 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement" />
7 7
8 <sky-element 8 <sky-element
9 name="sky-button" 9 name="sky-button"
10 attributes="highlight:boolean" 10 attributes="highlight:boolean"
11 on-mousedown="handleMouseDown" 11 on-pointerdown="handlePointerDown"
12 on-mouseup="handleMouseUp" 12 on-pointerup="handlePointerUp"
13 on-mouseout="handleMouseOut"> 13 on-pointercancel="handlePointerCancel">
14 <template> 14 <template>
15 <style> 15 <style>
16 :host { 16 :host {
17 display: inline-flex; 17 display: inline-flex;
18 border-radius: 4px; 18 border-radius: 4px;
19 justify-content: center; 19 justify-content: center;
20 align-items: center; 20 align-items: center;
21 border: 1px solid blue; 21 border: 1px solid blue;
22 -webkit-user-select: none; 22 -webkit-user-select: none;
23 margin: 5px; 23 margin: 5px;
24 } 24 }
25 :host([highlight=true]) { 25 :host([highlight=true]) {
26 background-color: orange; 26 background-color: orange;
27 } 27 }
28 </style> 28 </style>
29 <content /> 29 <content />
30 </template> 30 </template>
31 <script> 31 <script>
32 module.exports = class extends SkyElement { 32 module.exports = class extends SkyElement {
33 created() { 33 created() {
34 super.created(); 34 super.created();
35 35
36 this.tabIndex = 0; // Make focusable. 36 this.tabIndex = 0; // Make focusable.
37 } 37 }
38 handleMouseDown() { 38 handlePointerDown() {
39 this.highlight = true; 39 this.highlight = true;
40 } 40 }
41 handleMouseUp() { 41 handlePointerUp() {
42 this.highlight = false; 42 this.highlight = false;
43 } 43 }
44 handleMouseOut() { 44 handlePointerCancel() {
45 this.highlight = false; 45 this.highlight = false;
46 } 46 }
47 }.register(); 47 }.register();
48 </script> 48 </script>
49 </sky-element> 49 </sky-element>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698