//可以添加和删除对象的基类(每个添加和删除可以撤消)。
struct Undoable{
pub isUndone:bool,//此实体是否在撤消内存中且未处于活动状态?
pub undoableType:bool,//=false,//可撤消项的类型标识,如实体、图层
pub undoStateChanged:fn(is_undone:bool)->(),
}
impl Undoable{
pub fn new(is_undone:bool,undoable_type:bool,undo_state_changed:fn(bool)->()){
Undoable{
isUndone:is_undone,
undoableType:undoable_type,
undoStateChanged:undo_state_changed,
}
}
pub fn setUndone(&self , undone:bool){
if self.isUndone!=undone {
self.isUndone=undone;
undoStateChanged();
}
}
}
【从头写CAD】为撤销修改和重做服务的类
最新推荐文章于 2024-10-31 13:59:14 发布