1 line
2.6 KiB
Plaintext
1 line
2.6 KiB
Plaintext
{"version":3,"file":"buildRectangle.mjs","sources":["../../src/utils/buildRectangle.ts"],"sourcesContent":["import type { Rectangle } from '@pixi/core';\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\n\n/**\n * Builds a rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildRectangle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n // --- //\n // need to convert points to a nice regular data\n //\n const rectData = graphicsData.shape as Rectangle;\n const x = rectData.x;\n const y = rectData.y;\n const width = rectData.width;\n const height = rectData.height;\n\n const points = graphicsData.points;\n\n points.length = 0;\n\n if (!(width >= 0 && height >= 0))\n {\n return;\n }\n\n points.push(x, y,\n x + width, y,\n x + width, y + height,\n x, y + height);\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n const verts = graphicsGeometry.points;\n\n if (points.length === 0)\n {\n return;\n }\n\n const vertPos = verts.length / 2;\n\n verts.push(points[0], points[1],\n points[2], points[3],\n points[6], points[7],\n points[4], points[5]);\n\n graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2,\n vertPos + 1, vertPos + 2, vertPos + 3);\n },\n};\n"],"names":[],"mappings":"AAaO,MAAM,iBAAqC;AAAA,EAE9C,MAAM,cACN;AAII,UAAM,WAAW,aAAa,OACxB,IAAI,SAAS,GACb,IAAI,SAAS,GACb,QAAQ,SAAS,OACjB,SAAS,SAAS,QAElB,SAAS,aAAa;AAE5B,WAAO,SAAS,GAEV,SAAS,KAAK,UAAU,KAK9B,OAAO;AAAA,MAAK;AAAA,MAAG;AAAA,MACX,IAAI;AAAA,MAAO;AAAA,MACX,IAAI;AAAA,MAAO,IAAI;AAAA,MACf;AAAA,MAAG,IAAI;AAAA,IAAA;AAAA,EACf;AAAA,EAEA,YAAY,cAAc,kBAC1B;AACI,UAAM,SAAS,aAAa,QACtB,QAAQ,iBAAiB;AAE/B,QAAI,OAAO,WAAW;AAElB;AAGE,UAAA,UAAU,MAAM,SAAS;AAEzB,UAAA;AAAA,MAAK,OAAO,CAAC;AAAA,MAAG,OAAO,CAAC;AAAA,MAC1B,OAAO,CAAC;AAAA,MAAG,OAAO,CAAC;AAAA,MACnB,OAAO,CAAC;AAAA,MAAG,OAAO,CAAC;AAAA,MACnB,OAAO,CAAC;AAAA,MAAG,OAAO,CAAC;AAAA,IAAA,GAEvB,iBAAiB,QAAQ;AAAA,MAAK;AAAA,MAAS,UAAU;AAAA,MAAG,UAAU;AAAA,MAC1D,UAAU;AAAA,MAAG,UAAU;AAAA,MAAG,UAAU;AAAA,IAAA;AAAA,EAC5C;AACJ;"} |