How to use the @deja-js/component/tiles.DejaTile function in @deja-js/component

To help you get started, we’ve selected a few @deja-js/component examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DSI-HUG / dejajs-components / src / app / tiles / tiles-demo.ts View on Github external
map((country) => {
                const tile = new DejaTile();
                tile.percentBounds = new Rect(x1, y1, 15, 15);
                tile.color = country.color;
                tile.templateModel = country;

                x1 += 15;
                if (x1 + 15 > 100) {
                    x1 = 0;
                    y1 += 15;
                }

                // Map for drag and drop
                this.countriesMap.set(tile.id, country);

                return tile;
            }),
            reduce((acc: DejaTile[], cur: DejaTile) => [...acc, cur], []));
github DSI-HUG / dejajs-components / src / app / tiles / tiles-demo.ts View on Github external
map((country) => {
                const tile = new DejaTile();
                tile.percentBounds = new Rect(x2, y2, 15, 15);
                tile.color = country.color;
                tile.templateModel = country;

                x2 += 15;
                if (x2 + 15 > 100) {
                    x2 = 0;
                    y2 += 15;
                }

                return tile;
            }),
            reduce((acc: DejaTile[], cur: DejaTile) => [...acc, cur], []));
github DSI-HUG / dejajs-components / src / app / tiles / tiles-demo.ts View on Github external
dragStart: (target) => {
                const country = this.countriesMap.get(target.id);
                const tile = new DejaTile();
                tile.percentBounds = new Rect(0, 0, 15, 15);
                tile.color = country.color;
                tile.templateModel = country;

                return {
                    country: country,
                    DejaTile: tile,
                };
            },
        } as IDejaMouseDraggableContext;