intel / generic-sensor-demos Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
Looks like the latest Firefox, Chrome, and Safari doesn`t support generic sensors API?
To https://intel.github.io/generic-sensor-demos/, so that it would be possible to try demos immediately without forking
I would like to know how can I add accelerometer in angular project. I am using angular version 6.
Regards
Load the page first, when the illuminance less than 10, the map should uses night mode otherwise day mode. But after my PR(#81), the background doesn't change while the illuminance is changed. (It can be initially in night mode).
My google map api-key doesn't work, so I can't debug very well. The root cause may relate to following two changes against previous code.
Diff codes:
Before:
if (this.isNightMode)
this.$.mapElement.map.set('styles', this.nightStyles);
else
this.$.mapElement.map.set('styles', []);
After:
this.mapElement = this.shadowRoot.querySelector('#mapElement');
this.mapElement.set('styles', this.isNightMode ? this.nightStyles : []);
Before:
styles
is a property.
After:
styles
is a attribute.
@kenchris, do you have any idea?
Hi,
I am looking for motion actuation implementation examples to use in the implementation phase of WCAG Guideline https://www.w3.org/TR/WCAG21/#x2-6-additional-sensor-inputs especially the Success Criterion https://www.w3.org/TR/WCAG21/#x2-6-1-motion-actuation
In particular, we are looking for examples that use motion actuation in web apps but also offer alternative modes of accessing content - take, fr example a 360 degree panorama that you can either explore my turning around yourself while holding the device, or by moving the panorama stepwise (or via a scripted pannung on long press) with arrow buttons. This would be important for people with motion impairment who use mounted devices or cannot handle the device.
Are you aware of live websites that use generic sensor inputs? While we are most interested in those that would meet the Success Criterion, others would also be interesting.
I put the same code into my ES6 file using React ,After I initialize the Sensor Object ,then when I use sensor.start(),it will print 'sensor.start is not a function',by the way ,is that means I lose some important Module?or anything else?
https://github.com/intel/generic-sensor-demos/blob/master/sensor-tester/src/sensor-tester.js#L12
This is just black inlined svg, not aligned with the theme colors.
Quite easy to move to
diff --git a/sensor-tester/src/sensor-tests-page.html b/sensor-tester/src/sensor-tests-page.html
index c928791..e0214ba 100644
--- a/sensor-tester/src/sensor-tests-page.html
+++ b/sensor-tester/src/sensor-tests-page.html
@@ -6,6 +6,10 @@
<link rel="import" href="../bower_components/paper-spinner/paper-spinner-lite.html">
<link rel="import" href="../bower_components/paper-styles/color.html">
+<script type="module" src="../node_modules/@material/mwc-radio/mwc-radio.js"></script>
+<script type="module" src="../node_modules/@material/mwc-formfield/mwc-formfield.js"></script>
+<script type="module" src="../node_modules/@material/mwc-button/mwc-button.js"></script>
+
<dom-module id="sensor-tests-page">
<template>
<style>
@@ -113,11 +117,20 @@
<div class$="[[referenceframe]]">
<div>If device supports screen.orientation.lock(), rotate web page to different angles with the following buttons before running the tests.</div>
- <paper-button on-click="lockOrientation" class="LOCK" data-args="portrait-primary">0˚</paper-button>
- <paper-button on-click="lockOrientation" class="LOCK" data-args="landscape-primary">90˚</paper-button>
- <paper-button on-click="lockOrientation" class="LOCK" data-args="portrait-secondary">180˚</paper-button>
- <paper-button on-click="lockOrientation" class="LOCK" data-args="landscape-secondary">270˚</paper-button>
- <paper-button on-click="lockOrientation" class="LOCK" data-args="RESET">RESET</paper-button>
+
+ <mwc-formfield label="0˚">
+ <mwc-radio id="o.1" name="o" on-click="lockOrientation" data-args="portrait-primary" checked></mwc-radio>
+ </mwc-formfield>
+ <mwc-formfield label="90˚">
+ <mwc-radio id="o.2" name="o" on-click="lockOrientation" data-args="landscape-primary" checked></mwc-radio>
+ </mwc-formfield>
+ <mwc-formfield label="180˚">
+ <mwc-radio id="o.3" name="o" on-click="lockOrientation" data-args="portrait-secondary" checked></mwc-radio>
+ </mwc-formfield>
+ <mwc-formfield label="270˚">
+ <mwc-radio id="o.4" name="o" on-click="lockOrientation" data-args="landscape-secondary" checked></mwc-radio>
+ </mwc-formfield>
+ <mwc-button on-click="lockOrientation" class="LOCK" data-args="RESET">RESET</mwc-button>
</div>
Assigned to @rakuco
The Sensor.onerror event handler should display the sensor error message.
I have tested the below and it works fine. You can move piece by piece.
diff --git a/sensor-tester/src/create-page.js b/sensor-tester/src/create-page.js
new file mode 100644
index 0000000..727783c
--- /dev/null
+++ b/sensor-tester/src/create-page.js
@@ -0,0 +1,16 @@
+import {LitElement, html, property} from '@polymer/lit-element';
+
+export const createPage = (options) => {
+ return class extends LitElement {
+ render() {
+ return html`
+ <sensor-tests-page
+ tests=${options.src}
+ sensortype=${options.sensorType}
+ referenceframe=${options.sensorType || "screen"}
+ frequency=${options.frequency || 90}>
+ </sensor-tests-page>
+ `;
+ }
+ }
+}
\ No newline at end of file
diff --git a/sensor-tester/src/sensor-tester.html b/sensor-tester/src/sensor-tester.html
index 07257b3..ab04c2e 100644
--- a/sensor-tester/src/sensor-tester.html
+++ b/sensor-tester/src/sensor-tester.html
@@ -13,7 +13,6 @@
<link rel="import" href="../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="lazy-import" href="accelerometer-page.html">
-<link rel="lazy-import" href="accelerometer-screen-page.html">
<link rel="lazy-import" href="linearaccelerationsensor-page.html">
<link rel="lazy-import" href="linearaccelerationsensor-screen-page.html">
<link rel="lazy-import" href="gyroscope-page.html">
@@ -22,6 +21,15 @@
<link rel="lazy-import" href="ambientlightsensor-page.html">
<link rel="lazy-import" href="magnetometer-page.html">
+<script type="module">
+ import { createPage } from "create-page.js"
+
+ customElements.define('accelerometer-screen-page', createPage({
+ src: "src/tests/accelerometer-screen.json",
+ sensorType: "Accelerometer"
+ }));
+</script>
+
<dom-module id="sensor-tester">
<template>
<style>
I tried to run the demos from Raspberry. First, my Android phone takes almost forever before connecting to the server on Raspberry, second, the log console of the mobile browser says the web page cannot be found and finally, when the page of the demo is loaded on mobile Chrome, no sensor appears to be supported (not even the accelerometer, which I can access by simpler APIs than this demo). Thanks for any idea.
The API key that was in the code had long expired, and #104 removed it to stop embedding keys in the source code.
The demo is currently broken as is, and there should be a way for another key to be specified (or the demo should be reworked altogether).
Spun off #66. Some screen locking combinations in tests such as "Accelerometer with screen coordinates" don't work: for example, locking to 180 degrees then 90 while originally in portrait mode causes the latter to fail and reset the orientation locking mechanism.
There's also additional information in #66 written by @kenchris.
We need to figure out if we're doing something wrong or whether we're hitting one or more Chromium bugs.
How to import this module into ES6?
See #94, for example. It would be good to set up a GitHub Workflow to automatically build and publish a new version of the demos when a commit is merged.
HTML imports and the like are being removed from Chrome in 2019 Q1 and these are not good demos using deprecated web tech.
I would also recommend moving to LitElement directly but using Polymer 3.0 components until the mwc-elements are ready.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.