I'm writing paint application in javascript (typescript)
my Command interface is showed here:
export interface IUndoableCommand extends ICommand {
GetUndoCommand(): ICommand;
}
export interface ICommand {
Process(surface: ds.ICanvas): void;
}
so each command receive an ICanvas interface which let this command manipulate pixels of image.
My question is, According with this command, where should I put all the time changing mouse points to let the command know where it must draw?
- Instantiate new command each time mouse cursor position changed?
-
When instanting new command object, maybe I should pass lambda expression such as this:
new DrawRectCommand(() => ut.Point { return Mouse.GetCurrentMousePoint(); }, () => ut.Point { ... });
I fell it's more general problem becouse I would need pass more point's than the current one. But how to do it properly?
Aucun commentaire:
Enregistrer un commentaire