eclipsesource / eclipsesource/tabris-js

on Android: strange behavior when tapped on a composite with highlightOnTouch containing a canvas ?

Open
#1,481 3 comments 0 reactions 0 assignees View on GitHub
android bug
Dominant language
JavaScript
Stars
1.4k
Forks
171
PR merge metrics
No merged PRs in 30d

Description

### Problem description
A canvas is appended to a composite with `highlightOnTouch: true`, to create a custom button. When touched, the canvas start to looks weird, like a response to on a possible resize event ?
### Expected behavior

canvas should not redraw

### Environment

- Tabris.js version: 2.1.0
- OS: Android 4.4

### Code snippet

```javascript
const {Canvas, Composite, ui, device} = require('tabris');

let container = new Composite({
width: 200, height: 100,
centerX: 0, centerY: 0,
background: 'yellow',
highlightOnTouch: true
}).on('tap', ()=> console.log('tapped'))
.appendTo(ui.contentView);

let shape = new Canvas({
width: 50, height: 50,
}).appendTo(container);

let scaleFactor = device.scaleFactor;
let ctx = shape.getContext('2d', 50 * scaleFactor, 50 * scaleFactor);
ctx.scale(scaleFactor, scaleFactor);
ctx.strokeStyle = 'blue';
ctx.lineWidth = 10;
ctx.moveTo(90, 90);
ctx.lineTo(10, 10);
ctx.stroke();
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.