devexpress-diagram
Version:
DevExpress Diagram Control
17 lines (15 loc) • 629 B
text/typescript
import { SimpleCommandBase } from "../SimpleCommandBase";
import { SimpleCommandState } from "../CommandStates";
export class ChangeSnapToGridCommand extends SimpleCommandBase {
executeCore(state: SimpleCommandState, parameter?: any): boolean {
const newValue = parameter === undefined ? !this.control.settings.snapToGrid : !!parameter;
if(this.control.settings.snapToGrid !== newValue) {
this.control.settings.snapToGrid = newValue;
return true;
}
return false;
}
getValue(): boolean {
return this.control.settings.snapToGrid;
}
}