Merge pull request #1997 from bromagosa/scroll-events

Add scroll events to receiveInteraction hat morph
upd4.2
Jens Mönig 2018-01-22 16:19:43 +01:00 zatwierdzone przez GitHub
commit d8b6b5df37
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 10 dodań i 1 usunięć

Wyświetl plik

@ -993,7 +993,9 @@ SyntaxElementMorph.prototype.labelPart = function (spec) {
'pressed' : ['pressed'], 'pressed' : ['pressed'],
'dropped' : ['dropped'], 'dropped' : ['dropped'],
'mouse-entered' : ['mouse-entered'], 'mouse-entered' : ['mouse-entered'],
'mouse-departed' : ['mouse-departed'] 'mouse-departed' : ['mouse-departed'],
'scrolled-up' : ['scrolled-up'],
'scrolled-down' : ['scrolled-down']
}, },
true // read-only true // read-only
); );

Wyświetl plik

@ -4827,6 +4827,10 @@ SpriteMorph.prototype.mouseDownLeft = function () {
return this.receiveUserInteraction('pressed'); return this.receiveUserInteraction('pressed');
}; };
SpriteMorph.prototype.mouseScroll = function (y) {
return this.receiveUserInteraction('scrolled-' + (y > 0 ? 'up' : 'down'));
};
SpriteMorph.prototype.receiveUserInteraction = function (interaction) { SpriteMorph.prototype.receiveUserInteraction = function (interaction) {
var stage = this.parentThatIsA(StageMorph), var stage = this.parentThatIsA(StageMorph),
procs = [], procs = [],
@ -7685,6 +7689,9 @@ StageMorph.prototype.mouseLeave = function () {
StageMorph.prototype.mouseDownLeft StageMorph.prototype.mouseDownLeft
= SpriteMorph.prototype.mouseDownLeft; = SpriteMorph.prototype.mouseDownLeft;
StageMorph.prototype.mouseScroll
= SpriteMorph.prototype.mouseScroll;
StageMorph.prototype.receiveUserInteraction StageMorph.prototype.receiveUserInteraction
= SpriteMorph.prototype.receiveUserInteraction; = SpriteMorph.prototype.receiveUserInteraction;