ibp按钮
This commit is contained in:
parent
d75f020bde
commit
908d8094d6
@ -1,4 +1,9 @@
|
|||||||
import { GraphicDrawAssistant, IDrawApp } from 'src/jl-graphic';
|
import {
|
||||||
|
GraphicDrawAssistant,
|
||||||
|
GraphicInteractionPlugin,
|
||||||
|
IDrawApp,
|
||||||
|
JlGraphic,
|
||||||
|
} from 'src/jl-graphic';
|
||||||
import { IBPButton, IBPButtonTemplate, IIBPButtonData } from './IBPButton';
|
import { IBPButton, IBPButtonTemplate, IIBPButtonData } from './IBPButton';
|
||||||
import { FederatedMouseEvent, Point } from 'pixi.js';
|
import { FederatedMouseEvent, Point } from 'pixi.js';
|
||||||
|
|
||||||
@ -14,6 +19,7 @@ export class IBPButtonDrawAssistant extends GraphicDrawAssistant<
|
|||||||
'svguse:../../drawIcon.svg#icon-psl-button',
|
'svguse:../../drawIcon.svg#icon-psl-button',
|
||||||
'IBP按钮'
|
'IBP按钮'
|
||||||
);
|
);
|
||||||
|
IBPButtonInteraction.init(app);
|
||||||
}
|
}
|
||||||
get ibpButton(): IBPButton {
|
get ibpButton(): IBPButton {
|
||||||
if (!this._ibpButton) {
|
if (!this._ibpButton) {
|
||||||
@ -37,3 +43,26 @@ export class IBPButtonDrawAssistant extends GraphicDrawAssistant<
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class IBPButtonInteraction extends GraphicInteractionPlugin<IBPButton> {
|
||||||
|
static Name = 'ibp_button_transform';
|
||||||
|
constructor(app: IDrawApp) {
|
||||||
|
super(IBPButtonInteraction.Name, app);
|
||||||
|
}
|
||||||
|
static init(app: IDrawApp) {
|
||||||
|
return new IBPButtonInteraction(app);
|
||||||
|
}
|
||||||
|
filter(...grahpics: JlGraphic[]): IBPButton[] {
|
||||||
|
return grahpics.filter((g): g is IBPButton => g instanceof IBPButton);
|
||||||
|
}
|
||||||
|
bind(g: IBPButton): void {
|
||||||
|
g.eventMode = 'static';
|
||||||
|
g.cursor = 'pointer';
|
||||||
|
g.scalable = true;
|
||||||
|
g.rotatable = true;
|
||||||
|
}
|
||||||
|
unbind(g: IBPButton): void {
|
||||||
|
g.eventMode = 'none';
|
||||||
|
g.scalable = false;
|
||||||
|
g.rotatable = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user