ranuts 0.4.1-alpha.2 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +23 -16
- package/README.de.md +62 -0
- package/README.es.md +62 -0
- package/README.fa.md +62 -0
- package/README.ja.md +62 -0
- package/README.ko.md +62 -0
- package/README.md +35 -92
- package/README.pt.md +62 -0
- package/README.zh-CN.md +35 -91
- package/dist/iife/index.iife.js +4 -0
- package/dist/iife/utils.iife.js +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +307 -1
- package/dist/src/_virtual/_rolldown/runtime/index.js +12 -0
- package/dist/src/conversation/engine.d.ts +1 -1
- package/dist/src/conversation/engine.js +101 -0
- package/dist/src/conversation/index.d.ts +3 -3
- package/dist/src/conversation/index.js +4 -1
- package/dist/src/stream/accumulator.d.ts +1 -1
- package/dist/src/stream/accumulator.js +79 -0
- package/dist/src/stream/budget.d.ts +1 -1
- package/dist/src/stream/budget.js +45 -0
- package/dist/src/stream/index.d.ts +7 -7
- package/dist/src/stream/index.js +11 -1
- package/dist/src/stream/sse.d.ts +1 -1
- package/dist/src/stream/sse.js +61 -0
- package/dist/src/sw/index.js +52 -1
- package/dist/src/utils/async.js +49 -0
- package/dist/src/utils/audioRecorder.js +1121 -0
- package/dist/src/utils/behavior.js +9 -0
- package/dist/src/utils/binary.js +89 -0
- package/dist/src/utils/bom.d.ts +31 -9
- package/dist/src/utils/bom.js +165 -0
- package/dist/src/utils/bridge.js +310 -0
- package/dist/src/utils/canvas.js +103 -0
- package/dist/src/utils/chain.js +76 -0
- package/dist/src/utils/charset.d.ts +15 -0
- package/dist/src/utils/charset.js +21 -0
- package/dist/src/utils/color.d.ts +0 -1
- package/dist/src/utils/color.js +312 -0
- package/dist/src/utils/compose.js +22 -0
- package/dist/src/utils/console.js +22 -0
- package/dist/src/utils/debounce.js +18 -0
- package/dist/src/utils/device.d.ts +0 -9
- package/dist/src/utils/device.js +31 -0
- package/dist/src/utils/diff.js +110 -0
- package/dist/src/utils/dom.d.ts +1 -1
- package/dist/src/utils/dom.js +89 -0
- package/dist/src/utils/error.js +11 -0
- package/dist/src/utils/event.d.ts +3 -3
- package/dist/src/utils/event.js +39 -0
- package/dist/src/utils/file.js +14 -0
- package/dist/src/utils/func.js +4 -0
- package/dist/src/utils/i18n/index.js +79 -1
- package/dist/src/utils/idb.js +177 -0
- package/dist/src/utils/img.d.ts +1 -1
- package/dist/src/utils/img.js +68 -0
- package/dist/src/utils/index.d.ts +82 -80
- package/dist/src/utils/index.js +307 -1
- package/dist/src/utils/lang.d.ts +23 -6
- package/dist/src/utils/lang.js +42 -0
- package/dist/src/utils/localePath.js +48 -0
- package/dist/src/utils/memoize.d.ts +1 -7
- package/dist/src/utils/memoize.js +16 -0
- package/dist/src/utils/mimeType.js +841 -0
- package/dist/src/utils/monitor.js +84 -0
- package/dist/src/utils/network.js +117 -0
- package/dist/src/utils/noop.js +5 -0
- package/dist/src/utils/number.js +185 -0
- package/dist/src/utils/obj.d.ts +2 -2
- package/dist/src/utils/obj.js +140 -0
- package/dist/src/utils/paginate.js +93 -0
- package/dist/src/utils/performance.js +26 -0
- package/dist/src/utils/placement.js +37 -0
- package/dist/src/utils/prefetch.js +69 -0
- package/dist/src/utils/queue.js +46 -0
- package/dist/src/utils/report.js +44 -0
- package/dist/src/utils/request.js +35 -0
- package/dist/src/utils/script.d.ts +4 -2
- package/dist/src/utils/script.js +45 -0
- package/dist/src/utils/scroll.d.ts +2 -0
- package/dist/src/utils/scroll.js +62 -0
- package/dist/src/utils/secure.js +36 -0
- package/dist/src/utils/segment.js +43 -0
- package/dist/src/utils/signal.d.ts +1 -1
- package/dist/src/utils/signal.js +13 -0
- package/dist/src/utils/speech.js +59 -0
- package/dist/src/utils/storage.js +53 -0
- package/dist/src/utils/str.d.ts +0 -21
- package/dist/src/utils/str.js +377 -0
- package/dist/src/utils/style.js +29 -0
- package/dist/src/utils/subscribe.js +58 -0
- package/dist/src/utils/throttle.js +17 -0
- package/dist/src/utils/time.d.ts +0 -21
- package/dist/src/utils/time.js +97 -0
- package/dist/src/utils/totp/sha/common.d.ts +1 -1
- package/dist/src/utils/totp/sha/common.js +201 -0
- package/dist/src/utils/totp/sha/converters.d.ts +1 -1
- package/dist/src/utils/totp/sha/converters.js +188 -0
- package/dist/src/utils/totp/sha/primitives_32.js +55 -0
- package/dist/src/utils/totp/sha/primitives_64.js +85 -0
- package/dist/src/utils/totp/sha/sha.d.ts +1 -1
- package/dist/src/utils/totp/sha/sha.js +30 -0
- package/dist/src/utils/totp/sha/sha1.d.ts +2 -2
- package/dist/src/utils/totp/sha/sha1.js +51 -0
- package/dist/src/utils/totp/sha/sha256.d.ts +2 -2
- package/dist/src/utils/totp/sha/sha256.js +56 -0
- package/dist/src/utils/totp/sha/sha3.d.ts +3 -3
- package/dist/src/utils/totp/sha/sha3.js +253 -0
- package/dist/src/utils/totp/sha/sha512.d.ts +3 -3
- package/dist/src/utils/totp/sha/sha512.js +177 -0
- package/dist/src/utils/totp/totp.js +49 -0
- package/dist/src/utils/tween.js +59 -0
- package/dist/src/utils/visual/application.d.ts +4 -4
- package/dist/src/utils/visual/application.js +42 -0
- package/dist/src/utils/visual/enums.js +19 -0
- package/dist/src/utils/visual/event/boundary.d.ts +2 -2
- package/dist/src/utils/visual/event/boundary.js +93 -0
- package/dist/src/utils/visual/event/event.d.ts +1 -1
- package/dist/src/utils/visual/event/event.js +34 -0
- package/dist/src/utils/visual/event/index.d.ts +4 -4
- package/dist/src/utils/visual/event/types.d.ts +2 -2
- package/dist/src/utils/visual/event/types.js +23 -0
- package/dist/src/utils/visual/graphics/graphics.d.ts +8 -8
- package/dist/src/utils/visual/graphics/graphics.js +168 -0
- package/dist/src/utils/visual/graphics/graphicsData.d.ts +3 -3
- package/dist/src/utils/visual/graphics/graphicsData.js +12 -0
- package/dist/src/utils/visual/graphics/graphicsGeometry.d.ts +7 -7
- package/dist/src/utils/visual/graphics/graphicsGeometry.js +39 -0
- package/dist/src/utils/visual/graphics/index.d.ts +3 -3
- package/dist/src/utils/visual/index.d.ts +8 -8
- package/dist/src/utils/visual/index.js +20 -1
- package/dist/src/utils/visual/math/bezier.js +15 -0
- package/dist/src/utils/visual/math/enums.js +6 -0
- package/dist/src/utils/visual/math/index.d.ts +4 -4
- package/dist/src/utils/visual/math/matrix.d.ts +1 -1
- package/dist/src/utils/visual/math/matrix.js +59 -0
- package/dist/src/utils/visual/math/transform.d.ts +2 -2
- package/dist/src/utils/visual/math/transform.js +50 -0
- package/dist/src/utils/visual/render/batchRenderer.d.ts +4 -4
- package/dist/src/utils/visual/render/batchRenderer.js +59 -0
- package/dist/src/utils/visual/render/canvasRenderer.d.ts +3 -3
- package/dist/src/utils/visual/render/canvasRenderer.js +17 -0
- package/dist/src/utils/visual/render/filter.d.ts +1 -1
- package/dist/src/utils/visual/render/filter.js +92 -0
- package/dist/src/utils/visual/render/index.d.ts +2 -2
- package/dist/src/utils/visual/render/index.js +20 -0
- package/dist/src/utils/visual/render/render.d.ts +4 -4
- package/dist/src/utils/visual/render/render.js +19 -0
- package/dist/src/utils/visual/render/renderTarget.js +28 -0
- package/dist/src/utils/visual/render/utils/batch/index.d.ts +4 -4
- package/dist/src/utils/visual/render/utils/batch/index.js +88 -0
- package/dist/src/utils/visual/render/utils/earcut.js +328 -0
- package/dist/src/utils/visual/render/utils/float.js +65 -0
- package/dist/src/utils/visual/render/utils/index.js +50 -0
- package/dist/src/utils/visual/render/utils/verticy.d.ts +2 -2
- package/dist/src/utils/visual/render/utils/verticy.js +162 -0
- package/dist/src/utils/visual/render/utils/webgl/initShader.d.ts +1 -1
- package/dist/src/utils/visual/render/utils/webgl/initShader.js +31 -0
- package/dist/src/utils/visual/render/utils/webgl/shaders.js +22 -0
- package/dist/src/utils/visual/render/utils/webgpu/shaders.js +32 -0
- package/dist/src/utils/visual/render/webGPURenderer.d.ts +2 -2
- package/dist/src/utils/visual/render/webGPURenderer.js +185 -0
- package/dist/src/utils/visual/render/webGlRenderer.d.ts +2 -2
- package/dist/src/utils/visual/render/webGlRenderer.js +88 -0
- package/dist/src/utils/visual/shape/circle.d.ts +3 -3
- package/dist/src/utils/visual/shape/circle.js +17 -0
- package/dist/src/utils/visual/shape/ellipse.d.ts +3 -3
- package/dist/src/utils/visual/shape/ellipse.js +18 -0
- package/dist/src/utils/visual/shape/index.d.ts +6 -6
- package/dist/src/utils/visual/shape/polygon.d.ts +3 -3
- package/dist/src/utils/visual/shape/polygon.js +29 -0
- package/dist/src/utils/visual/shape/rectangle.d.ts +3 -3
- package/dist/src/utils/visual/shape/rectangle.js +18 -0
- package/dist/src/utils/visual/shape/roundedRectangle.d.ts +3 -3
- package/dist/src/utils/visual/shape/roundedRectangle.js +32 -0
- package/dist/src/utils/visual/shape/shape.d.ts +2 -2
- package/dist/src/utils/visual/shape/shape.js +5 -0
- package/dist/src/utils/visual/style/fill.js +18 -0
- package/dist/src/utils/visual/style/index.d.ts +2 -2
- package/dist/src/utils/visual/style/line.d.ts +2 -2
- package/dist/src/utils/visual/style/line.js +18 -0
- package/dist/src/utils/visual/types.d.ts +1 -1
- package/dist/src/utils/visual/vertex/container.d.ts +5 -5
- package/dist/src/utils/visual/vertex/container.js +54 -0
- package/dist/src/utils/visual/vertex/point.js +37 -0
- package/dist/src/utils/visual/vertex/vertex.d.ts +7 -7
- package/dist/src/utils/visual/vertex/vertex.js +76 -0
- package/dist/src/utils/worker.js +89 -0
- package/dist/src/utils/zip.js +161 -0
- package/dist/src/vnode/h.d.ts +1 -1
- package/dist/src/vnode/h.js +22 -0
- package/dist/src/vnode/hooks.d.ts +1 -1
- package/dist/src/vnode/htmlDomApi.js +94 -0
- package/dist/src/vnode/index.d.ts +16 -16
- package/dist/src/vnode/index.js +28 -1
- package/dist/src/vnode/init.d.ts +1 -1
- package/dist/src/vnode/init.js +104 -0
- package/dist/src/vnode/is.d.ts +1 -1
- package/dist/src/vnode/is.js +20 -0
- package/dist/src/vnode/modules/attributes.d.ts +1 -1
- package/dist/src/vnode/modules/attributes.js +21 -0
- package/dist/src/vnode/modules/class.d.ts +1 -1
- package/dist/src/vnode/modules/class.js +18 -0
- package/dist/src/vnode/modules/index.js +15 -0
- package/dist/src/vnode/modules/listeners.d.ts +1 -1
- package/dist/src/vnode/modules/listeners.js +36 -0
- package/dist/src/vnode/modules/props.d.ts +1 -1
- package/dist/src/vnode/modules/props.js +17 -0
- package/dist/src/vnode/modules/style.d.ts +1 -1
- package/dist/src/vnode/modules/style.js +52 -0
- package/dist/src/vnode/vnode.d.ts +6 -6
- package/dist/src/vnode/vnode.js +13 -0
- package/dist/third-party/jschardet/LICENSE.txt +504 -0
- package/dist/third-party/jschardet/NOTICE.txt +33 -0
- package/docs/API.md +8 -64
- package/package.json +14 -18
- package/dist/bin/generate-api-docs.d.ts +0 -1
- package/dist/build/build.es.d.ts +0 -2
- package/dist/build/build.umd.d.ts +0 -2
- package/dist/build/build.umd.node.d.ts +0 -2
- package/dist/build/build.umd.utils.d.ts +0 -2
- package/dist/chain-CTywmh_H.js +0 -1
- package/dist/color-BTvZUuf-.js +0 -1
- package/dist/enums-BAgbyGdH.js +0 -1
- package/dist/examples/clone-deep-example.d.ts +0 -1
- package/dist/examples/is-equal-example.d.ts +0 -1
- package/dist/i18n-DW21b_DJ.js +0 -1
- package/dist/plugins/vite-plugins-banner.d.ts +0 -2
- package/dist/rolldown-runtime-I3TIJKkN.js +0 -1
- package/dist/src/node/appendFile.d.ts +0 -7
- package/dist/src/node/body.d.ts +0 -9
- package/dist/src/node/color.d.ts +0 -7
- package/dist/src/node/command.d.ts +0 -8
- package/dist/src/node/ctx2req.d.ts +0 -5
- package/dist/src/node/fileInfo.d.ts +0 -7
- package/dist/src/node/fs.d.ts +0 -7
- package/dist/src/node/get.d.ts +0 -10
- package/dist/src/node/getIPAdress.d.ts +0 -1
- package/dist/src/node/index.d.ts +0 -25
- package/dist/src/node/index.js +0 -1
- package/dist/src/node/isColorSupported.d.ts +0 -2
- package/dist/src/node/paresUrl.d.ts +0 -19
- package/dist/src/node/readDir.d.ts +0 -6
- package/dist/src/node/readFile.d.ts +0 -9
- package/dist/src/node/router.d.ts +0 -42
- package/dist/src/node/send.d.ts +0 -7
- package/dist/src/node/server.d.ts +0 -18
- package/dist/src/node/startTask.d.ts +0 -2
- package/dist/src/node/stream.d.ts +0 -15
- package/dist/src/node/taskEnd.d.ts +0 -2
- package/dist/src/node/traverse.d.ts +0 -17
- package/dist/src/node/watchFile.d.ts +0 -8
- package/dist/src/node/writeFile.d.ts +0 -8
- package/dist/src/node/ws.d.ts +0 -8
- package/dist/src/utils/visual/render/utils/batch/index.test.d.ts +0 -1
- package/dist/src/utils/visual/render/utils/index.test.d.ts +0 -1
- package/dist/test/binary.test.d.ts +0 -1
- package/dist/test/bridge.test.d.ts +0 -1
- package/dist/test/budget.test.d.ts +0 -1
- package/dist/test/canvas.test.d.ts +0 -1
- package/dist/test/clearBr.test.d.ts +0 -1
- package/dist/test/cloneDeep.test.d.ts +0 -1
- package/dist/test/color.test.d.ts +0 -1
- package/dist/test/command.test.d.ts +0 -1
- package/dist/test/conversation.test.d.ts +0 -1
- package/dist/test/diff.test.d.ts +0 -1
- package/dist/test/encodeUrl.test.d.ts +0 -1
- package/dist/test/escapeHtml.test.d.ts +0 -1
- package/dist/test/formatBytes.test.d.ts +0 -1
- package/dist/test/is-equal.test.d.ts +0 -1
- package/dist/test/mimeType.test.d.ts +0 -1
- package/dist/test/package-exports.test.d.ts +0 -1
- package/dist/test/scroll.test.d.ts +0 -1
- package/dist/test/server.test.d.ts +0 -1
- package/dist/test/status.test.d.ts +0 -1
- package/dist/test/stream.test.d.ts +0 -1
- package/dist/test/sw.test.d.ts +0 -1
- package/dist/test/totp.test.d.ts +0 -1
- package/dist/test/tween.test.d.ts +0 -1
- package/dist/test/utils/async.test.d.ts +0 -1
- package/dist/test/utils/autosize.test.d.ts +0 -1
- package/dist/test/utils/color-grade.test.d.ts +0 -1
- package/dist/test/utils/compose.test.d.ts +0 -1
- package/dist/test/utils/event.test.d.ts +0 -1
- package/dist/test/utils/file-read.test.d.ts +0 -1
- package/dist/test/utils/format.test.d.ts +0 -1
- package/dist/test/utils/i18n.test.d.ts +0 -1
- package/dist/test/utils/idb-collection.test.d.ts +0 -1
- package/dist/test/utils/idb.test.d.ts +0 -1
- package/dist/test/utils/instrumentation.test.d.ts +0 -1
- package/dist/test/utils/interp.test.d.ts +0 -1
- package/dist/test/utils/lang.test.d.ts +0 -1
- package/dist/test/utils/locale-path.test.d.ts +0 -1
- package/dist/test/utils/media-query.test.d.ts +0 -1
- package/dist/test/utils/mergeObj.test.d.ts +0 -1
- package/dist/test/utils/number-parse.test.d.ts +0 -1
- package/dist/test/utils/paginate.test.d.ts +0 -1
- package/dist/test/utils/placement.test.d.ts +0 -1
- package/dist/test/utils/prefetch.test.d.ts +0 -1
- package/dist/test/utils/query-storage.test.d.ts +0 -1
- package/dist/test/utils/queue.test.d.ts +0 -1
- package/dist/test/utils/report-config.test.d.ts +0 -1
- package/dist/test/utils/report-image.test.d.ts +0 -1
- package/dist/test/utils/secure.test.d.ts +0 -1
- package/dist/test/utils/segment.test.d.ts +0 -1
- package/dist/test/utils/signal-once.test.d.ts +0 -1
- package/dist/test/utils/single-flight.test.d.ts +0 -1
- package/dist/test/utils/speech.test.d.ts +0 -1
- package/dist/test/utils/text-boundary.test.d.ts +0 -1
- package/dist/test/utils/time.test.d.ts +0 -1
- package/dist/test/utils/timing.test.d.ts +0 -1
- package/dist/test/utils/truncate.test.d.ts +0 -1
- package/dist/test/utils/visual/filter.test.d.ts +0 -1
- package/dist/test/utils/worker-client.test.d.ts +0 -1
- package/dist/test/utils/worker-serve.test.d.ts +0 -1
- package/dist/test/utils/zip.test.d.ts +0 -1
- package/dist/test/visual/math.test.d.ts +0 -1
- package/dist/test/visual-application.test.d.ts +0 -1
- package/dist/test/visual-batch.test.d.ts +0 -1
- package/dist/test/visual-math.test.d.ts +0 -1
- package/dist/test/vnode/index.d.ts +0 -1
- package/dist/test/vnode/server.d.ts +0 -2
- package/dist/test/vnode/vnode.d.ts +0 -1
- package/dist/test/vnode.test.d.ts +0 -1
- package/dist/test/websocket.test.d.ts +0 -1
- package/dist/test/writeFile.test.d.ts +0 -1
- package/dist/umd/index.umd.cjs +0 -1
- package/dist/umd/node/node.umd.cjs +0 -1
- package/dist/umd/utils/utils.umd.cjs +0 -1
- package/dist/utils-B4FnyUzW.js +0 -1
- package/dist/vite.config.d.ts +0 -8
- package/dist/vitest.config.d.ts +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Container } from
|
|
2
|
-
import type { Cursor, FederatedMouseEvent } from
|
|
1
|
+
import type { Container } from "../vertex/container.js";
|
|
2
|
+
import type { Cursor, FederatedMouseEvent } from "./types.js";
|
|
3
3
|
export declare class EventBoundary {
|
|
4
4
|
private rootContainer;
|
|
5
5
|
private hasFoundTarget;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { EventPhase as o } from "./types.js";
|
|
2
|
+
var p = class {
|
|
3
|
+
rootContainer;
|
|
4
|
+
hasFoundTarget = !1;
|
|
5
|
+
hitTarget = null;
|
|
6
|
+
cursor = "auto";
|
|
7
|
+
eventHandlerMap = {};
|
|
8
|
+
pressTargetsMap = {};
|
|
9
|
+
overTargets = [];
|
|
10
|
+
constructor(t) {
|
|
11
|
+
this.rootContainer = t, this.eventHandlerMap.mousemove = this.fireMouseMove, this.eventHandlerMap.mousedown = this.fireMouseDown, this.eventHandlerMap.mouseup = this.fireMouseUp;
|
|
12
|
+
}
|
|
13
|
+
hitTestRecursive = (t, r) => {
|
|
14
|
+
if (!t.visible || this.hasFoundTarget) return;
|
|
15
|
+
for (let s = t.children.length - 1; s >= 0; s--) {
|
|
16
|
+
const i = t.children[s];
|
|
17
|
+
this.hitTestRecursive(i, r);
|
|
18
|
+
}
|
|
19
|
+
if (this.hasFoundTarget) return;
|
|
20
|
+
const a = t.worldTransform.applyInverse(r);
|
|
21
|
+
t.containsPoint(a) && (this.hitTarget = t, this.hasFoundTarget = !0);
|
|
22
|
+
};
|
|
23
|
+
hitTest = (t) => (this.hasFoundTarget = !1, this.hitTarget = null, this.hitTestRecursive(this.rootContainer, t), this.hitTarget);
|
|
24
|
+
fireEvent = (t) => {
|
|
25
|
+
this.eventHandlerMap[t.type]?.(t);
|
|
26
|
+
};
|
|
27
|
+
fireMouseMove = (t) => {
|
|
28
|
+
const r = this.hitTest(t.global), a = this.overTargets.length > 0 ? this.overTargets[this.overTargets.length - 1] : null;
|
|
29
|
+
if (a && a !== r && (t.target = a, t.type = "mouseout", this.dispatchEvent(t), !r || !this.composePath(r).includes(a)))
|
|
30
|
+
if (t.type = "mouseleave", t.eventPhase = o.AT_TARGET, r) {
|
|
31
|
+
let s = a;
|
|
32
|
+
for (; s && !this.composePath(r).includes(s); )
|
|
33
|
+
t.target = s, t.currentTarget = t.target, t.target.call(`${t.type}capture`, t), t.target.call(t.type, t), s = s.parent;
|
|
34
|
+
} else
|
|
35
|
+
for (let s = this.overTargets.length - 1; s >= 0; s--)
|
|
36
|
+
t.target = this.overTargets[s], t.currentTarget = t.target, t.target.call(`${t.type}capture`, t), t.target.call(t.type, t);
|
|
37
|
+
if (r && a !== r) {
|
|
38
|
+
t.target = r, t.type = "mouseover", this.dispatchEvent(t);
|
|
39
|
+
const s = this.composePath(r);
|
|
40
|
+
if (t.type = "mouseenter", t.eventPhase = o.AT_TARGET, a) {
|
|
41
|
+
let i = s.length - 1;
|
|
42
|
+
for (; i >= 0 && !this.composePath(a).includes(s[i]); i--) ;
|
|
43
|
+
for (let e = i + 1; e < s.length; e++)
|
|
44
|
+
t.target = s[e], t.currentTarget = t.target, t.target.call(`${t.type}capture`, t), t.target.call(t.type, t);
|
|
45
|
+
} else
|
|
46
|
+
for (let i = 0; i < s.length; i++)
|
|
47
|
+
t.target = s[i], t.currentTarget = t.target, t.target.call(`${t.type}capture`, t), t.target.call(t.type, t);
|
|
48
|
+
}
|
|
49
|
+
r && (t.target = r, t.type = "mousemove", this.dispatchEvent(t)), this.overTargets = r ? this.composePath(r) : [], r ? this.cursor = r.cursor : this.cursor = "auto";
|
|
50
|
+
};
|
|
51
|
+
fireMouseDown = (t) => {
|
|
52
|
+
const r = this.hitTest(t.global);
|
|
53
|
+
r && (t.target = r, this.dispatchEvent(t), this.pressTargetsMap[t.button] = this.composePath(r));
|
|
54
|
+
};
|
|
55
|
+
fireMouseUp = (t) => {
|
|
56
|
+
const r = this.hitTest(t.global);
|
|
57
|
+
if (!r) return;
|
|
58
|
+
t.target = r, this.dispatchEvent(t);
|
|
59
|
+
const a = this.pressTargetsMap[t.button];
|
|
60
|
+
if (!a) return;
|
|
61
|
+
let s = a[a.length - 1];
|
|
62
|
+
const i = this.composePath(r);
|
|
63
|
+
for (; s && !i.includes(s); ) s.parent && (s = s.parent);
|
|
64
|
+
t.type = "click", t.target = s, this.dispatchEvent(t), delete this.pressTargetsMap[t.button];
|
|
65
|
+
};
|
|
66
|
+
notifyTarget = (t) => {
|
|
67
|
+
t.eventPhase === o.CAPTURING ? t.currentTarget.call(`${t.type}capture`, t) : t.currentTarget.call(t.type, t);
|
|
68
|
+
};
|
|
69
|
+
propagate = (t) => {
|
|
70
|
+
const r = this.composePath(t.target);
|
|
71
|
+
t.eventPhase = o.CAPTURING;
|
|
72
|
+
for (let a = 0; a < r.length - 1; a++)
|
|
73
|
+
if (t.currentTarget = r[a], this.notifyTarget(t), t.propagationStopped) return;
|
|
74
|
+
if (t.eventPhase = o.AT_TARGET, t.currentTarget = t.target, t.currentTarget.call(`${t.type}capture`, t), !t.propagationStopped && (t.currentTarget.call(t.type, t), !t.propagationStopped)) {
|
|
75
|
+
t.eventPhase = o.BUBBLING;
|
|
76
|
+
for (let a = r.length - 2; a >= 0; a--)
|
|
77
|
+
if (t.currentTarget = r[a], this.notifyTarget(t), t.propagationStopped) return;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
dispatchEvent = (t) => {
|
|
81
|
+
t.propagationStopped = !1, this.propagate(t);
|
|
82
|
+
};
|
|
83
|
+
composePath = (t) => {
|
|
84
|
+
const r = [];
|
|
85
|
+
let a = t;
|
|
86
|
+
for (; a; )
|
|
87
|
+
r.unshift(a), a = a.parent;
|
|
88
|
+
return r;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export {
|
|
92
|
+
p as EventBoundary
|
|
93
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FederatedMouseEvent as o } from "./types.js";
|
|
2
|
+
import { EventBoundary as n } from "./boundary.js";
|
|
3
|
+
var i = class {
|
|
4
|
+
canvasEle;
|
|
5
|
+
eventBoundary;
|
|
6
|
+
rootEvent = new o();
|
|
7
|
+
constructor(t, e) {
|
|
8
|
+
this.canvasEle = t, this.eventBoundary = new n(e), this.addEvents();
|
|
9
|
+
}
|
|
10
|
+
addEvents = () => {
|
|
11
|
+
this.canvasEle.addEventListener("pointermove", this.onPointerMove, !0), this.canvasEle.addEventListener("pointerleave", this.onPointerLeave, !0), this.canvasEle.addEventListener("pointerdown", this.onPointerDown, !0), this.canvasEle.addEventListener("pointerup", this.onPointerup, !0);
|
|
12
|
+
};
|
|
13
|
+
onPointerMove = (t) => {
|
|
14
|
+
this.bootstrapEvent(t), this.eventBoundary.fireEvent(this.rootEvent), this.setCursor();
|
|
15
|
+
};
|
|
16
|
+
onPointerLeave = () => {
|
|
17
|
+
this.eventBoundary.overTargets = [];
|
|
18
|
+
};
|
|
19
|
+
onPointerDown = (t) => {
|
|
20
|
+
this.bootstrapEvent(t), this.eventBoundary.fireEvent(this.rootEvent);
|
|
21
|
+
};
|
|
22
|
+
onPointerup = (t) => {
|
|
23
|
+
this.bootstrapEvent(t), this.eventBoundary.fireEvent(this.rootEvent);
|
|
24
|
+
};
|
|
25
|
+
bootstrapEvent = (t) => {
|
|
26
|
+
this.rootEvent.isTrusted = t.isTrusted, this.rootEvent.timeStamp = performance.now(), this.rootEvent.type = t.type.replace("pointer", "mouse"), this.rootEvent.button = t.button, this.rootEvent.buttons = t.buttons, this.rootEvent.global.x = t.offsetX, this.rootEvent.global.y = t.offsetY;
|
|
27
|
+
};
|
|
28
|
+
setCursor = () => {
|
|
29
|
+
this.canvasEle.style.cursor = this.eventBoundary.cursor;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
i as EventSystem
|
|
34
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EventBoundary } from
|
|
2
|
-
import { EventSystem } from
|
|
3
|
-
import { EventPhase, FederatedMouseEvent } from
|
|
4
|
-
import type { Cursor, FederatedEventMap } from
|
|
1
|
+
import { EventBoundary } from "./boundary.js";
|
|
2
|
+
import { EventSystem } from "./event.js";
|
|
3
|
+
import { EventPhase, FederatedMouseEvent } from "./types.js";
|
|
4
|
+
import type { Cursor, FederatedEventMap } from "./types.js";
|
|
5
5
|
export { EventBoundary, EventSystem, EventPhase, FederatedMouseEvent };
|
|
6
6
|
export type { FederatedEventMap, Cursor };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Point } from
|
|
2
|
-
import { Container } from
|
|
1
|
+
import { Point } from "../vertex/point.js";
|
|
2
|
+
import { Container } from "../vertex/container.js";
|
|
3
3
|
export declare enum EventPhase {
|
|
4
4
|
NONE = 0,
|
|
5
5
|
CAPTURING = 1,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Point as r } from "../vertex/point.js";
|
|
2
|
+
import { Container as o } from "../vertex/container.js";
|
|
3
|
+
var i = /* @__PURE__ */ (function(t) {
|
|
4
|
+
return t[t.NONE = 0] = "NONE", t[t.CAPTURING = 1] = "CAPTURING", t[t.AT_TARGET = 2] = "AT_TARGET", t[t.BUBBLING = 3] = "BUBBLING", t;
|
|
5
|
+
})({}), a = class {
|
|
6
|
+
isTrusted = !0;
|
|
7
|
+
timeStamp = 0;
|
|
8
|
+
type = "mousemove";
|
|
9
|
+
button = 0;
|
|
10
|
+
buttons = 0;
|
|
11
|
+
global = new r();
|
|
12
|
+
propagationStopped = !1;
|
|
13
|
+
eventPhase = 0;
|
|
14
|
+
target = new o();
|
|
15
|
+
currentTarget = new o();
|
|
16
|
+
stopPropagation() {
|
|
17
|
+
this.propagationStopped = !0;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
i as EventPhase,
|
|
22
|
+
a as FederatedMouseEvent
|
|
23
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Container } from
|
|
2
|
-
import { Polygon } from
|
|
3
|
-
import { GraphicsGeometry } from
|
|
4
|
-
import type { Shape } from
|
|
5
|
-
import type { BatchRenderer } from
|
|
6
|
-
import type { ILineStyleOptions } from
|
|
7
|
-
import type { CanvasRenderer } from
|
|
8
|
-
import type { Point } from
|
|
1
|
+
import { Container } from "../vertex/container.js";
|
|
2
|
+
import { Polygon } from "../shape/polygon.js";
|
|
3
|
+
import { GraphicsGeometry } from "./graphicsGeometry.js";
|
|
4
|
+
import type { Shape } from "../shape/shape.js";
|
|
5
|
+
import type { BatchRenderer } from "../render/batchRenderer.js";
|
|
6
|
+
import type { ILineStyleOptions } from "../types.js";
|
|
7
|
+
import type { CanvasRenderer } from "../render/canvasRenderer.js";
|
|
8
|
+
import type { Point } from "../vertex/point.js";
|
|
9
9
|
export declare class Graphics extends Container {
|
|
10
10
|
private _lineStyle;
|
|
11
11
|
private _fillStyle;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { GRAPHICS as Y } from "../enums.js";
|
|
2
|
+
import { Rectangle as v } from "../shape/rectangle.js";
|
|
3
|
+
import { batchPool as L } from "../render/utils/batch/index.js";
|
|
4
|
+
import { toRgbaLittleEndian as j } from "../render/utils/index.js";
|
|
5
|
+
import { getBezierLength as q, getQuadraticBezierLength as B } from "../math/bezier.js";
|
|
6
|
+
import { Container as D } from "../vertex/container.js";
|
|
7
|
+
import { Polygon as S } from "../shape/polygon.js";
|
|
8
|
+
import { Fill as G } from "../style/fill.js";
|
|
9
|
+
import { Line as O } from "../style/line.js";
|
|
10
|
+
import { Circle as M } from "../shape/circle.js";
|
|
11
|
+
import { Ellipse as I } from "../shape/ellipse.js";
|
|
12
|
+
import { RoundedRectangle as T } from "../shape/roundedRectangle.js";
|
|
13
|
+
import { GraphicsGeometry as z } from "./graphicsGeometry.js";
|
|
14
|
+
var it = class extends D {
|
|
15
|
+
_lineStyle = new O();
|
|
16
|
+
_fillStyle = new G();
|
|
17
|
+
geometry = new z();
|
|
18
|
+
currentPath = new S();
|
|
19
|
+
type;
|
|
20
|
+
constructor() {
|
|
21
|
+
super(), this.type = Y;
|
|
22
|
+
}
|
|
23
|
+
lineStyle(i, t = "#000000", e = 1) {
|
|
24
|
+
if (this.startPoly(), typeof i == "object") Object.assign(this._lineStyle, i);
|
|
25
|
+
else {
|
|
26
|
+
const n = {
|
|
27
|
+
width: i,
|
|
28
|
+
color: t,
|
|
29
|
+
alpha: e
|
|
30
|
+
};
|
|
31
|
+
Object.assign(this._lineStyle, n);
|
|
32
|
+
}
|
|
33
|
+
return this._lineStyle.visible = !0, this;
|
|
34
|
+
}
|
|
35
|
+
resetLineStyle = () => {
|
|
36
|
+
this._lineStyle.reset();
|
|
37
|
+
};
|
|
38
|
+
drawShape = (i) => (this.geometry.drawShape(i, this._fillStyle.clone(), this._lineStyle.clone()), this.markStructureDirty(), this);
|
|
39
|
+
startPoly = () => {
|
|
40
|
+
this.currentPath.points.length > 2 && this.drawShape(this.currentPath), this.currentPath = new S();
|
|
41
|
+
};
|
|
42
|
+
beginFill = (i = "#000000", t = 1) => (this.startPoly(), this._fillStyle.color = i, this._fillStyle.alpha = t, this._fillStyle.alpha > 0 && (this._fillStyle.visible = !0), this);
|
|
43
|
+
endFill = () => (this.startPoly(), this._fillStyle.reset(), this);
|
|
44
|
+
drawRect = (i, t, e, n) => this.drawShape(new v(i, t, e, n));
|
|
45
|
+
drawCircle = (i, t, e) => this.drawShape(new M(i, t, e));
|
|
46
|
+
drawRoundedRect = (i, t, e, n, l) => this.drawShape(new T(i, t, e, n, l));
|
|
47
|
+
drawEllipse = (i, t, e, n) => this.drawShape(new I(i, t, e, n));
|
|
48
|
+
drawPolygon = (i) => {
|
|
49
|
+
const t = new S(i);
|
|
50
|
+
return t.closeStroke = !0, this.drawShape(t);
|
|
51
|
+
};
|
|
52
|
+
moveTo = (i, t) => (this.startPoly(), this.currentPath.points[0] = i, this.currentPath.points[1] = t, this);
|
|
53
|
+
lineTo = (i, t) => {
|
|
54
|
+
if (this.currentPath.points.length === 0)
|
|
55
|
+
return this.moveTo(i, t), this;
|
|
56
|
+
const e = this.currentPath.points, n = e[e.length - 2], l = e[e.length - 1];
|
|
57
|
+
return (n !== i || l !== t) && e.push(i, t), this;
|
|
58
|
+
};
|
|
59
|
+
closePath = () => (this.currentPath.closeStroke = !0, this.startPoly(), this);
|
|
60
|
+
containsPoint = (i) => this.hitArea ? this.hitArea.contains(i) : this.geometry.containsPoint(i);
|
|
61
|
+
quadraticCurveTo = (i, t, e, n) => {
|
|
62
|
+
const l = this.currentPath.points.length;
|
|
63
|
+
l === 0 && (this.currentPath.points = [0, 0]);
|
|
64
|
+
const y = this.currentPath.points[l - 2], P = this.currentPath.points[l - 1], b = i, m = t, d = e, h = n, r = B(y, P, b, m, d, h);
|
|
65
|
+
let c = Math.ceil(r / 10);
|
|
66
|
+
c > 2048 && (c = 2048), c < 8 && (c = 8);
|
|
67
|
+
for (let o = 1; o <= c; o++) {
|
|
68
|
+
const s = o / c, p = (1 - s) * (1 - s) * y + 2 * s * (1 - s) * b + s * s * d, f = (1 - s) * (1 - s) * P + 2 * s * (1 - s) * m + s * s * h;
|
|
69
|
+
this.currentPath.points.push(p, f);
|
|
70
|
+
}
|
|
71
|
+
return this;
|
|
72
|
+
};
|
|
73
|
+
bezierCurveTo = (i, t, e, n, l, y) => {
|
|
74
|
+
const P = this.currentPath.points.length;
|
|
75
|
+
P === 0 && (this.currentPath.points = [0, 0]);
|
|
76
|
+
const b = this.currentPath.points[P - 2], m = this.currentPath.points[P - 1], d = i, h = t, r = e, c = n, o = l, s = y, p = q(b, m, d, h, r, c, o, s);
|
|
77
|
+
let f = Math.ceil(p / 10);
|
|
78
|
+
f > 2048 && (f = 2048), f < 8 && (f = 8);
|
|
79
|
+
for (let u = 1; u <= f; u++) {
|
|
80
|
+
const a = u / f, w = (1 - a) * (1 - a) * (1 - a) * b + 3 * a * (1 - a) * (1 - a) * d + 3 * a * a * (1 - a) * r + a * a * a * o, g = (1 - a) * (1 - a) * (1 - a) * m + 3 * a * (1 - a) * (1 - a) * h + 3 * a * a * (1 - a) * c + a * a * a * s;
|
|
81
|
+
this.currentPath.points.push(w, g);
|
|
82
|
+
}
|
|
83
|
+
return this;
|
|
84
|
+
};
|
|
85
|
+
arc = (i, t, e, n, l, y = !1) => {
|
|
86
|
+
if (!y) {
|
|
87
|
+
for (; l < n; ) l += Math.PI * 2;
|
|
88
|
+
l - n > Math.PI * 2 && (l = n + Math.PI * 2);
|
|
89
|
+
}
|
|
90
|
+
if (y) {
|
|
91
|
+
for (; l > n; ) n += Math.PI * 2;
|
|
92
|
+
n - l > Math.PI * 2 && (l = n - Math.PI * 2);
|
|
93
|
+
}
|
|
94
|
+
const P = l - n;
|
|
95
|
+
if (P === 0) return this;
|
|
96
|
+
const b = i + Math.cos(n) * e, m = t + Math.sin(n) * e;
|
|
97
|
+
this.lineTo(b, m);
|
|
98
|
+
const d = Math.abs(P) * e;
|
|
99
|
+
let h = Math.ceil(d / 10);
|
|
100
|
+
h > 2048 && (h = 2048), h < 8 && (h = 8);
|
|
101
|
+
for (let r = 1; r <= h; r++) {
|
|
102
|
+
const c = n + P * (r / h), o = i + Math.cos(c) * e, s = t + Math.sin(c) * e;
|
|
103
|
+
this.lineTo(o, s);
|
|
104
|
+
}
|
|
105
|
+
return this;
|
|
106
|
+
};
|
|
107
|
+
arcTo = (i, t, e, n, l) => {
|
|
108
|
+
if (!this.currentPath) return this;
|
|
109
|
+
const y = this.currentPath.points.length;
|
|
110
|
+
if (y === 0 || l === 0)
|
|
111
|
+
return this.lineTo(i, t), this;
|
|
112
|
+
const P = this.currentPath.points[y - 1] - t, b = this.currentPath.points[y - 2] - i, m = n - t, d = e - i, h = P * d - b * m, r = Math.abs(h);
|
|
113
|
+
if (r < 1e-8)
|
|
114
|
+
return this.lineTo(i, t), this;
|
|
115
|
+
const c = P * P + b * b, o = m * m + d * d, s = P * m + b * d, p = l * Math.sqrt(c) / r, f = l * Math.sqrt(o) / r, u = p * s / c, a = f * s / o, w = p * d + f * b, g = p * m + f * P, C = b * (f + u), x = P * (f + u), _ = d * (p + a), k = m * (p + a), A = Math.atan2(x - g, C - w), R = Math.atan2(k - g, _ - w), X = b * m > d * P;
|
|
116
|
+
return this.arc(w + i, g + t, l, A, R, X);
|
|
117
|
+
};
|
|
118
|
+
clear = () => (this.geometry.clear(), this._lineStyle.reset(), this._fillStyle.reset(), this.currentPath = new S(), this.batches = [], this.batchCount = 0, this.markStructureDirty(), this);
|
|
119
|
+
renderCanvas = (i) => {
|
|
120
|
+
this.startPoly();
|
|
121
|
+
const t = i.ctx, { a: e, b: n, c: l, d: y, tx: P, ty: b } = this.transform.worldTransform;
|
|
122
|
+
t.setTransform(e, n, l, y, P, b);
|
|
123
|
+
const m = this.geometry.graphicsData;
|
|
124
|
+
for (let d = 0; d < m.length; d++) {
|
|
125
|
+
const { lineStyle: h, fillStyle: r, shape: c } = m[d];
|
|
126
|
+
if (r.visible && (t.fillStyle = r.color), h.visible && (t.lineWidth = h.width, t.lineCap = h.cap, t.lineJoin = h.join, t.strokeStyle = h.color), t.beginPath(), c instanceof v) {
|
|
127
|
+
const { x: o, y: s, width: p, height: f } = c;
|
|
128
|
+
r.visible && (t.globalAlpha = r.alpha * this.worldAlpha, t.fillRect(o, s, p, f)), h.visible && (t.globalAlpha = h.alpha * this.worldAlpha, t.strokeRect(o, s, p, f));
|
|
129
|
+
}
|
|
130
|
+
if (c instanceof M) {
|
|
131
|
+
const { x: o, y: s, radius: p } = c;
|
|
132
|
+
t.arc(o, s, p, 0, 2 * Math.PI), r.visible && (t.globalAlpha = r.alpha * this.worldAlpha, t.fill()), h.visible && (t.globalAlpha = h.alpha * this.worldAlpha, t.stroke());
|
|
133
|
+
}
|
|
134
|
+
if (c instanceof T) {
|
|
135
|
+
const { x: o, y: s, width: p, height: f, radius: u } = c;
|
|
136
|
+
t.moveTo(o + u, s), t.arc(o + u, s + u, u, Math.PI * 1.5, Math.PI, !0), t.lineTo(o, s + f - u), t.arc(o + u, s + f - u, u, Math.PI, Math.PI / 2, !0), t.lineTo(o + p - u, s + f), t.arc(o + p - u, s + f - u, u, Math.PI / 2, 0, !0), t.lineTo(o + p, s + u), t.arc(o + p - u, s + u, u, 0, Math.PI * 1.5, !0), t.closePath(), r.visible && (t.globalAlpha = r.alpha * this.worldAlpha, t.fill()), h.visible && (t.globalAlpha = h.alpha * this.worldAlpha, t.stroke());
|
|
137
|
+
}
|
|
138
|
+
if (c instanceof I) {
|
|
139
|
+
const { x: o, y: s, radiusX: p, radiusY: f } = c;
|
|
140
|
+
t.ellipse(o, s, p, f, 0, 0, Math.PI * 2), r.visible && (t.globalAlpha = r.alpha * this.worldAlpha, t.fill()), h.visible && (t.globalAlpha = h.alpha * this.worldAlpha, t.stroke());
|
|
141
|
+
}
|
|
142
|
+
if (c instanceof S) {
|
|
143
|
+
const { points: o, closeStroke: s } = c;
|
|
144
|
+
t.moveTo(o[0], o[1]);
|
|
145
|
+
for (let p = 2; p < o.length; p += 2) t.lineTo(o[p], o[p + 1]);
|
|
146
|
+
s && t.closePath(), r.visible && (t.globalAlpha = r.alpha * this.worldAlpha, t.fill()), h.visible && (t.globalAlpha = h.alpha * this.worldAlpha, t.stroke());
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
buildBatches = (i) => {
|
|
151
|
+
this.startPoly(), this.worldId = this.transform.worldId, this.geometry.buildVerticesAndTriangulate();
|
|
152
|
+
const t = this.geometry.batchParts;
|
|
153
|
+
for (let e = 0; e < t.length; e++) {
|
|
154
|
+
const { style: n, vertexStart: l, vertexCount: y, indexStart: P, indexCount: b } = t[e], { color: m, alpha: d } = n, h = j(m, d * this.worldAlpha), r = L.get(this.type);
|
|
155
|
+
r.vertexCount = y, r.indexCount = b, r.rgba = h, r.vertexOffset = l, r.indexOffset = P, r.graphics = this, this.batches[e] = r, i.addBatch(this.batches[e]);
|
|
156
|
+
}
|
|
157
|
+
this.batchCount = t.length;
|
|
158
|
+
};
|
|
159
|
+
updateBatches = (i) => {
|
|
160
|
+
if (this.worldId !== this.transform.worldId) {
|
|
161
|
+
this.worldId = this.transform.worldId;
|
|
162
|
+
for (let t = 0; t < this.batchCount; t++) this.batches[t].updateVertices(i);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
export {
|
|
167
|
+
it as Graphics
|
|
168
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Shape } from
|
|
2
|
-
import type { Fill } from
|
|
3
|
-
import type { Line } from
|
|
1
|
+
import type { Shape } from "../shape/shape.js";
|
|
2
|
+
import type { Fill } from "../style/fill.js";
|
|
3
|
+
import type { Line } from "../style/line.js";
|
|
4
4
|
export declare class GraphicsData {
|
|
5
5
|
shape: Shape;
|
|
6
6
|
lineStyle: Line;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { GraphicsData } from
|
|
2
|
-
import { CustomFloatArray, CustomIntArray } from
|
|
3
|
-
import type { Point } from
|
|
4
|
-
import type { BatchPart } from
|
|
5
|
-
import type { Shape } from
|
|
6
|
-
import type { Fill } from
|
|
7
|
-
import type { Line } from
|
|
1
|
+
import { GraphicsData } from "./graphicsData.js";
|
|
2
|
+
import { CustomFloatArray, CustomIntArray } from "../render/utils/float.js";
|
|
3
|
+
import type { Point } from "../vertex/point.js";
|
|
4
|
+
import type { BatchPart } from "../render/utils/batch/index.js";
|
|
5
|
+
import type { Shape } from "../shape/shape.js";
|
|
6
|
+
import type { Fill } from "../style/fill.js";
|
|
7
|
+
import type { Line } from "../style/line.js";
|
|
8
8
|
export declare class GraphicsGeometry {
|
|
9
9
|
graphicsData: GraphicsData[];
|
|
10
10
|
private dirty;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { GraphicsData as e } from "./graphicsData.js";
|
|
2
|
+
import { CustomFloatArray as r, CustomIntArray as h } from "../render/utils/float.js";
|
|
3
|
+
import { buildVertices as l, triangulateFill as n, triangulateStroke as c } from "../render/utils/verticy.js";
|
|
4
|
+
var f = class {
|
|
5
|
+
graphicsData = [];
|
|
6
|
+
dirty = !1;
|
|
7
|
+
shapeIndex = 0;
|
|
8
|
+
batchParts = [];
|
|
9
|
+
vertices = new r();
|
|
10
|
+
indices = new h();
|
|
11
|
+
drawShape(i, t, a) {
|
|
12
|
+
const s = new e(i, t, a);
|
|
13
|
+
this.graphicsData.push(s), this.dirty = !0;
|
|
14
|
+
}
|
|
15
|
+
containsPoint(i) {
|
|
16
|
+
for (let t = 0; t < this.graphicsData.length; t++) {
|
|
17
|
+
const { shape: a, fillStyle: s } = this.graphicsData[t];
|
|
18
|
+
if (s.visible && a.contains(i))
|
|
19
|
+
return !0;
|
|
20
|
+
}
|
|
21
|
+
return !1;
|
|
22
|
+
}
|
|
23
|
+
buildVerticesAndTriangulate() {
|
|
24
|
+
if (this.dirty) {
|
|
25
|
+
this.dirty = !1;
|
|
26
|
+
for (let i = this.shapeIndex; i < this.graphicsData.length; i++) {
|
|
27
|
+
const t = this.graphicsData[i];
|
|
28
|
+
l(t), t.fillStyle.visible && n(t, this), t.lineStyle.visible && c(t, this);
|
|
29
|
+
}
|
|
30
|
+
this.shapeIndex = this.graphicsData.length;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
clear() {
|
|
34
|
+
this.graphicsData = [], this.vertices.clear(), this.indices.clear(), this.batchParts = [], this.shapeIndex = 0, this.dirty = !1;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
f as GraphicsGeometry
|
|
39
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Graphics } from
|
|
2
|
-
import { GraphicsData } from
|
|
3
|
-
import { GraphicsGeometry } from
|
|
1
|
+
import { Graphics } from "./graphics.js";
|
|
2
|
+
import { GraphicsData } from "./graphicsData.js";
|
|
3
|
+
import { GraphicsGeometry } from "./graphicsGeometry.js";
|
|
4
4
|
export { Graphics, GraphicsData, GraphicsGeometry };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Application } from
|
|
2
|
-
import { Container } from
|
|
3
|
-
import { Graphics } from
|
|
4
|
-
import { ColorAdjustFilter, Filter } from
|
|
5
|
-
import { WebGLRenderTarget } from
|
|
6
|
-
import { BYTES_PER_VERTEX, LINE_CAP, LINE_JOIN, MAX_VERTEX_COUNT, RENDERER_TYPE, SHAPE_TYPE } from
|
|
7
|
-
import type { IApplicationOptions, IFillStyleOptions, ILineStyleOptions } from
|
|
8
|
-
import type { ColorAdjustOptions } from
|
|
1
|
+
import { Application } from "./application.js";
|
|
2
|
+
import { Container } from "./vertex/container.js";
|
|
3
|
+
import { Graphics } from "./graphics/graphics.js";
|
|
4
|
+
import { ColorAdjustFilter, Filter } from "./render/filter.js";
|
|
5
|
+
import { WebGLRenderTarget } from "./render/renderTarget.js";
|
|
6
|
+
import { BYTES_PER_VERTEX, LINE_CAP, LINE_JOIN, MAX_VERTEX_COUNT, RENDERER_TYPE, SHAPE_TYPE } from "./enums.js";
|
|
7
|
+
import type { IApplicationOptions, IFillStyleOptions, ILineStyleOptions } from "./types.js";
|
|
8
|
+
import type { ColorAdjustOptions } from "./render/filter.js";
|
|
9
9
|
export { Application, Container, Graphics, Filter, ColorAdjustFilter, WebGLRenderTarget, SHAPE_TYPE, LINE_CAP, LINE_JOIN, RENDERER_TYPE, MAX_VERTEX_COUNT, BYTES_PER_VERTEX, };
|
|
10
10
|
export type { IApplicationOptions, IFillStyleOptions, ILineStyleOptions, ColorAdjustOptions };
|