added support for optional floating tool bars to scroll frames

pull/29/head
jmoenig 2016-11-28 15:34:58 +01:00
rodzic a9038846b2
commit d28f6db249
1 zmienionych plików z 13 dodań i 1 usunięć

Wyświetl plik

@ -1136,7 +1136,7 @@
/*global window, HTMLCanvasElement, FileReader, Audio, FileList*/
var morphicVersion = '2016-November-25';
var morphicVersion = '2016-November-28';
var modules = {}; // keep track of additional loaded modules
var useBlurredShadows = getBlurredShadowSupport(); // check for Chrome-bug
@ -9677,6 +9677,7 @@ ScrollFrameMorph.prototype.init = function (scroller, size, sliderColor) {
};
this.vBar.isDraggable = false;
this.add(this.vBar);
this.toolBar = null; // optional slot
};
ScrollFrameMorph.prototype.adjustScrollBars = function () {
@ -9729,6 +9730,17 @@ ScrollFrameMorph.prototype.adjustScrollBars = function () {
} else {
this.vBar.hide();
}
this.adjustToolBar();
};
ScrollFrameMorph.prototype.adjustToolBar = function () {
var padding = 3;
if (this.toolBar) {
this.toolBar.setTop(this.top() + padding);
this.toolBar.setRight(
(this.vBar.isVisible ? this.vBar.left() : this.right()) - padding
);
}
};
ScrollFrameMorph.prototype.addContents = function (aMorph) {