<commit_before>import IDisplayObject = require("./IDisplayObject");

var MAX_FPS: number = 100;
var MAX_MSPF: number = 1000 / MAX_FPS;

class DisplayObject implements IDisplayObject {
    ZIndex: number;
    Sketch: any;
    Width: number;
    Height: number;
    Position: Point;
    Initialised: boolean = false;
    public Timer: Fayde.ClockTimer;
    public LastVisualTick: number = new Date(0).getTime();

    Init(sketch?: any): void {
        if (sketch) this.Sketch = sketch;
        if (!this.Sketch) throw new Exception("Sketch not specified for DisplayObject");

        this.StartAnimating();
        this.Initialised = true;
    }

    StartAnimating(): void {
        this.Timer = new Fayde.ClockTimer();
        this.Timer.RegisterTimer(this);
    }

    OnTicked (lastTime: number, nowTime: number) {
        var now = new Date().getTime();
        if (now - this.LastVisualTick < MAX_MSPF) return;
        this.LastVisualTick = now;

        TWEEN.update(nowTime);
    }

    get Ctx(): CanvasRenderingContext2D{
        return this.Sketch.Ctx;
    }

    public Draw() {

    }

    public Dispose(): void {

    }

    // IS CLICK WITHIN THIS BOX //
    HitRect(x,y,w,h,mx,my) {
        return (mx>x && mx<(x+w) && my>y && my<(y+h));
    }
}

export = DisplayObject;<commit_msg>Stage Zooming & Dragging Fixed #31<commit_after>import IDisplayObject = require("./IDisplayObject");

var MAX_FPS: number = 100;
var MAX_MSPF: number = 1000 / MAX_FPS;

class DisplayObject implements IDisplayObject {
    ZIndex: number;
    Sketch: any;
    Width: number;
    Height: number;
    Position: Point;
    Initialised: boolean = false;
    public Timer: Fayde.ClockTimer;
    public LastVisualTick: number = new Date(0).getTime();

    Init(sketch?: any): void {
        if (sketch) this.Sketch = sketch;
        if (!this.Sketch) throw new Exception("Sketch not specified for DisplayObject");

        this.StartAnimating();
        this.Initialised = true;
    }

    StartAnimating(): void {
        this.Timer = new Fayde.ClockTimer();
        this.Timer.RegisterTimer(this);
    }

    OnTicked (lastTime: number, nowTime: number) {
        var now = new Date().getTime();
        if (now - this.LastVisualTick < MAX_MSPF) return;
        this.LastVisualTick = now;

        TWEEN.update(nowTime);
    }

    get Ctx(): CanvasRenderingContext2D{
        return this.Sketch.Ctx;
    }

    public Draw() {
    }

    public Dispose(): void {
    }

    // IS CLICK WITHIN THIS BOX //
    HitRect(x,y,w,h,mx,my) {
        return (mx>x && mx<(x+w) && my>y && my<(y+h));
    }
}

export = DisplayObject;
{'fraction_non_alphanumeric': 0.12782242632988902, 'fraction_numerical': 0.007654037504783774, 'mean_word_length': 2.600550964187328, 'pattern_counts': {'":': 0, '<': 9, '<?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': '5069537', 'n_tokens_mistral': 886, 'n_tokens_neox': 852, 'n_words': 207}