animate scrollToPaletteCategory()

snap7
jmoenig 2021-07-02 19:37:14 +02:00
rodzic b3bb4eb51e
commit 6f762e7a29
2 zmienionych plików z 17 dodań i 4 usunięć

Wyświetl plik

@ -18,6 +18,7 @@
* gui, object, store, etc.: unified blocks palette option, thanks, Michael!
* merged scenes branch
* morphic: fixed centering of menus, thanks, Brian Broll!
* gui: animate scrollToPaletteCategory()
### 2021-05-21
* gui, scenes, store: proxied thumbnail, name and notes in project, restored in XML

Wyświetl plik

@ -2532,13 +2532,25 @@ IDE_Morph.prototype.refreshPalette = function (shouldIgnorePosition) {
};
IDE_Morph.prototype.scrollPaletteToCategory = function (category) {
let palette = this.palette,
var palette = this.palette,
firstInCategory = palette.contents.children.find(
block => block.category === category
);
),
delta = palette.top() - firstInCategory.top() + palette.padding,
msecs = this.isAnimating ? 100 : 0;
palette.scrollY(palette.top() - firstInCategory.top() + palette.padding);
palette.adjustScrollBars();
this.world().animations.push(new Animation(
y => { // setter
palette.contents.setTop(y);
palette.contents.keepInScrollFrame();
palette.adjustScrollBars();
},
() => palette.contents.top(), // getter
delta, // delta
msecs, // duration in ms
'cubic_in', // easing
null // onComplete
));
};
IDE_Morph.prototype.pressStart = function () {