Exemplo n.º 1
0
 public override bool can_hold(element el, white_space ws)
 {
     if (!el.is_inline_box)
     {
         return(false);
     }
     if (el.is_break())
     {
         return(false);
     }
     if (ws == white_space.nowrap || ws == white_space.pre)
     {
         return(true);
     }
     if (_box_left + _width + el.width + el.get_inline_shift_left() + el.get_inline_shift_right() > _box_right)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 2
0
        public override int depth => _depth; //:h3ml

        public override void add_element(element el)
        {
            el._skip = false;
            el._box  = null;
            var add = true;

            if ((_items.Count == 0 && el.is_white_space()) || el.is_break())
            {
                el._skip = true;
            }
            else if (el.is_white_space())
            {
                if (have_last_space())
                {
                    add      = false;
                    el._skip = true;
                }
            }

            if (add)
            {
                el._box = this;
                _items.Add(el);

                if (!el._skip)
                {
                    var el_shift_left  = el.get_inline_shift_left();
                    var el_shift_right = el.get_inline_shift_right();

                    el._pos.x = _box_left + _width + el_shift_left + el.content_margins_left;
                    el._pos.y = _box_top + el.content_margins_top;
                    el._pos.z = _box_front + el.content_margins_front; //:h3ml
                    _width   += el.width + el_shift_left + el_shift_right;
                    //_depth += el.depth + el_shift_front + el_shift_back; //:h3ml
                }
            }
        }