text: phina.define("RectangleClip", {
    superClass: "Accessory",
  
    x: 0,
    y: 0,
    width: 0,
    height: 0,
  
    _enable: true,
  
    init: function() {
      this.superInit();
      this._init();
    },
  
    _init: function() {
      this.on("attached", () => {
  
        this.target.accessor("RectangleClip.width", {
          "get": () => this.width,
          "set": (v) => this.width = v,
        });
  
        this.target.accessor("RectangleClip.height", {
          "get": () => this.height,
          "set": (v) => this.height = v,
        });
  
        this.target.accessor("RectangleClip.x", {
          "get": () => this.x,
          "set": (v) => this.x = v,
        });
  
        this.target.accessor("RectangleClip.y", {
          "get": () => this.y,
          "set": (v) => this.y = v,
        });
  
        this.x = 0;
        this.y = 0;
        this.width = this.target.width;
        this.height = this.target.height;
  
        this.target.clip = (c) => this._clip(c);
      });
    },
  
    _clip: function(canvas) {
      const x = this.x - (this.width * this.target.originX);
      const y = this.y - (this.height * this.target.originY);
  
      canvas.beginPath();
      canvas.rect(x, y, this.width, this.height);
      canvas.closePath();
    },
  
    setEnable: function(enable) {
      this._enable = enable;
      if (this._enable) {
        this.target.clip = (c) => this._clip(c);
      } else {
        this.target.clip = null;
      }
    },
  
    _accessor: {
      enable: {
        set: function(v) {
          this.setEnable(v);
        },
        get: function() {
          return this._enable;
        }
      }
    },
  
  });
  