diff --git a/README.md b/README.md
index c441bc5..f712e55 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@
- [Options](#options)
* [`options.zone` defaults to 'body'](#optionszone-defaults-to-body)
* [`options.color` defaults to 'white'](#optionscolor-defaults-to-white)
- * [`options.size` defaults to 100](#optionssize-defaults-to-100)
+ * [`options.size` defaults to {val: 100, unit: "px"}](#optionssize-defaults-to-val-100-unit-px)
* [`options.threshold` defaults to 0.1](#optionsthreshold-defaults-to-01)
* [`options.fadeTime` defaults to 250](#optionsfadetime-defaults-to-250)
* [`options.multitouch` defaults to false](#optionsmultitouch-defaults-to-false)
@@ -127,7 +127,7 @@ You can configure your joystick in different ways :
var options = {
zone: Element, // active zone
color: String,
- size: Integer,
+ size: {val: Integer, unit: String},
threshold: Float, // before triggering a directional event
fadeTime: Integer, // transition time
multitouch: Boolean,
@@ -139,8 +139,9 @@ var options = {
restOpacity: Number, // opacity when not 'dynamic' and rested
lockX: Boolean, // only move on the X axis
lockY: Boolean, // only move on the Y axis
- catchDistance: Number // distance to recycle previous joystick in
+ catchDistance: Number, // distance to recycle previous joystick in
// 'semi' mode
+ dynamicPage: Boolean, // Enable if the page has dynamically visible elements
};
```
@@ -155,7 +156,7 @@ The dom element in which all your joysticks will be injected.
@@ -170,8 +171,12 @@ The background color of your joystick's elements.
Can be any valid CSS color.
-### `options.size` defaults to 100
-The size in pixel of the outer circle.
+### `options.size` defaults to `{val: 100, unit: "px"}`
+An object that determine the size of the outer circle.
+
+You can pass css unit like : `px`, `vh`, `vmin`
+
+`%` doesn't work if you doesn't set `nipple collection` height and width before
The inner circle is 50% of this size.
@@ -252,6 +257,8 @@ Locks joystick's movement to the x (horizontal) axis
### `options.lockY` defaults to false
Locks joystick's movement to the y (vertical) axis
+### `options.dynamicPage` defaults to true
+Enable if the page has dynamically visible elements such as for Vue, React, Angular or simply some CSS hiding or showing some DOM.
----
@@ -276,7 +283,7 @@ Your manager has the following signature :
mode: String,
position: Object,
catchDistance: Number,
- size: Number,
+ size: {val: Number, unit: String},
threshold: Number,
color: String,
fadeTime: Number,
@@ -368,7 +375,7 @@ Each joystick has the following signature :
},
options: {
color: String,
- size: Number,
+ size: {val: Number, unit: String},
threshold: Number,
fadeTime: Number
}
@@ -526,6 +533,10 @@ Comes with data :
radian: 1.5707963268, // angle in radian
degree: 90
},
+ vector: { // force unit vector
+ x: 0.508,
+ y: 3.110602869834277e-17
+ },
raw: { // note: angle is the same, beyond the 50 pixel limit
distance: 25.4, // distance which continues beyond the 50 pixel limit
position: { // position of the finger/mouse in pixels, beyond joystick limits
diff --git a/example/dual-joysticks.html b/example/dual-joysticks.html
index 3860953..beae03d 100644
--- a/example/dual-joysticks.html
+++ b/example/dual-joysticks.html
@@ -44,7 +44,7 @@
mode: 'static',
position: { left: '20%', top: '50%' },
color: 'green',
- size: 200
+ size: {val: 200, unit: "px"}
});
var joystickR = nipplejs.create({
@@ -52,7 +52,7 @@
mode: 'static',
position: { left: '80%', top: '50%' },
color: 'red',
- size: 200
+ size: {val: 200, unit: "px"}
});