-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af309e9
commit cf00db3
Showing
29 changed files
with
987 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
import { defineConfig } from "vite"; | ||
import react from "@vitejs/plugin-react"; | ||
|
||
import { createLogger } from "./vite/logger"; | ||
|
||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [react()], | ||
build: { | ||
chunkSizeWarningLimit: 4096 | ||
}, | ||
worker: { | ||
format: "es" // Default was "iife" but then import.meta.url for importing worker does not worker | ||
}, | ||
server: { | ||
headers: { | ||
"Cross-Origin-Opener-Policy": "same-origin", | ||
"Cross-Origin-Embedder-Policy": "require-corp", | ||
}, | ||
}, | ||
customLogger: createLogger() | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { createLogger as createViteLogger } from "vite"; | ||
|
||
|
||
export const createLogger = () => { | ||
// We create a custom logger in order to filter messages that are persistent | ||
const logger = createViteLogger(); | ||
const originalWarning = logger.warn; | ||
|
||
logger.warn = (msg, options) => { | ||
if (msg.includes('[plugin:vite:resolve]')) return; | ||
originalWarning(msg, options); | ||
}; | ||
return logger; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { CreativeEngine } from "@cesdk/cesdk-js"; | ||
|
||
export const createVectorPathBlocks = (engine: CreativeEngine, blocks: any[]) => { | ||
const blockIds = blocks.map((block: any) => { | ||
const id = createVectorPathBlock( | ||
engine, block | ||
) | ||
|
||
return id | ||
}) | ||
|
||
return engine.block.group(blockIds); | ||
} | ||
|
||
|
||
export const createVectorPathBlock = (engine: CreativeEngine, block: any) => { | ||
|
||
const path = block.shape.path | ||
const color = block.fill.color | ||
const blockId = engine.block.create("//ly.img.ubq/graphic"); | ||
engine.block.setKind(blockId, "shape"); | ||
const shape = engine.block.createShape("//ly.img.ubq/shape/vector_path"); | ||
engine.block.setShape(blockId, shape); | ||
|
||
engine.block.setString(shape, "vector_path/path", path); | ||
engine.block.setFloat(shape, "vector_path/width", block.transform.width); | ||
engine.block.setFloat(shape, "vector_path/height", block.transform.height); | ||
|
||
const fill = engine.block.createFill("color"); | ||
engine.block.setColor(fill, "fill/color/value", { r: color[0], g: color[1], b: color[2], a: color[3] }); | ||
engine.block.setFill(blockId, fill); | ||
engine.block.setFloat(blockId, "width", block.transform.width); | ||
engine.block.setFloat(blockId, "height", block.transform.height); | ||
engine.block.setPositionX(blockId, block.transform.x) | ||
engine.block.setPositionY(blockId, block.transform.y) | ||
return blockId; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.