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

Side by Side Diff: third_party/polymer/components/core-splitter/core-splitter.html

Issue 592603004: Revert "Polymer elements added to third_party/polymer." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
(Empty)
1 <!--
2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
3 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
5 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
6 Code distributed by Google as part of the polymer project is also
7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
8 -->
9
10 <!--
11 `core-splitter` provides a split bar and dragging on the split bar
12 will resize the sibling element. Use its `direction` property to indicate
13 which sibling element to be resized and the orientation. Usually you would want
14 to use `core-splitter` along with flex layout so that the other sibling
15 element can be _flexible_.
16
17 Example:
18
19 <div horizontal layout>
20 <div>left</div>
21 <core-splitter direction="left"></core-splitter>
22 <div flex>right</div>
23 </div>
24
25 In the above example, dragging the splitter will resize the _left_ element. And
26 since the parent container is a flexbox and the _right_ element has
27 `flex`, the _right_ element will be auto-resized.
28
29 For horizontal splitter set `direction` to "up" or "down".
30
31 Example:
32
33 <div vertical layout>
34 <div>top</div>
35 <core-splitter direction="up"></core-splitter>
36 <div flex>bottom</div>
37 </div>
38
39 @group Polymer Core Elements
40 @element core-splitter
41 @homepage github.io
42 -->
43
44 <link rel="import" href="../polymer/polymer.html">
45
46 <polymer-element name="core-splitter" attributes="direction locked minSize allow Overflow"
47 on-trackstart="{{trackStart}}" on-track="{{track}}" on-down="{{preventSelect ion}}">
48
49 <template>
50
51 <link rel="stylesheet" href="core-splitter.css">
52
53 </template>
54 <script>
55
56 Polymer('core-splitter', {
57
58 /**
59 * Possible values are "left", "right", "up" and "down".
60 *
61 * @attribute direction
62 * @type string
63 * @default 'left'
64 */
65 direction: 'left',
66
67 /**
68 * Minimum width to which the splitter target can be sized
69 *
70 * @attribute minSize
71 * @type number
72 * @default 0
73 */
74 minSize: 0,
75
76 /**
77 * Locks the split bar so it can't be dragged.
78 *
79 * @attribute locked
80 * @type boolean
81 * @default false
82 */
83 locked: false,
84
85 /**
86 * By default the parent and siblings of the splitter are set to overflow hi dden. This helps
87 * avoid elements bleeding outside the splitter regions. Set this property t o true to allow
88 * these elements to overflow.
89 *
90 * @attribute allowOverflow
91 * @type boolean
92 * @default false
93 */
94 allowOverflow: false,
95
96 ready: function() {
97 this.directionChanged();
98 },
99
100 domReady: function() {
101 if (!this.allowOverflow) {
102 this.parentNode.style.overflow = this.nextElementSibling.style.overflow =
103 this.previousElementSibling.style.overflow = 'hidden';
104 }
105 },
106
107 directionChanged: function() {
108 this.isNext = this.direction === 'right' || this.direction === 'down';
109 this.horizontal = this.direction === 'up' || this.direction === 'down';
110 this.update();
111 },
112
113 update: function() {
114 this.target = this.isNext ? this.nextElementSibling : this.previousElement Sibling;
115 this.dimension = this.horizontal ? 'height' : 'width';
116 this.classList.toggle('horizontal', this.horizontal);
117 },
118
119 targetChanged: function(old) {
120 if (old) {
121 old.style[old.__splitterMinSize] = '';
122 }
123 var min = this.target.__splitterMinSize = this.horizontal ? 'minHeight' : 'minWidth';
124 this.target.style[min] = this.minSize + 'px';
125 },
126
127 trackStart: function() {
128 this.update();
129 this.size = parseInt(getComputedStyle(this.target)[this.dimension]);
130 },
131
132 track: function(e) {
133 if (this.locked) {
134 return;
135 }
136 var d = e[this.horizontal ? 'dy' : 'dx'];
137 this.target.style[this.dimension] =
138 this.size + (this.isNext ? -d : d) + 'px';
139 },
140
141 preventSelection: function(e) {
142 e.preventDefault();
143 }
144 });
145
146 </script>
147 </polymer-element>
OLDNEW
« no previous file with comments | « third_party/polymer/components/core-splitter/core-splitter.css ('k') | third_party/polymer/components/core-splitter/demo.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698