Famous / Famous/engine

Node#setMountPoint() and Node#setAlign() decrement Z-components by 0.5

Open
#450 2 comments 0 reactions 1 assignee Claimed by @alexanderGugel View on GitHub
Dominant language
JavaScript
Stars
1.7k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

Description

Node#setMountPoint() and Node#setAlign() decrements their respective Z-components by 0.5 every time they are called.

Isolation


  • Present in 0.6.2
  • Present in a5d7fd552505c0f2d40c4a86aa0a61950736ff16

Example

Relevant Code Section

``` JavaScript
staticNode.setAlign(0.5, 0.5, 10);
// next line outputs: BEFORE: getMountPoint()= {"0":0,"1":0,"2":0} .getAlign()= {"0":0.5,"1":0.5,"2":9.5}
console.log("BEFORE:", "getMountPoint()=", JSON.stringify(staticNode.getMountPoint()), ".getAlign()=", JSON.stringify(staticNode.getAlign()))
var aMountPoint = staticNode.getMountPoint();
var aAlign = staticNode.getAlign();
staticNode.setAlign(aAlign[0], aAlign[1]); // note no 3rd (z) component. Problem still occurs
staticNode.setMountPoint(aMountPoint[0], aMountPoint[1], aMountPoint[2]);
// next line outputs: AFTER: getMountPoint()= {"0":0,"1":0,"2":-0.5} .getAlign()= {"0":0.5,"1":0.5,"2":9.5}
console.log("AFTER:", "getMountPoint()=", JSON.stringify(staticNode.getMountPoint()), ".getAlign()=", JSON.stringify(staticNode.getAlign()))
```

Working Example Code

``` JavaScript










html, body {
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;

}
body {
position: absolute;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-font-smoothing: antialiased;
-webkit-tap-highlight-color: transparent;
background-color: black;
-webkit-perspective: 0;
perspective: none;
overflow: hidden;
}

'use strict';

console.log(famous);
//var famous = require('famous');
var DOMElement = famous.domRenderables.DOMElement;
var FamousEngine = famous.core.FamousEngine;
var Position = famous.components.Position;

var scene = FamousEngine.createScene();
var staticNode = scene.addChild();
staticNode.setSizeMode('absolute', 'absolute').setAbsoluteSize(50, 50)

console.clear();

staticNode.setAlign(0.5, 0.5, 10);
console.log("BEFORE:", "getMountPoint()=", JSON.stringify(staticNode.getMountPoint()), ".getAlign()=", JSON.stringify(staticNode.getAlign()))
var aMountPoint = staticNode.getMountPoint();
var aAlign = staticNode.getAlign();
staticNode.setAlign(aAlign[0], aAlign[1]); // note no 3rd (z) component. Problem still occurs
staticNode.setMountPoint(aMountPoint[0], aMountPoint[1], aMountPoint[2]);
console.log("AFTER:", "getMountPoint()=", JSON.stringify(staticNode.getMountPoint()), ".getAlign()=", JSON.stringify(staticNode.getAlign()))
staticNode.setAlign(aAlign[0], aAlign[1], aAlign[2]);
staticNode.setMountPoint(aMountPoint[0], aMountPoint[1], aMountPoint[2]);
console.log("AFTER:", "getMountPoint()=", JSON.stringify(staticNode.getMountPoint()), ".getAlign()=", JSON.stringify(staticNode.getAlign()))
staticNode.setAlign(aAlign[0], aAlign[1], aAlign[2]);
staticNode.setMountPoint(aMountPoint[0], aMountPoint[1], aMountPoint[2]);
console.log("AFTER:", "getMountPoint()=", JSON.stringify(staticNode.getMountPoint()), ".getAlign()=", JSON.stringify(staticNode.getAlign()))

var blueDIV = new DOMElement(staticNode, {
properties:{
'background-color':'#49afeb'
}
});

FamousEngine.init();

```

Ouptut

Actual Console Ouptut

``` JavaScript
BEFORE: getMountPoint()= {"0":0,"1":0,"2":0} .getAlign()= {"0":0.5,"1":0.5,"2":9.5}
AFTER: getMountPoint()= {"0":0,"1":0,"2":-0.5} .getAlign()= {"0":0.5,"1":0.5,"2":9.5}
AFTER: getMountPoint()= {"0":0,"1":0,"2":-1} .getAlign()= {"0":0.5,"1":0.5,"2":9}
AFTER: getMountPoint()= {"0":0,"1":0,"2":-1.5} .getAlign()= {"0":0.5,"1":0.5,"2":8.5}
```

(note component "2" decrements by 0.5 each time)

Expected Console Output

``` JavaScript
BEFORE: getMountPoint()= {"0":0,"1":0,"2":0} .getAlign()= {"0":0.5,"1":0.5,"2":10}
AFTER: getMountPoint()= {"0":0,"1":0,"2":0} .getAlign()= {"0":0.5,"1":0.5,"2":10}
AFTER: getMountPoint()= {"0":0,"1":0,"2":0} .getAlign()= {"0":0.5,"1":0.5,"2":10}
AFTER: getMountPoint()= {"0":0,"1":0,"2":0} .getAlign()= {"0":0.5,"1":0.5,"2":10}
```

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.