mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Merge branch 'master' of github.com:espruino/Espruino
This commit is contained in:
commit
fa34cf78f3
@ -29,12 +29,13 @@
|
||||
Bangle.js2: Use 8x3bpp block fill with masking (now at least 6x faster than 2v15)
|
||||
Fix JIT when overwriting a pre-existing function, JIT now allows `var/let/const`, fix lock leak in function call, fix FOR postinc issue
|
||||
JIT compiler now included in MDBT42Q/Pixl.js/Puck.js/Bangle.js 1
|
||||
Bangle.js 2: Bangle.setUI remove unused 'touch' mode, ensure 'back' button doesn't overlap if button is already used (fix #2287)
|
||||
Bangle.js2: Bangle.setUI remove unused 'touch' mode, ensure 'back' button doesn't overlap if button is already used (fix #2287)
|
||||
Bangle.js: Do not clear widget area if only zero width wigets are using it
|
||||
Bangle.js: Allow setting remove methods for E.show*
|
||||
Bangle.js: Add Bangle.load() and Bangle.showClock() methods
|
||||
Graphics: Ensure g.reset() after a custom font was set de-allocates the custom font (fix #2290)
|
||||
Bangle.js: setUI now calls g.reset(), and also protects against recursion in uiRemove
|
||||
Bangle.js2: Touched item coordinates in E.showScroller's select callback
|
||||
|
||||
2v15 : Fix issue where `E.toJS("\0"+"0") == '"\00"'` which is just `"\0"`
|
||||
Fix issue accessing `arguments` after/inside 'let/const' keyword (fix #2224)
|
||||
|
||||
@ -5409,7 +5409,7 @@ The second `options` argument can contain:
|
||||
"return" : ["JsVar", "A menu object with `draw()` and `drawItem(itemNo)` functions" ],
|
||||
"ifdef" : "BANGLEJS",
|
||||
"typescript" : [
|
||||
"showScroller(options?: { h: number, c: number, draw: (idx: number, rect: { x: number, y: number, w: number, h: number }) => void, select: (idx: number) => void, back?: () => void, remove?: () => void }): { draw: () => void, drawItem: (itemNo: number) => void };",
|
||||
"showScroller(options?: { h: number, c: number, draw: (idx: number, rect: { x: number, y: number, w: number, h: number }) => void, select: (idx: number, touch?: {x: number, y: number}) => void, back?: () => void, remove?: () => void }): { draw: () => void, drawItem: (itemNo: number) => void };",
|
||||
"showScroller(): void;"
|
||||
]
|
||||
}
|
||||
@ -5424,8 +5424,9 @@ Supply an object containing:
|
||||
c : 10, // number of menu items
|
||||
// a function to draw a menu item
|
||||
draw : function(idx, rect) { ... }
|
||||
// a function to call when the item is selected
|
||||
select : function(idx) { ... }
|
||||
// a function to call when the item is selected, touch parameter is only relevant
|
||||
// for Bangle.js 2 and contains the coordinates touched inside the selected item
|
||||
select : function(idx, touch) { ... }
|
||||
// optional function to be called when 'back' is tapped
|
||||
back : function() { ...}
|
||||
// Bangle.js: optional function to be called when the scroller should be removed
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
scrollMin = minimum scroll amount (can be negative)
|
||||
draw = function(idx, rect)
|
||||
remove = function()
|
||||
select = function(idx)
|
||||
select = function(idx, touch)
|
||||
}
|
||||
|
||||
returns {
|
||||
@ -91,8 +91,11 @@ Bangle.setUI({
|
||||
}, touch : (_,e)=>{
|
||||
if (e.y<R.y-4) return;
|
||||
var i = YtoIdx(e.y);
|
||||
if ((menuScrollMin<0 || i>=0) && i<options.c)
|
||||
options.select(i);
|
||||
if ((menuScrollMin<0 || i>=0) && i<options.c){
|
||||
let yAbs = (e.y + rScroll - R.y);
|
||||
let yInElement = yAbs - i*options.h;
|
||||
options.select(i, {x:e.x, y:yInElement});
|
||||
}
|
||||
}
|
||||
});
|
||||
return s;
|
||||
|
||||
6
libs/js/banglejs/E_showScroller_Q3.min.js
vendored
6
libs/js/banglejs/E_showScroller_Q3.min.js
vendored
@ -1,3 +1,3 @@
|
||||
(function(d){function m(b){return b*d.h+a.y-h}function k(b){return Math.floor((b+h-a.y)/d.h)}if(!d)return Bangle.setUI();var a=Bangle.appRect,f=0|d.scrollMin,l=d.h*d.c-a.h;l<f&&(l=f);var e={scroll:E.clip(0|d.scroll,f,l),draw:()=>{g.reset().clearRect(a.x,a.y,a.x2,a.y2);g.setClipRect(a.x,a.y,a.x2,a.y2);for(var b=k(a.y),c=Math.min(k(a.y2),d.c-1);b<=c;b++)d.draw(b,{x:a.x,y:m(b),w:a.w,h:d.h});g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1)},drawItem:b=>{var c=m(b);g.reset().setClipRect(a.x,
|
||||
c,a.x2,c+d.h);d.draw(b,{x:a.x,y:c,w:a.w,h:d.h});g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1)}},h=e.scroll&-2;e.draw();g.flip();Bangle.setUI({mode:"custom",back:d.back,remove:d.remove,drag:b=>{var c=b.dy;e.scroll-c>l&&(c=e.scroll-l);e.scroll-c<f&&(c=e.scroll-f);e.scroll-=c;c=h;h=e.scroll&-2;if(c-=h){g.reset().setClipRect(a.x,a.y,a.x2,a.y2);g.scroll(0,c);b=b.dy;if(0>b)for(g.setClipRect(a.x,a.y2-(1-b),a.x2,a.y2),b=k(a.y2-(1-b)),c=m(b);c<a.y2;)d.draw(b,{x:a.x,y:c,w:a.w,h:d.h}),b++,c+=d.h;else for(g.setClipRect(a.x,
|
||||
a.y,a.x2,a.y+b),b=k(a.y+b),c=m(b);c>a.y-d.h;)d.draw(b,{x:a.x,y:c,w:a.w,h:d.h}),c-=d.h,b--;g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1)}},touch:(b,c)=>{c.y<a.y-4||(b=k(c.y),(0>f||0<=b)&&b<d.c&&d.select(b))}});return e})
|
||||
(function(d){function m(b){return b*d.h+a.y-f}function k(b){return Math.floor((b+f-a.y)/d.h)}if(!d)return Bangle.setUI();var a=Bangle.appRect,h=0|d.scrollMin,l=d.h*d.c-a.h;l<h&&(l=h);var e={scroll:E.clip(0|d.scroll,h,l),draw:()=>{g.reset().clearRect(a.x,a.y,a.x2,a.y2);g.setClipRect(a.x,a.y,a.x2,a.y2);for(var b=k(a.y),c=Math.min(k(a.y2),d.c-1);b<=c;b++)d.draw(b,{x:a.x,y:m(b),w:a.w,h:d.h});g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1)},drawItem:b=>{var c=m(b);g.reset().setClipRect(a.x,
|
||||
c,a.x2,c+d.h);d.draw(b,{x:a.x,y:c,w:a.w,h:d.h});g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1)}},f=e.scroll&-2;e.draw();g.flip();Bangle.setUI({mode:"custom",back:d.back,remove:d.remove,drag:b=>{var c=b.dy;e.scroll-c>l&&(c=e.scroll-l);e.scroll-c<h&&(c=e.scroll-h);e.scroll-=c;c=f;f=e.scroll&-2;if(c-=f){g.reset().setClipRect(a.x,a.y,a.x2,a.y2);g.scroll(0,c);b=b.dy;if(0>b)for(g.setClipRect(a.x,a.y2-(1-b),a.x2,a.y2),b=k(a.y2-(1-b)),c=m(b);c<a.y2;)d.draw(b,{x:a.x,y:c,w:a.w,h:d.h}),b++,c+=d.h;else for(g.setClipRect(a.x,
|
||||
a.y,a.x2,a.y+b),b=k(a.y+b),c=m(b);c>a.y-d.h;)d.draw(b,{x:a.x,y:c,w:a.w,h:d.h}),c-=d.h,b--;g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1)}},touch:(b,c)=>{c.y<a.y-4||(b=k(c.y),(0>h||0<=b)&&b<d.c&&d.select(b,{x:c.x,y:c.y+f-a.y-b*d.h}))}});return e})
|
||||
Loading…
x
Reference in New Issue
Block a user