create-background-plugin.ts 462 B

123456789101112131415
  1. import { definePluginCreator } from '@flowgram.ai/core';
  2. import { BackgroundConfig, BackgroundLayer, BackgroundLayerOptions } from './background-layer';
  3. /**
  4. * 点位背景插件
  5. */
  6. export const createBackgroundPlugin = definePluginCreator<BackgroundLayerOptions>({
  7. onBind: (bindConfig, opts) => {
  8. bindConfig.bind(BackgroundConfig).toConstantValue(opts);
  9. },
  10. onInit: (ctx, opts) => {
  11. ctx.playground.registerLayer(BackgroundLayer, opts);
  12. },
  13. });