030f304de4a2961112a79c139cd7e642114785a7e27955133ef8348d362b3a1c.json 12 KB

1
  1. {"ast":null,"code":"/**\n * Size containing width and height\n */\nexport class Size {\n /**\n * Creates a Size object from the given width and height (floats).\n * @param width width of the new size\n * @param height height of the new size\n */\n constructor(width, height) {\n this.width = width;\n this.height = height;\n }\n /**\n * Returns a string with the Size width and height\n * @returns a string with the Size width and height\n */\n toString() {\n return `{W: ${this.width}, H: ${this.height}}`;\n }\n /**\n * \"Size\"\n * @returns the string \"Size\"\n */\n getClassName() {\n return \"Size\";\n }\n /**\n * Returns the Size hash code.\n * @returns a hash code for a unique width and height\n */\n getHashCode() {\n let hash = this.width | 0;\n hash = hash * 397 ^ (this.height | 0);\n return hash;\n }\n /**\n * Updates the current size from the given one.\n * @param src the given size\n */\n copyFrom(src) {\n this.width = src.width;\n this.height = src.height;\n }\n /**\n * Updates in place the current Size from the given floats.\n * @param width width of the new size\n * @param height height of the new size\n * @returns the updated Size.\n */\n copyFromFloats(width, height) {\n this.width = width;\n this.height = height;\n return this;\n }\n /**\n * Updates in place the current Size from the given floats.\n * @param width width to set\n * @param height height to set\n * @returns the updated Size.\n */\n set(width, height) {\n return this.copyFromFloats(width, height);\n }\n /**\n * Multiplies the width and height by numbers\n * @param w factor to multiple the width by\n * @param h factor to multiple the height by\n * @returns a new Size set with the multiplication result of the current Size and the given floats.\n */\n multiplyByFloats(w, h) {\n return new Size(this.width * w, this.height * h);\n }\n /**\n * Clones the size\n * @returns a new Size copied from the given one.\n */\n clone() {\n return new Size(this.width, this.height);\n }\n /**\n * True if the current Size and the given one width and height are strictly equal.\n * @param other the other size to compare against\n * @returns True if the current Size and the given one width and height are strictly equal.\n */\n equals(other) {\n if (!other) {\n return false;\n }\n return this.width === other.width && this.height === other.height;\n }\n /**\n * The surface of the Size : width * height (float).\n */\n get surface() {\n return this.width * this.height;\n }\n /**\n * Create a new size of zero\n * @returns a new Size set to (0.0, 0.0)\n */\n static Zero() {\n return new Size(0.0, 0.0);\n }\n /**\n * Sums the width and height of two sizes\n * @param otherSize size to add to this size\n * @returns a new Size set as the addition result of the current Size and the given one.\n */\n add(otherSize) {\n const r = new Size(this.width + otherSize.width, this.height + otherSize.height);\n return r;\n }\n /**\n * Subtracts the width and height of two\n * @param otherSize size to subtract to this size\n * @returns a new Size set as the subtraction result of the given one from the current Size.\n */\n subtract(otherSize) {\n const r = new Size(this.width - otherSize.width, this.height - otherSize.height);\n return r;\n }\n /**\n * Scales the width and height\n * @param scale the scale to multiply the width and height by\n * @returns a new Size set with the multiplication result of the current Size and the given floats.\n */\n scale(scale) {\n return new Size(this.width * scale, this.height * scale);\n }\n /**\n * Creates a new Size set at the linear interpolation \"amount\" between \"start\" and \"end\"\n * @param start starting size to lerp between\n * @param end end size to lerp between\n * @param amount amount to lerp between the start and end values\n * @returns a new Size set at the linear interpolation \"amount\" between \"start\" and \"end\"\n */\n static Lerp(start, end, amount) {\n const w = start.width + (end.width - start.width) * amount;\n const h = start.height + (end.height - start.height) * amount;\n return new Size(w, h);\n }\n}","map":{"version":3,"names":["Size","constructor","width","height","toString","getClassName","getHashCode","hash","copyFrom","src","copyFromFloats","set","multiplyByFloats","w","h","clone","equals","other","surface","Zero","add","otherSize","r","subtract","scale","Lerp","start","end","amount"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Maths/math.size.js"],"sourcesContent":["/**\n * Size containing width and height\n */\nexport class Size {\n /**\n * Creates a Size object from the given width and height (floats).\n * @param width width of the new size\n * @param height height of the new size\n */\n constructor(width, height) {\n this.width = width;\n this.height = height;\n }\n /**\n * Returns a string with the Size width and height\n * @returns a string with the Size width and height\n */\n toString() {\n return `{W: ${this.width}, H: ${this.height}}`;\n }\n /**\n * \"Size\"\n * @returns the string \"Size\"\n */\n getClassName() {\n return \"Size\";\n }\n /**\n * Returns the Size hash code.\n * @returns a hash code for a unique width and height\n */\n getHashCode() {\n let hash = this.width | 0;\n hash = (hash * 397) ^ (this.height | 0);\n return hash;\n }\n /**\n * Updates the current size from the given one.\n * @param src the given size\n */\n copyFrom(src) {\n this.width = src.width;\n this.height = src.height;\n }\n /**\n * Updates in place the current Size from the given floats.\n * @param width width of the new size\n * @param height height of the new size\n * @returns the updated Size.\n */\n copyFromFloats(width, height) {\n this.width = width;\n this.height = height;\n return this;\n }\n /**\n * Updates in place the current Size from the given floats.\n * @param width width to set\n * @param height height to set\n * @returns the updated Size.\n */\n set(width, height) {\n return this.copyFromFloats(width, height);\n }\n /**\n * Multiplies the width and height by numbers\n * @param w factor to multiple the width by\n * @param h factor to multiple the height by\n * @returns a new Size set with the multiplication result of the current Size and the given floats.\n */\n multiplyByFloats(w, h) {\n return new Size(this.width * w, this.height * h);\n }\n /**\n * Clones the size\n * @returns a new Size copied from the given one.\n */\n clone() {\n return new Size(this.width, this.height);\n }\n /**\n * True if the current Size and the given one width and height are strictly equal.\n * @param other the other size to compare against\n * @returns True if the current Size and the given one width and height are strictly equal.\n */\n equals(other) {\n if (!other) {\n return false;\n }\n return this.width === other.width && this.height === other.height;\n }\n /**\n * The surface of the Size : width * height (float).\n */\n get surface() {\n return this.width * this.height;\n }\n /**\n * Create a new size of zero\n * @returns a new Size set to (0.0, 0.0)\n */\n static Zero() {\n return new Size(0.0, 0.0);\n }\n /**\n * Sums the width and height of two sizes\n * @param otherSize size to add to this size\n * @returns a new Size set as the addition result of the current Size and the given one.\n */\n add(otherSize) {\n const r = new Size(this.width + otherSize.width, this.height + otherSize.height);\n return r;\n }\n /**\n * Subtracts the width and height of two\n * @param otherSize size to subtract to this size\n * @returns a new Size set as the subtraction result of the given one from the current Size.\n */\n subtract(otherSize) {\n const r = new Size(this.width - otherSize.width, this.height - otherSize.height);\n return r;\n }\n /**\n * Scales the width and height\n * @param scale the scale to multiply the width and height by\n * @returns a new Size set with the multiplication result of the current Size and the given floats.\n */\n scale(scale) {\n return new Size(this.width * scale, this.height * scale);\n }\n /**\n * Creates a new Size set at the linear interpolation \"amount\" between \"start\" and \"end\"\n * @param start starting size to lerp between\n * @param end end size to lerp between\n * @param amount amount to lerp between the start and end values\n * @returns a new Size set at the linear interpolation \"amount\" between \"start\" and \"end\"\n */\n static Lerp(start, end, amount) {\n const w = start.width + (end.width - start.width) * amount;\n const h = start.height + (end.height - start.height) * amount;\n return new Size(w, h);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,MAAMA,IAAI,CAAC;EACd;AACJ;AACA;AACA;AACA;EACIC,WAAWA,CAACC,KAAK,EAAEC,MAAM,EAAE;IACvB,IAAI,CAACD,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,MAAM,GAAGA,MAAM;EACxB;EACA;AACJ;AACA;AACA;EACIC,QAAQA,CAAA,EAAG;IACP,OAAO,OAAO,IAAI,CAACF,KAAK,QAAQ,IAAI,CAACC,MAAM,GAAG;EAClD;EACA;AACJ;AACA;AACA;EACIE,YAAYA,CAAA,EAAG;IACX,OAAO,MAAM;EACjB;EACA;AACJ;AACA;AACA;EACIC,WAAWA,CAAA,EAAG;IACV,IAAIC,IAAI,GAAG,IAAI,CAACL,KAAK,GAAG,CAAC;IACzBK,IAAI,GAAIA,IAAI,GAAG,GAAG,IAAK,IAAI,CAACJ,MAAM,GAAG,CAAC,CAAC;IACvC,OAAOI,IAAI;EACf;EACA;AACJ;AACA;AACA;EACIC,QAAQA,CAACC,GAAG,EAAE;IACV,IAAI,CAACP,KAAK,GAAGO,GAAG,CAACP,KAAK;IACtB,IAAI,CAACC,MAAM,GAAGM,GAAG,CAACN,MAAM;EAC5B;EACA;AACJ;AACA;AACA;AACA;AACA;EACIO,cAAcA,CAACR,KAAK,EAAEC,MAAM,EAAE;IAC1B,IAAI,CAACD,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,MAAM,GAAGA,MAAM;IACpB,OAAO,IAAI;EACf;EACA;AACJ;AACA;AACA;AACA;AACA;EACIQ,GAAGA,CAACT,KAAK,EAAEC,MAAM,EAAE;IACf,OAAO,IAAI,CAACO,cAAc,CAACR,KAAK,EAA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CAAC;EACZ;EACA;AACJ;AACA;AACA;AACA;EACIE,KAAKA,CAACA,KAAK,EAAE;IACT,OAAO,IAAIxB,IAAI,CAAC,IAAI,CAACE,KAAK,GAAGsB,KAAK,EAAE,IAAI,CAACrB,MAAM,GAAGqB,KAAK,CAAC;EAC5D;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;EACI,OAAOC,IAAIA,CAACC,KAAK,EAAEC,GAAG,EAAEC,MAAM,EAAE;IAC5B,MAAMf,CAAC,GAAGa,KAAK,CAACxB,KAAK,GAAG,CAACyB,GAAG,CAACzB,KAAK,GAAGwB,KAAK,CAACxB,KAAK,IAAI0B,MAAM;IAC1D,MAAMd,CAAC,GAAGY,KAAK,CAACvB,MAAM,GAAG,CAACwB,GAAG,CAACxB,MAAM,GAAGuB,KAAK,CAACvB,MAAM,IAAIyB,MAAM;IAC7D,OAAO,IAAI5B,IAAI,CAACa,CAAC,EAAEC,CAAC,CAAC;EACzB;AACJ","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}