Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOMElement.onShow should not update display property to block when its node.isShown() is false #470

Open
panarch opened this issue Aug 16, 2015 · 0 comments

Comments

@panarch
Copy link

panarch commented Aug 16, 2015

Here's an example to test.

  1. Add parent node and two child nodes(child1, child2)
  2. Run child1.hide()
  3. Run parent node.hide()
  4. Run parent node.show()

In this case, child1(red) should not be displayed, but it does.

There might be two possible ways to fix this,

  1. Modify DOMElement.onShow not to change property when its Node.isShown() is false
  2. Modify Dispatch.show to ignore nodes which Node.isShown() is false

I think although Node.isShown() is false, Node would be better to get onShow events from Dispatch.
So I chose the first one to fix this.
How do you think?

'use strict';

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

FamousEngine.init();
var node = FamousEngine.createScene().addChild();
var child1 = node.addChild();
var child2 = node.addChild();

child1.el = new DOMElement(child1, {
    tagName: 'div',
    properties: {
        'background-color': 'red'
    }
});

child2.el = new DOMElement(child2, {
    tagName: 'div',
    properties: {
        'background-color': 'blue'
    }
});

child1
    .setSizeMode('absolute', 'absolute')
    .setAbsoluteSize(100, 100)
    .setAlign(0.5, 0.5)
    .setMountPoint(0.5, 0.5)
    .setPosition(-50, 0);

child2
    .setSizeMode('absolute', 'absolute')
    .setAbsoluteSize(100, 100)
    .setAlign(0.5, 0.5)
    .setMountPoint(0.5, 0.5)
    .setPosition(50, 0);

child1.hide();
node.hide();
node.show();
/*
 * child1(red) should not be shown
 */
panarch added a commit to panarch/engine that referenced this issue Aug 16, 2015
DOMElement.onShow should not update display property to block when its node.isShown() is false
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

No branches or pull requests

1 participant