Changing content used for empty match

When an empty expression is used in alternation with something else
(such as `(|test)`) the empty expression was using its empty group as a
placeholder element for calculating its anchor position. This
calculation was incorrect and was leading to the alternation not being
centered vertically. Using any element with height and width fixes this.

Fixes #16
This commit is contained in:
Jeff Avallone 2015-09-17 05:51:38 -04:00
parent 6c9f5d4cb6
commit 0f3677658d

View File

@ -62,8 +62,11 @@ export default {
// This leads to a Match node with no fragments, no start indicator, and
// no end indicator. Something must be rendered so that the anchor can be
// calculated based on it.
//
// Furthermore, the content rendered must have height and width or else the
// anchor calculations fail.
if (items.length === 0) {
items = [this.container.group()];
items = [this.container.group().path('M0,0h10')];
}
return Promise.all(items)