Skip to content

Conversation

alexanderGugel
Copy link
Member

onSizeChange hasn't been called.

Fixes #476

Example

'use strict';

var DOMElement = require('famous/dom-renderables/DOMElement');
var FamousEngine = require('famous/core/FamousEngine');

FamousEngine.init();

var node = FamousEngine.createScene().addChild();

var el = new DOMElement(node, {
    content: 'Hello',
    properties: {
        background: 'red',
        fontSize: '30px'
    }
});

node
    .setSizeMode('render', 'render')
    .setAlign(0.5, 0.5)
    .setMountPoint(0.5, 0.5)
    .setOrigin(0.5, 0.5);

var spinner = node.addComponent({
    onUpdate: function(time) {
        node.setRotation(0, time / 1000, 0);
        node.requestUpdateOnNextTick(spinner);
    },
    onSizeChange: function (x, y, z) {
        console.log(x, y, z);
    }
});

setTimeout(function () {
    el.setContent('A');
}, 1000);

node.requestUpdate(spinner);

@michaelobriena

alexanderGugel and others added 29 commits July 29, 2015 19:47
This refactor solves a number of issues ans subtle bugs that are
present in the current implementation. No breaking changes have
been made.

* Usage of defaultGeometry: Previously a single defaultGeometry has
  been used for all Meshes that didn't have a geometry set on them.
  Since it was possible to retrieve and mutate the geometry, mutating
  the geometry of one Mesh would have resulted into unexpected
  results (since the geometry was shared among all Meshes).

* Primitives inherit from Geometry: Although the methods were
  documented as constructors, they actually instantiated a new
  Geometry and returned it. This resulted into confusing
  `instanceof` and `constructor` checks. The new keyword is still
  optional, there this is not a breaking change.

* Deprecate Mesh#setGeometry's geometry register: Accepting
  geometries as strings is problematic, since it means that **all**
  geometries will be required and included in the bundled file (as
  pointed out on phabricator). Currently a console.warn is used for
  printing the deprecation notice.
Previously wasn't an issue, since:

1. There were no registries
2. Meshes were never being removed
In the current implementation a new typed array is being instantiated on
every subData call using `concat`. This should be factored out by sending
the data as a transferable ArrayBuffer through postMessage, resulting
into a zero-copy transfer. For the time being, we can at least remove the
obsolete cloning of the array using concat.
* throws an error instead of console.error when WebGL is not supported
  otherwise this.gl is undefined and the errors would be pretty confusing for
  users in either case)
* WebGLRenderer#getContext returns the previously retrieved GL context if
  available
This change is intended to make the behavior of Dispatch#dispatch more
intuitive behavior by dispatching the event on the original "source node"
(the passed in node).
Dispatch#dispatch was not calling onReceive on the nodes' components.
Equivalent of f6b1dde

Needed for nesting DOMElements within Meshes
onSizeChange hasn't been called.

Fixes Famous#476
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant