Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release - v2.11.0 #507

Merged
merged 25 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d1d124a
Update typings of Element to allow flexItem: false
itsjamie May 15, 2023
b518b85
Update Element.mjs
jorge-graca-sky May 18, 2023
8b3b002
Apply vertex specific color to the hole punch fragment
erikhaandrikman May 23, 2023
2fc20c5
TextTextureRenderer: Fix word wrap behavior that was regressed in 2.10.0
frank-weindel Jun 6, 2023
4a29ae0
Remove unnecessary conditional
itsjamie Jun 22, 2023
2e3804a
Merge pull request #495 from itsjamie/patch-1
erikhaandrikman Jun 23, 2023
16b7a28
Merge pull request #486 from rdkcentral/fix/hole-shader
erikhaandrikman Jun 23, 2023
c74bd18
Add pointer event bubble support
erikhaandrikman Jun 23, 2023
d8f76b8
Add local pointer coords to event handler
erikhaandrikman Jun 23, 2023
e1fbd1a
Merge pull request #489 from rdkcentral/fix/text-renderer-wrapText-algo
frank-weindel Jun 28, 2023
ae36afa
Fix alpha channel detection when using in-process image handling.
wouterlucas Jun 28, 2023
1cd4afc
Merge pull request #497 from wouterlucas/fix/png-uppercase-alpha
erikhaandrikman Jun 29, 2023
12bcbd3
Merge pull request #482 from jorge-graca-sky/patch-3
erikhaandrikman Jun 29, 2023
ae790f6
Merge pull request #479 from itsjamie/fix-typings-flexItem
erikhaandrikman Jun 29, 2023
eb385dc
Revert "Fix typo on renderOfScreen"
uguraslan Jun 29, 2023
08c3c8f
Merge pull request #499 from rdkcentral/revert-482-patch-3
uguraslan Jun 29, 2023
f85aaec
Fix renderOfscreen
jorge-graca-sky Jun 29, 2023
0f2352a
Merge pull request #500 from jorge-graca-sky/patch-3
uguraslan Jun 29, 2023
6090014
Adding support to create a context for webgl2.
strokirus Jul 7, 2023
81a83ba
Merge pull request #506 from rdkcentral/feature/pointer-local-coords
uguraslan Jul 12, 2023
6a4db15
Merge pull request #504 from strokirus/fix/compatilibity-webgl2
uguraslan Jul 12, 2023
7bad747
updated package*.json for v2.11.0
uguraslan Jul 12, 2023
fcbbc87
updated the changelog for v2.11.0
uguraslan Jul 12, 2023
2f244d5
updated changelog for the release 2.11.0
uguraslan Jul 24, 2023
f3e791a
Update input docs
erikhaandrikman Jul 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## v2.11.0
*31 july 2023*

- Updated typings of Element so `flexItem` can be `false` as referred to in the documentation.
- Fixed an issue related to applying vertex-specific color to the hole punch fragment.
- Fixed the regression related to TextTextureRenderer word wrapping. (#488)
- An unnecessary conditional in the default shader code was removed.
- Fixed alpha channel detection when using in-process image handling. (#493)
- Fixed a typo referencing the `renderOffscreen` method of `Element`.
- Added `webgl2` as the fallback context option if `webgl` or `experimental-webgl` is unavailable. (#496)
- Added event bubbling support for pointer events. (#485)
- Added support for getting local coordinates with pointer events (#484)

## v2.10.0
*24 apr 2023*

Expand Down
29 changes: 19 additions & 10 deletions examples/mouse-pointer/basic-usage.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<script src="../../devtools/lightning-inspect.js"></script>
</head>

<body style="margin: 0; padding: 0">
<script type="module">
import lng from '../../src/lightning.mjs';
//attachInspector(lng)

window.onload = function() {
window.onload = function () {

const ENABLE_POINTER = true;

Expand All @@ -40,15 +42,16 @@
rect: true,
color: 0xffaa7777,
collision: true,
Text: {text: {text: 'Click me!'}, x: 25, y: 50, rotation: 0.5}
Text: { text: { text: 'Click me!' }, x: 25, y: 50, rotation: 0.5 }
}
}

_handleClick() {
_handleClick(el, { x, y }) {
console.log(x, y)
this.animation({
duration: 0.2,
actions: [
{p: 'scale', v: {0: 1.0, 0.5: 1.1, 1: 1.0}}
{ p: 'scale', v: { 0: 1.0, 0.5: 1.1, 1: 1.0 } }
]
}).start();
}
Expand All @@ -60,25 +63,31 @@
_handleUnhover() {
this.setSmooth('color', 0xffaa7777);
}
}



}
class BasicUsageExample extends lng.Application {
static _template() {
return {
Card1: {type: Card, x: 50, y: 50},
Card2: {type: Card, x: 50 + 200 + 25, y: 50},
Card3: {type: Card, x: 50 + 400 + 50, y: 50, collision: false, alpha: 0.5}
Card1: { type: Card, x: 50, y: 50 },
Card2: { type: Card, x: 50 + 200 + 25, y: 50 },
Card3: { type: Card, x: 50 + 400 + 50, y: 50, collision: true, alpha: 0.5 }
}
}

_handleClick() {
console.log('click on app')
}

}

const options = {stage: {w: 1080, h: 720, clearColor: 0xFF000000, canvas2d: false, useImageWorker: false, devicePixelRatio: 2}, debug: true, enablePointer: ENABLE_POINTER}
const options = { stage: { w: 1080, h: 720, clearColor: 0xFF000000, canvas2d: false, useImageWorker: false, devicePixelRatio: 2 }, debug: true, enablePointer: ENABLE_POINTER }
const app = new BasicUsageExample(options);

document.body.appendChild(app.stage.getCanvas());
}
</script>
</body>
</html>

</html>
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "Metrological, Bas van Meurs <b.van.meurs@metrological.com>",
"name": "@lightningjs/core",
"version": "2.10.0",
"version": "2.11.0",
"license": "Apache-2.0",
"type": "module",
"types": "dist/index.d.ts",
Expand Down
38 changes: 25 additions & 13 deletions src/application/Application.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export default class Application extends Component {
}

current = nextFocus;
} while(true);
} while (true);

return path;
}
Expand Down Expand Up @@ -430,7 +430,7 @@ export default class Application extends Component {

_recieveScrollWheel(e) {
const obj = e;
const {clientX, clientY} = obj;
const { clientX, clientY } = obj;

if (clientX <= this.stage.w && clientY <= this.stage.h) {
if (!this.fireTopDownScrollWheelHandler("_captureScroll", obj)) {
Expand All @@ -444,18 +444,18 @@ export default class Application extends Component {
let affected = this._findChildren([], children).reverse();
let n = affected.length;

while(n--) {
while (n--) {
const child = affected[n];
if (child && child[event]) {
child._captureScroll(obj);
return true;
return true;
}
}
return false;
}

fireBottomUpScrollWheelHandler(event, obj) {
const {clientX, clientY} = obj;
const { clientX, clientY } = obj;
const target = this._getTargetChild(clientX, clientY);
let child = target;

Expand All @@ -472,39 +472,51 @@ export default class Application extends Component {

_receiveClick(e) {
const obj = e;
const {clientX, clientY} = obj;
const { clientX, clientY } = obj;

if (clientX <= this.stage.w && clientY <= this.stage.h) {
this.stage.application.fireBottomUpClickHandler(obj);
}
}

fireBottomUpClickHandler(obj) {
const {clientX, clientY} = obj;
const { clientX, clientY } = obj;
const target = this._getTargetChild(clientX, clientY);
const precision = this.stage.getRenderPrecision() / this.stage.getOption('devicePixelRatio');
let child = target;

// Search tree bottom up for a handler
while (child !== null) {
if (child && child["_handleClick"]) {
child._handleClick(target);
break;
const { px, py } = child.core._worldContext;
const cx = px * precision;
const cy = py * precision;

const localCoords = {
x: clientX - cx,
y: clientY - cy
}

const returnValue = child._handleClick(target, localCoords);
if (returnValue !== false) {
break;
}
}
child = child.parent;
}
}

_receiveHover(e) {
const obj = e;
const {clientX, clientY} = obj;
const { clientX, clientY } = obj;

if (clientX <= this.stage.w && clientY <= this.stage.h) {
this.stage.application.fireBottomUpHoverHandler(obj);
}
}

fireBottomUpHoverHandler(obj) {
const {clientX, clientY} = obj;
const { clientX, clientY } = obj;
const target = this._getTargetChild(clientX, clientY);

// Only fire handlers when pointer target changes
Expand Down Expand Up @@ -562,14 +574,14 @@ export default class Application extends Component {
let affected = this._findChildren([], children);
let hoverableChildren = this._withinClickableRange(affected, clientX, clientY);

hoverableChildren.sort((a,b) => {
hoverableChildren.sort((a, b) => {
// Sort by zIndex and then id
if (a.zIndex > b.zIndex) {
return 1;
} else if (a.zIndex < b.zIndex) {
return -1;
} else {
return a.id > b.id ? 1: -1;
return a.id > b.id ? 1 : -1;
}
});

Expand Down
5 changes: 3 additions & 2 deletions src/platforms/browser/WebPlatform.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export default class WebPlatform {

loadSrcTexture({ src, hasAlpha }, cb) {
let cancelCb = undefined;
let isPng = (src.indexOf(".png") >= 0) || src.substr(0, 21) == 'data:image/png;base64';
let isPng = (src.toLowerCase().indexOf(".png") >= 0) || src.substr(0, 21) == 'data:image/png;base64';
let isKtx = src.indexOf('.ktx') >= 0;
let isPvr = src.indexOf('.pvr') >= 0;
if (isKtx || isPvr) {
Expand Down Expand Up @@ -348,7 +348,8 @@ export default class WebPlatform {
preserveDrawingBuffer: false
};

let gl = canvas.getContext('webgl', opts) || canvas.getContext('experimental-webgl', opts);
let gl = canvas.getContext('webgl', opts) || canvas.getContext('experimental-webgl', opts) || canvas.getContext('webgl2', opts);

if (!gl) {
throw new Error('This browser does not support webGL.');
}
Expand Down
Loading