Coder Social home page Coder Social logo

generic-sensor-demos's People

Contributors

adriancampos avatar anssiko avatar bleederi avatar darktears avatar honry avatar kenchris avatar orenshalev avatar rakuco avatar rdower avatar reillyeon avatar xiuqijix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

generic-sensor-demos's Issues

browsers support

Looks like the latest Firefox, Chrome, and Safari doesn`t support generic sensors API?

Ambient Map: The background style doesn't change

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?

Live examples available?

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.

Sensor.start() is not a function

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?

Use new mwc- elements

Quite easy to move to

image

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>

Move to LitElement to simplify the code

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>

Not working on raspberry

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.

ambient-map demo: missing API key

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).

sensor-tester: orientation locking does not always work

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.

Auto-publish after new commits

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.

Migrate all demos to at least Polymer 3.0

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.