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

Side by Side Diff: ui/webui/resources/js/cr/ui/splitter.js

Issue 2804543002: [MD Bookmarks] Fix sidebar issues. (Closed)
Patch Set: Created 3 years, 8 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview This implements a splitter element which can be used to resize 6 * @fileoverview This implements a splitter element which can be used to resize
7 * elements in split panes. 7 * elements in split panes.
8 * 8 *
9 * The parent of the splitter should be an hbox (display: -webkit-box) with at 9 * The parent of the splitter should be an hbox (display: -webkit-box) with at
10 * least one previous element sibling. The splitter controls the width of the 10 * least one previous element sibling. The splitter controls the width of the
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 242
243 /** 243 /**
244 * Handles splitter moves. Updates width of the element being resized. 244 * Handles splitter moves. Updates width of the element being resized.
245 * @param {number} deltaX The change of splitter horizontal position. 245 * @param {number} deltaX The change of splitter horizontal position.
246 * @protected 246 * @protected
247 */ 247 */
248 handleSplitterDragMove: function(deltaX) { 248 handleSplitterDragMove: function(deltaX) {
249 var targetElement = this.getResizeTarget_(); 249 var targetElement = this.getResizeTarget_();
250 var newWidth = this.startWidth_ + this.calcDeltaX_(deltaX); 250 var newWidth = this.startWidth_ + this.calcDeltaX_(deltaX);
251 targetElement.style.width = newWidth + 'px'; 251 targetElement.style.width = newWidth + 'px';
252 cr.dispatchSimpleEvent(this, 'dragmove');
252 }, 253 },
253 254
254 /** 255 /**
255 * Handles end of the splitter dragging. This fires a 'resize' event if the 256 * Handles end of the splitter dragging. This fires a 'resize' event if the
256 * size changed. 257 * size changed.
257 * @protected 258 * @protected
258 */ 259 */
259 handleSplitterDragEnd: function() { 260 handleSplitterDragEnd: function() {
260 // Check if the size changed. 261 // Check if the size changed.
261 var targetElement = this.getResizeTarget_(); 262 var targetElement = this.getResizeTarget_();
262 var doc = targetElement.ownerDocument; 263 var doc = targetElement.ownerDocument;
263 var computedWidth = 264 var computedWidth =
264 parseFloat(doc.defaultView.getComputedStyle(targetElement).width); 265 parseFloat(doc.defaultView.getComputedStyle(targetElement).width);
265 if (this.startWidth_ != computedWidth) 266 if (this.startWidth_ != computedWidth)
266 cr.dispatchSimpleEvent(this, 'resize'); 267 cr.dispatchSimpleEvent(this, 'resize');
267 }, 268 },
268 }; 269 };
269 270
270 return {Splitter: Splitter}; 271 return {Splitter: Splitter};
271 }); 272 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698