kopia lustrzana https://github.com/backface/turtlestitch
animate scrollToPaletteCategory()
rodzic
b3bb4eb51e
commit
6f762e7a29
|
@ -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
|
||||
|
|
20
src/gui.js
20
src/gui.js
|
@ -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 () {
|
||||
|
|
Ładowanie…
Reference in New Issue