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
|
||||
|
||||
* new "noDropShadow" property for Morphs that already have built-in shadows (Menus, SpeechBubbles)
|
||||
|
||||
documentation contents
|
||||
----------------------
|
||||
|
@ -1176,7 +1177,7 @@
|
|||
|
||||
/*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 useBlurredShadows = getBlurredShadowSupport(); // check for Chrome-bug
|
||||
|
||||
|
@ -3060,6 +3061,7 @@ Morph.prototype.init = function () {
|
|||
this.isTemplate = false;
|
||||
this.acceptsDrops = false;
|
||||
this.isFreeForm = false;
|
||||
this.noDropShadow = false;
|
||||
this.fps = 0;
|
||||
this.customContextMenu = null;
|
||||
this.lastTime = Date.now();
|
||||
|
@ -5974,6 +5976,7 @@ SpeechBubbleMorph.prototype.init = function (
|
|||
border || ((border === 0) ? 0 : 1),
|
||||
borderColor || new Color(140, 140, 140)
|
||||
);
|
||||
this.noDropShadow = true;
|
||||
this.color = color || new Color(230, 230, 230);
|
||||
this.fixLayout();
|
||||
};
|
||||
|
@ -7820,6 +7823,7 @@ MenuMorph.prototype.init = function (target, title, environment, fontSize) {
|
|||
|
||||
// override inherited properties:
|
||||
this.isDraggable = false;
|
||||
this.noDropShadow = true;
|
||||
|
||||
// immutable properties:
|
||||
this.border = null;
|
||||
|
@ -11039,7 +11043,7 @@ HandMorph.prototype.grab = function (aMorph) {
|
|||
if (this.children.length === 0) {
|
||||
this.world.stopEditing();
|
||||
this.grabOrigin = aMorph.situation();
|
||||
if (!(aMorph instanceof MenuMorph)) {
|
||||
if (!aMorph.noDropShadow) {
|
||||
aMorph.addShadow();
|
||||
}
|
||||
if (aMorph.prepareToBeGrabbed) {
|
||||
|
@ -11062,7 +11066,7 @@ HandMorph.prototype.drop = function () {
|
|||
this.changed();
|
||||
target.add(morphToDrop);
|
||||
morphToDrop.changed();
|
||||
if (!(morphToDrop instanceof MenuMorph)) {
|
||||
if (!morphToDrop.noDropShadow) {
|
||||
morphToDrop.removeShadow();
|
||||
}
|
||||
this.children = [];
|
||||
|
|
|
@ -1521,6 +1521,7 @@ DialogBoxMorph.prototype.init = function (target, action, environment) {
|
|||
|
||||
// override inherited properites:
|
||||
this.isDraggable = true;
|
||||
this.noDropShadow = true;
|
||||
this.color = PushButtonMorph.prototype.color;
|
||||
this.createLabel();
|
||||
this.createButtons();
|
||||
|
@ -2465,8 +2466,8 @@ DialogBoxMorph.prototype.addBody = function (aMorph) {
|
|||
|
||||
// DialogBoxMorph layout
|
||||
|
||||
DialogBoxMorph.prototype.addShadow = function () {nop(); };
|
||||
DialogBoxMorph.prototype.removeShadow = function () {nop(); };
|
||||
// +++ DialogBoxMorph.prototype.addShadow = function () {nop(); };
|
||||
// +++ DialogBoxMorph.prototype.removeShadow = function () {nop(); };
|
||||
|
||||
DialogBoxMorph.prototype.fixLayout = function () {
|
||||
// determine by extent and arrange my components
|
||||
|
@ -2544,6 +2545,11 @@ DialogBoxMorph.prototype.fixLayout = function () {
|
|||
this.buttons.setCenter(this.center());
|
||||
this.buttons.setBottom(this.bottom() - this.padding);
|
||||
}
|
||||
|
||||
// refresh a shallow shadow
|
||||
this.removeShadow();
|
||||
this.addShadow(new Point(2, 2), 80);
|
||||
|
||||
};
|
||||
|
||||
// DialogBoxMorph shadow
|
||||
|
@ -2553,6 +2559,7 @@ DialogBoxMorph.prototype.fixLayout = function () {
|
|||
conflicted by the scrolling scripts pane
|
||||
*/
|
||||
|
||||
/*
|
||||
DialogBoxMorph.prototype.shadowImage = function (off, color) {
|
||||
// flat mode
|
||||
var fb, img, outline, sha, ctx,
|
||||
|
@ -2607,6 +2614,7 @@ DialogBoxMorph.prototype.shadowImageBlurred = function (off, color) {
|
|||
);
|
||||
return sha;
|
||||
};
|
||||
*/
|
||||
|
||||
// DialogBoxMorph keyboard events
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue