kopia lustrzana https://github.com/backface/turtlestitch
shallow permanent shadows for dialog box widgets
rodzic
9ede31923f
commit
fabd10b9e4
|
@ -68,6 +68,7 @@
|
||||||
|
|
||||||
* keyboard navigation can be activated for any visible menu by pressing an arbitrary key
|
* keyboard navigation can be activated for any visible menu by pressing an arbitrary key
|
||||||
|
|
||||||
|
* new "noDropShadow" property for Morphs that already have built-in shadows (Menus, SpeechBubbles)
|
||||||
|
|
||||||
documentation contents
|
documentation contents
|
||||||
----------------------
|
----------------------
|
||||||
|
@ -1176,7 +1177,7 @@
|
||||||
|
|
||||||
/*global window, HTMLCanvasElement, FileReader, Audio, FileList, Map*/
|
/*global window, HTMLCanvasElement, FileReader, Audio, FileList, Map*/
|
||||||
|
|
||||||
var morphicVersion = '2020-February-18';
|
var morphicVersion = '2020-February-20';
|
||||||
var modules = {}; // keep track of additional loaded modules
|
var modules = {}; // keep track of additional loaded modules
|
||||||
var useBlurredShadows = getBlurredShadowSupport(); // check for Chrome-bug
|
var useBlurredShadows = getBlurredShadowSupport(); // check for Chrome-bug
|
||||||
|
|
||||||
|
@ -3060,6 +3061,7 @@ Morph.prototype.init = function () {
|
||||||
this.isTemplate = false;
|
this.isTemplate = false;
|
||||||
this.acceptsDrops = false;
|
this.acceptsDrops = false;
|
||||||
this.isFreeForm = false;
|
this.isFreeForm = false;
|
||||||
|
this.noDropShadow = false;
|
||||||
this.fps = 0;
|
this.fps = 0;
|
||||||
this.customContextMenu = null;
|
this.customContextMenu = null;
|
||||||
this.lastTime = Date.now();
|
this.lastTime = Date.now();
|
||||||
|
@ -5974,6 +5976,7 @@ SpeechBubbleMorph.prototype.init = function (
|
||||||
border || ((border === 0) ? 0 : 1),
|
border || ((border === 0) ? 0 : 1),
|
||||||
borderColor || new Color(140, 140, 140)
|
borderColor || new Color(140, 140, 140)
|
||||||
);
|
);
|
||||||
|
this.noDropShadow = true;
|
||||||
this.color = color || new Color(230, 230, 230);
|
this.color = color || new Color(230, 230, 230);
|
||||||
this.fixLayout();
|
this.fixLayout();
|
||||||
};
|
};
|
||||||
|
@ -7820,6 +7823,7 @@ MenuMorph.prototype.init = function (target, title, environment, fontSize) {
|
||||||
|
|
||||||
// override inherited properties:
|
// override inherited properties:
|
||||||
this.isDraggable = false;
|
this.isDraggable = false;
|
||||||
|
this.noDropShadow = true;
|
||||||
|
|
||||||
// immutable properties:
|
// immutable properties:
|
||||||
this.border = null;
|
this.border = null;
|
||||||
|
@ -11039,7 +11043,7 @@ HandMorph.prototype.grab = function (aMorph) {
|
||||||
if (this.children.length === 0) {
|
if (this.children.length === 0) {
|
||||||
this.world.stopEditing();
|
this.world.stopEditing();
|
||||||
this.grabOrigin = aMorph.situation();
|
this.grabOrigin = aMorph.situation();
|
||||||
if (!(aMorph instanceof MenuMorph)) {
|
if (!aMorph.noDropShadow) {
|
||||||
aMorph.addShadow();
|
aMorph.addShadow();
|
||||||
}
|
}
|
||||||
if (aMorph.prepareToBeGrabbed) {
|
if (aMorph.prepareToBeGrabbed) {
|
||||||
|
@ -11062,7 +11066,7 @@ HandMorph.prototype.drop = function () {
|
||||||
this.changed();
|
this.changed();
|
||||||
target.add(morphToDrop);
|
target.add(morphToDrop);
|
||||||
morphToDrop.changed();
|
morphToDrop.changed();
|
||||||
if (!(morphToDrop instanceof MenuMorph)) {
|
if (!morphToDrop.noDropShadow) {
|
||||||
morphToDrop.removeShadow();
|
morphToDrop.removeShadow();
|
||||||
}
|
}
|
||||||
this.children = [];
|
this.children = [];
|
||||||
|
|
|
@ -1521,6 +1521,7 @@ DialogBoxMorph.prototype.init = function (target, action, environment) {
|
||||||
|
|
||||||
// override inherited properites:
|
// override inherited properites:
|
||||||
this.isDraggable = true;
|
this.isDraggable = true;
|
||||||
|
this.noDropShadow = true;
|
||||||
this.color = PushButtonMorph.prototype.color;
|
this.color = PushButtonMorph.prototype.color;
|
||||||
this.createLabel();
|
this.createLabel();
|
||||||
this.createButtons();
|
this.createButtons();
|
||||||
|
@ -2465,8 +2466,8 @@ DialogBoxMorph.prototype.addBody = function (aMorph) {
|
||||||
|
|
||||||
// DialogBoxMorph layout
|
// DialogBoxMorph layout
|
||||||
|
|
||||||
DialogBoxMorph.prototype.addShadow = function () {nop(); };
|
// +++ DialogBoxMorph.prototype.addShadow = function () {nop(); };
|
||||||
DialogBoxMorph.prototype.removeShadow = function () {nop(); };
|
// +++ DialogBoxMorph.prototype.removeShadow = function () {nop(); };
|
||||||
|
|
||||||
DialogBoxMorph.prototype.fixLayout = function () {
|
DialogBoxMorph.prototype.fixLayout = function () {
|
||||||
// determine by extent and arrange my components
|
// determine by extent and arrange my components
|
||||||
|
@ -2544,6 +2545,11 @@ DialogBoxMorph.prototype.fixLayout = function () {
|
||||||
this.buttons.setCenter(this.center());
|
this.buttons.setCenter(this.center());
|
||||||
this.buttons.setBottom(this.bottom() - this.padding);
|
this.buttons.setBottom(this.bottom() - this.padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// refresh a shallow shadow
|
||||||
|
this.removeShadow();
|
||||||
|
this.addShadow(new Point(2, 2), 80);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// DialogBoxMorph shadow
|
// DialogBoxMorph shadow
|
||||||
|
@ -2553,6 +2559,7 @@ DialogBoxMorph.prototype.fixLayout = function () {
|
||||||
conflicted by the scrolling scripts pane
|
conflicted by the scrolling scripts pane
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
DialogBoxMorph.prototype.shadowImage = function (off, color) {
|
DialogBoxMorph.prototype.shadowImage = function (off, color) {
|
||||||
// flat mode
|
// flat mode
|
||||||
var fb, img, outline, sha, ctx,
|
var fb, img, outline, sha, ctx,
|
||||||
|
@ -2607,6 +2614,7 @@ DialogBoxMorph.prototype.shadowImageBlurred = function (off, color) {
|
||||||
);
|
);
|
||||||
return sha;
|
return sha;
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
// DialogBoxMorph keyboard events
|
// DialogBoxMorph keyboard events
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue