| OLD | NEW |
| 1 Sky Style Language | 1 Sky Style Language |
| 2 ================== | 2 ================== |
| 3 | 3 |
| 4 Planed changes | 4 Planed changes |
| 5 -------------- | 5 -------------- |
| 6 | 6 |
| 7 Add //-to-end-of-line comments to be consistent with the script | 7 Add //-to-end-of-line comments to be consistent with the script |
| 8 language. | 8 language. |
| 9 | 9 |
| 10 | 10 |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 maximum: maxHeight, | 511 maximum: maxHeight, |
| 512 }; | 512 }; |
| 513 } | 513 } |
| 514 */ | 514 */ |
| 515 | 515 |
| 516 void markAsLaidOut(); // sets this.node.needsLayout and this.node.descendantNe
edsLayout to false | 516 void markAsLaidOut(); // sets this.node.needsLayout and this.node.descendantNe
edsLayout to false |
| 517 virtual Dimensions layout(Number? width, Number? height); | 517 virtual Dimensions layout(Number? width, Number? height); |
| 518 // call markAsLaidOut(); | 518 // call markAsLaidOut(); |
| 519 // if width is null, set width to getIntrinsicWidth().value | 519 // if width is null, set width to getIntrinsicWidth().value |
| 520 // if height is null, set width height getIntrinsicHeight().value | 520 // if height is null, set width height getIntrinsicHeight().value |
| 521 // call this.assumeDimensions(width, height); |
| 521 // call this.layoutChildren(width, height); | 522 // call this.layoutChildren(width, height); |
| 522 // return { width: width, height: height } | 523 // return { width: width, height: height } |
| 523 // - this should always call this.markAsLaidOut() to reset needsLayout | 524 // - this should always call this.markAsLaidOut() to reset needsLayout |
| 524 // - the return value should include the final value for whichever of the wi
dth and height arguments | 525 // - the return value should include the final value for whichever of the wi
dth and height arguments |
| 525 // that is null | 526 // that is null |
| 526 // - subclasses that want to make 'auto' values dependent on the children sh
ould override this | 527 // - subclasses that want to make 'auto' values dependent on the children sh
ould override this |
| 527 // entirely, rather than overriding layoutChildren | 528 // entirely, rather than overriding layoutChildren |
| 528 | 529 |
| 529 virtual void layoutChildren(Number width, Number height); | 530 virtual void layoutChildren(Number width, Number height); |
| 530 // default implementation does nothing | 531 // default implementation does nothing |
| 531 // - override this if you want to lay out children but not have the children
affect your dimensions | 532 // - override this if you want to lay out children but not have the children
affect your dimensions |
| 532 | 533 |
| 533 void markAsPainted(); // sets this.node.needsPaint and this.node.descendantNee
dsPaint to false | 534 void markAsPainted(); // sets this.node.needsPaint and this.node.descendantNee
dsPaint to false |
| 534 virtual void paint(RenderingSurface canvas); | 535 virtual void paint(RenderingSurface canvas); |
| 535 // set a clip rect on the canvas for rect(0,0,this.width,this.height) | 536 // if needsPaint: |
| 536 // if needsPaint is true: | 537 // set a clip rect on the canvas for rect(0,0,this.width,this.height) |
| 537 // call the painter of each property, in order they were registered, which
on this element has a painter | 538 // call the painter of each property, in order they were registered, which
on this element has a painter |
| 538 // call this.paintChildren(canvas) | 539 // call this.paintChildren(canvas) |
| 539 // (the default implementation doesn't paint anything on top of the children
) | 540 // (the default implementation doesn't paint anything on top of the children
) |
| 540 // unset the clip | 541 // unset the clip |
| 541 // call markAsPainted() | 542 // call markAsPainted() |
| 542 | 543 |
| 543 virtual void paintChildren(RenderingSurface canvas); | 544 virtual void paintChildren(RenderingSurface canvas); |
| 544 // if descendantNeedsPaint is true: | 545 // if this.needsPaint or this.descendantNeedsPaint: |
| 545 // for each child returned by walkChildren(): | 546 // for each child returned by walkChildren(): |
| 546 // if child.needsPaint or child.descendantNeedsPaint: | 547 // call this.paintChild(canvas, child) |
| 547 // call this.paintChild(canvas, child) | |
| 548 // - you should skip children that will be clipped out of yourself because t
hey're outside your bounds | 548 // - you should skip children that will be clipped out of yourself because t
hey're outside your bounds |
| 549 | 549 |
| 550 virtual void paintChild(RenderingSurface canvas, LayoutManager child); | 550 virtual void paintChild(RenderingSurface canvas, LayoutManager child); |
| 551 // insert a "paint this child" instruction in our canvas instruction list (w
e should probably make sure we expose that API directly, too) | 551 // if this.needsPaint(): |
| 552 // start a new canvas for the child: | 552 // insert a "paint this child" instruction in our canvas instruction list
(we should probably make sure we expose that API directly, too) |
| 553 // if child.needsPaint or child.descendantNeedsPaint: |
| 554 // start a new canvas for the child: |
| 553 // transform the coordinate space by translate(child.x, child.y) | 555 // transform the coordinate space by translate(child.x, child.y) |
| 554 // call child.paint(canvas) | 556 // call child.paint(canvas) |
| 555 | 557 |
| 556 virtual Node hitTest(Float x, Float y); | 558 virtual Node hitTest(Float x, Float y); |
| 557 // default implementation uses the node's children nodes' x, y, | 559 // default implementation uses the node's children nodes' x, y, |
| 558 // width, and height, skipping any that have width=0 or height=0, or | 560 // width, and height, skipping any that have width=0 or height=0, or |
| 559 // whose ownerLayoutManager is not |this| | 561 // whose ownerLayoutManager is not |this| |
| 560 // default implementation walks the tree backwards from its built-in order | 562 // default implementation walks the tree backwards from its built-in order |
| 561 // if no child is hit, then return this.node | 563 // if no child is hit, then return this.node |
| 562 // override this if you changed your children's z-order, or if you used take
() to | 564 // override this if you changed your children's z-order, or if you used take
() to |
| 563 // hoist some descendants up to be your responsibility, or if your children
aren't | 565 // hoist some descendants up to be your responsibility, or if your children
aren't |
| 564 // rectangular (e.g. you lay them out in a hex grid) | 566 // rectangular (e.g. you lay them out in a hex grid) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 ```javascript | 653 ```javascript |
| 652 { display: { value: sky.ErrorLayoutManager } } | 654 { display: { value: sky.ErrorLayoutManager } } |
| 653 ``` | 655 ``` |
| 654 | 656 |
| 655 The ``div`` element doesn't have any default styles. | 657 The ``div`` element doesn't have any default styles. |
| 656 | 658 |
| 657 These declarations are all shared between all the elements (so e.g. if | 659 These declarations are all shared between all the elements (so e.g. if |
| 658 you reach in and change the declaration that was added to a ``title`` | 660 you reach in and change the declaration that was added to a ``title`` |
| 659 element, you're going to change the styles of all the other | 661 element, you're going to change the styles of all the other |
| 660 default-hidden elements). | 662 default-hidden elements). |
| OLD | NEW |