OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * | 10 * |
(...skipping 29 matching lines...) Expand all Loading... | |
40 | 40 |
41 this.registerRequiredCSS("splitView.css"); | 41 this.registerRequiredCSS("splitView.css"); |
42 | 42 |
43 this.element.addStyleClass("split-view"); | 43 this.element.addStyleClass("split-view"); |
44 this.element.addStyleClass("fill"); | 44 this.element.addStyleClass("fill"); |
45 | 45 |
46 this._firstElement = this.element.createChild("div", "split-view-contents sc roll-target split-view-contents-first"); | 46 this._firstElement = this.element.createChild("div", "split-view-contents sc roll-target split-view-contents-first"); |
47 this._secondElement = this.element.createChild("div", "split-view-contents s croll-target split-view-contents-second"); | 47 this._secondElement = this.element.createChild("div", "split-view-contents s croll-target split-view-contents-second"); |
48 | 48 |
49 this._resizerElement = this.element.createChild("div", "split-view-resizer") ; | 49 this._resizerElement = this.element.createChild("div", "split-view-resizer") ; |
50 this._onDragStartBound = this._onDragStart.bind(this); | |
50 this.installResizer(this._resizerElement); | 51 this.installResizer(this._resizerElement); |
51 this._resizable = true; | 52 this._resizable = true; |
52 | 53 |
53 this._savedSidebarWidth = defaultSidebarWidth || 200; | 54 this._savedSidebarWidth = defaultSidebarWidth || 200; |
54 this._savedSidebarHeight = defaultSidebarHeight || this._savedSidebarWidth; | 55 this._savedSidebarHeight = defaultSidebarHeight || this._savedSidebarWidth; |
55 | 56 |
56 if (0 < this._savedSidebarWidth && this._savedSidebarWidth < 1 && | 57 if (0 < this._savedSidebarWidth && this._savedSidebarWidth < 1 && |
57 0 < this._savedSidebarHeight && this._savedSidebarHeight < 1) | 58 0 < this._savedSidebarHeight && this._savedSidebarHeight < 1) |
58 this._useFraction = true; | 59 this._useFraction = true; |
59 | 60 |
60 this._sidebarSizeSettingName = sidebarSizeSettingName; | 61 this._sidebarSizeSettingName = sidebarSizeSettingName; |
61 | 62 |
62 this.setSecondIsSidebar(true); | 63 this.setSecondIsSidebar(true); |
63 | 64 |
64 this._innerSetVertical(isVertical); | 65 this._innerSetVertical(isVertical); |
65 } | 66 } |
66 | 67 |
68 WebInspector.SplitView.Events = { | |
pfeldman
2013/12/05 15:44:06
rollback
dgozman
2013/12/06 16:17:13
Done.
| |
69 LayoutChanged: "LayoutChanged" | |
70 }; | |
71 | |
67 WebInspector.SplitView.prototype = { | 72 WebInspector.SplitView.prototype = { |
68 /** | 73 /** |
69 * @return {boolean} | 74 * @return {boolean} |
70 */ | 75 */ |
71 isVertical: function() | 76 isVertical: function() |
72 { | 77 { |
73 return this._isVertical; | 78 return this._isVertical; |
74 }, | 79 }, |
75 | 80 |
76 /** | 81 /** |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 this._resizerElement.style.bottom = sizeValue; | 306 this._resizerElement.style.bottom = sizeValue; |
302 this._resizerElement.style.marginBottom = -this._resizerElementS ize / 2 + "px"; | 307 this._resizerElement.style.marginBottom = -this._resizerElementS ize / 2 + "px"; |
303 } else { | 308 } else { |
304 this._resizerElement.style.top = sizeValue; | 309 this._resizerElement.style.top = sizeValue; |
305 this._resizerElement.style.marginTop = -this._resizerElementSize / 2 + "px"; | 310 this._resizerElement.style.marginTop = -this._resizerElementSize / 2 + "px"; |
306 } | 311 } |
307 } | 312 } |
308 | 313 |
309 this._sidebarSize = size; | 314 this._sidebarSize = size; |
310 | 315 |
316 this.dispatchEventToListeners(WebInspector.SplitView.Events.LayoutChange d); | |
317 | |
311 // No need to recalculate this._sidebarSize and this._totalSize again. | 318 // No need to recalculate this._sidebarSize and this._totalSize again. |
312 this._muteOnResize = true; | 319 this._muteOnResize = true; |
313 this.doResize(); | 320 this.doResize(); |
314 delete this._muteOnResize; | 321 delete this._muteOnResize; |
315 }, | 322 }, |
316 | 323 |
317 /** | 324 /** |
318 * @param {number=} minWidth | 325 * @param {number=} minWidth |
319 * @param {number=} minHeight | 326 * @param {number=} minHeight |
320 */ | 327 */ |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
435 } | 442 } |
436 this._saveSidebarSize(); | 443 this._saveSidebarSize(); |
437 this._callOnVisibleChildren(doSaveSidebarSizeRecursively); | 444 this._callOnVisibleChildren(doSaveSidebarSizeRecursively); |
438 }, | 445 }, |
439 | 446 |
440 /** | 447 /** |
441 * @param {Element} resizerElement | 448 * @param {Element} resizerElement |
442 */ | 449 */ |
443 installResizer: function(resizerElement) | 450 installResizer: function(resizerElement) |
444 { | 451 { |
445 resizerElement.addEventListener("mousedown", this._onDragStart.bind(this ), false); | 452 resizerElement.addEventListener("mousedown", this._onDragStartBound, fal se); |
446 }, | 453 }, |
447 | 454 |
448 /** | 455 /** |
456 * @param {Element} resizerElement | |
457 */ | |
458 uninstallResizer: function(resizerElement) | |
459 { | |
460 resizerElement.removeEventListener("mousedown", this._onDragStartBound, false); | |
461 }, | |
462 | |
463 /** | |
449 * @param {Event} event | 464 * @param {Event} event |
450 */ | 465 */ |
451 _onDragStart: function(event) | 466 _onDragStart: function(event) |
452 { | 467 { |
453 WebInspector._elementDragStart(this._startResizerDragging.bind(this), th is._resizerDragging.bind(this), this._endResizerDragging.bind(this), this._isVer tical ? "ew-resize" : "ns-resize", event); | 468 WebInspector._elementDragStart(this._startResizerDragging.bind(this), th is._resizerDragging.bind(this), this._endResizerDragging.bind(this), this._isVer tical ? "ew-resize" : "ns-resize", event); |
454 }, | 469 }, |
455 | 470 |
456 /** | 471 /** |
457 * @return {WebInspector.Setting} | 472 * @return {WebInspector.Setting} |
458 */ | 473 */ |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
496 else | 511 else |
497 this._savedSidebarHeight = size; | 512 this._savedSidebarHeight = size; |
498 | 513 |
499 var sizeSetting = this._sizeSetting(); | 514 var sizeSetting = this._sizeSetting(); |
500 if (sizeSetting) | 515 if (sizeSetting) |
501 sizeSetting.set(size); | 516 sizeSetting.set(size); |
502 }, | 517 }, |
503 | 518 |
504 __proto__: WebInspector.View.prototype | 519 __proto__: WebInspector.View.prototype |
505 } | 520 } |
OLD | NEW |