<commit_before>package luxe;

import luxe.Color;
import luxe.Rectangle;
import luxe.Sprite;
import luxe.Vector;
import phoenix.Batcher;
import phoenix.geometry.QuadPackGeometry;
import phoenix.geometry.CompositeGeometry;
import phoenix.geometry.QuadGeometry;
import phoenix.geometry.TextureCoord;

import luxe.options.NineSliceOptions;

private typedef Slice = {
    pos : Vector,
    width : Float,
    height : Float,
    source_x : Float,
    source_y : Float,
    source_width : Float,
    source_height : Float,
    geometry_id : Int
};

/** A nineslice based sprite, for scaling */
class NineSlice extends luxe.Visual {

    public var top : Float = 32;
    public var left : Float = 32;
    public var right : Float = 32;
    public var width : Float = 0.0;
    public var bottom : Float = 32;
    public var height : Float = 0.0;
    public var source_x : Float = 0.0;
    public var source_y : Float = 0.0;
    public var source_w : Float = 0.0;
    public var source_h : Float = 0.0;
    public var is_set : Bool = false;

    @:noCompletion public var midwidth : Float = 0.0;
    @:noCompletion public var midheight : Float = 0.0;
    @:noCompletion public var slices : Array<Slice>;
    @:noCompletion public var added : Bool = false;
    @:noCompletion public var nineslice_options : NineSliceOptions;
    @:noCompletion public var _geometry : QuadPackGeometry;

    var _batcher : Batcher;

        /** create a new nineslice with given options */
    public function new( _options:NineSliceOptions ) {

            //default to internal batcher
        slices = new Array<Slice>();

            //we need to tell the sprite not to create geometry ,
            //and not to add us to any scenes or anything
        if(_options == null) {
            _options = {
                no_geometry : true,
                no_scene : true
            }
        } else {
            _options.no_geometry = true;
            _options.no_scene = true;
        }

        nineslice_options = _options;

        if(_options.batcher != null) {
            _batcher = _options.batcher;
        } else {
            _batcher = Luxe.renderer.batcher;
        }

            //visual options to parent
        super(_options);

            //now local options
        if(_options.top != null) top = _options.top;
        if(_options.left != null) left = _options.left;
        if(_options.right != null) right = _options.right;
        if(_options.bottom != null) bottom = _options.bottom;

        if(_options.source_x != null) { source_x = _options.source_x; }
        if(_options.source_y != null) { source_y = _options.source_y; }
        if(_options.source_w != null) {<commit_msg>Nineslice; remove no_scene flag being forced on (not sure why this was there originally).<commit_after>package luxe;

import luxe.Color;
import luxe.Rectangle;
import luxe.Sprite;
import luxe.Vector;
import phoenix.Batcher;
import phoenix.geometry.QuadPackGeometry;
import phoenix.geometry.CompositeGeometry;
import phoenix.geometry.QuadGeometry;
import phoenix.geometry.TextureCoord;

import luxe.options.NineSliceOptions;

private typedef Slice = {
    pos : Vector,
    width : Float,
    height : Float,
    source_x : Float,
    source_y : Float,
    source_width : Float,
    source_height : Float,
    geometry_id : Int
};

/** A nineslice based sprite, for scaling */
class NineSlice extends luxe.Visual {

    public var top : Float = 32;
    public var left : Float = 32;
    public var right : Float = 32;
    public var width : Float = 0.0;
    public var bottom : Float = 32;
    public var height : Float = 0.0;
    public var source_x : Float = 0.0;
    public var source_y : Float = 0.0;
    public var source_w : Float = 0.0;
    public var source_h : Float = 0.0;
    public var is_set : Bool = false;

    @:noCompletion public var midwidth : Float = 0.0;
    @:noCompletion public var midheight : Float = 0.0;
    @:noCompletion public var slices : Array<Slice>;
    @:noCompletion public var added : Bool = false;
    @:noCompletion public var nineslice_options : NineSliceOptions;
    @:noCompletion public var _geometry : QuadPackGeometry;

    var _batcher : Batcher;

        /** create a new nineslice with given options */
    public function new( _options:NineSliceOptions ) {

            //default to internal batcher
        slices = new Array<Slice>();

            //we need to tell the visual not to create geometry ,
            //because we create our own from here.
        if(_options == null) {
            _options = {
                no_geometry : true,
            }
        } else {
            _options.no_geometry = true;
        }

        nineslice_options = _options;

        if(_options.batcher != null) {
            _batcher = _options.batcher;
        } else {
            _batcher = Luxe.renderer.batcher;
        }

            //visual options to parent
        super(_options);

            //now local options
        if(_options.top != null) top = _options.top;
        if(_options.left != null) left = _options.left;
        if(_options.right != null) right = _options.right;
        if(_options.bottom != null) bottom = _options.bottom;

        if(_options.source_x != null) { source_x = _options.source_x; }
        if(_options.source_y != null) { source_y = _options.source_y; }
        if(_options.source_w != null) {
{'fraction_non_alphanumeric': 0.09450139794967381, 'fraction_numerical': 0.008946877912395153, 'mean_word_length': 2.3833543505674655, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5854965', 'n_tokens_mistral': 1640, 'n_tokens_neox': 1579, 'n_words': 476}