switch to scripts tab when dragging a block into the editor pane

thanks, @jadga-h, for the idea!
pull/95/head
jmoenig 2020-07-15 14:49:28 +02:00
rodzic a165917fa5
commit a91bf33aa5
3 zmienionych plików z 25 dodań i 4 usunięć

Wyświetl plik

@ -5,6 +5,7 @@
### 2020-07-15 ### 2020-07-15
* morphic: made keyboard handler (more) invisible, thanks, Bernat! * morphic: made keyboard handler (more) invisible, thanks, Bernat!
* gui: made remaining synchronous http requests asynch (url: #open, #run) * gui: made remaining synchronous http requests asynch (url: #open, #run)
* morphic, gui: switch to scripts tab when dragging a block into the editor pane
### 2020-07-13 ### 2020-07-13
* paint, symbols: new iconic buttons for grow, shrink and flip actions, thanks, Jadga! * paint, symbols: new iconic buttons for grow, shrink and flip actions, thanks, Jadga!

Wyświetl plik

@ -1624,6 +1624,12 @@ IDE_Morph.prototype.createSpriteEditor = function () {
this.spriteEditor.acceptsDrops = false; this.spriteEditor.acceptsDrops = false;
this.spriteEditor.contents.acceptsDrops = false; this.spriteEditor.contents.acceptsDrops = false;
this.spriteEditor.contents.mouseEnterDragging = (morph) => {
if (morph instanceof BlockMorph) {
this.spriteBar.tabBar.tabTo('scripts');
}
}
} else if (this.currentTab === 'sounds') { } else if (this.currentTab === 'sounds') {
this.spriteEditor = new JukeboxMorph( this.spriteEditor = new JukeboxMorph(
this.currentSprite, this.currentSprite,
@ -1634,6 +1640,12 @@ IDE_Morph.prototype.createSpriteEditor = function () {
this.spriteEditor.updateSelection(); this.spriteEditor.updateSelection();
this.spriteEditor.acceptDrops = false; this.spriteEditor.acceptDrops = false;
this.spriteEditor.contents.acceptsDrops = false; this.spriteEditor.contents.acceptsDrops = false;
this.spriteEditor.contents.mouseEnterDragging = (morph) => {
if (morph instanceof BlockMorph) {
this.spriteBar.tabBar.tabTo('scripts');
}
}
} else { } else {
this.spriteEditor = new Morph(); this.spriteEditor = new Morph();
this.spriteEditor.color = this.groupColor; this.spriteEditor.color = this.groupColor;

Wyświetl plik

@ -302,7 +302,7 @@
------------------- -------------------
If you wish to create a web page with more than one world, make If you wish to create a web page with more than one world, make
sure to prevent each world from auto-filling the whole page and sure to prevent each world from auto-filling the whole page and
include it in the main loop. It's also a good idea to give each include it in the main loop. It's also a good idea to give each
world its own tabindex: world its own tabindex:
example html file: example html file:
@ -479,7 +479,7 @@
MyMorph.prototype.mouseMove = function(pos) {}; MyMorph.prototype.mouseMove = function(pos) {};
All of these methods have as optional parameter a Point object Most of these methods have as optional parameter a Point object
indicating the current position of the Hand inside the World's indicating the current position of the Hand inside the World's
coordinate system. The coordinate system. The
@ -489,6 +489,14 @@
currently pressed mouse button, which is either 'left' or 'right'. currently pressed mouse button, which is either 'left' or 'right'.
You can use this to let users interact with 3D environments. You can use this to let users interact with 3D environments.
The
mouseEnterDragging(morph)
mouseLeaveDragging(morph)
event methods have as optional parameter the morph currently dragged by
the Hand, if any.
Events may be "bubbled" up a morph's owner chain by calling Events may be "bubbled" up a morph's owner chain by calling
this.escalateEvent(functionName, arg) this.escalateEvent(functionName, arg)
@ -11423,7 +11431,7 @@ HandMorph.prototype.processMouseMove = function (event) {
old.mouseLeave(); old.mouseLeave();
} }
if (old.mouseLeaveDragging && this.mouseButton) { if (old.mouseLeaveDragging && this.mouseButton) {
old.mouseLeaveDragging(); old.mouseLeaveDragging(this.children[0]);
} }
} }
}); });
@ -11433,7 +11441,7 @@ HandMorph.prototype.processMouseMove = function (event) {
newMorph.mouseEnter(); newMorph.mouseEnter();
} }
if (newMorph.mouseEnterDragging && this.mouseButton) { if (newMorph.mouseEnterDragging && this.mouseButton) {
newMorph.mouseEnterDragging(); newMorph.mouseEnterDragging(this.children[0]);
} }
} }