-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(redo-undo): change textureInspector->wrap,filter should add to re…
…do-undo update wonder.js version
- Loading branch information
Showing
17 changed files
with
704 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...m_component/texture_Inspector/eventHandler/InspectorChangeTextureMagFilterEventHandler.re
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module CustomEventHandler = { | ||
include EmptyEventHandler.EmptyEventHandler; | ||
type prepareTuple = unit; | ||
type dataTuple = (Wonderjs.ComponentType.component, int); | ||
type return = unit; | ||
|
||
let handleSelfLogic = | ||
((uiState, dispatchFunc), (), (textureComponent, value)) => { | ||
TextureFilterUtils.changeMagFilter(textureComponent, value); | ||
|
||
(); | ||
}; | ||
|
||
let setUndoValueToCopiedEngineState = | ||
((uiState, dispatchFunc), (), (textureComponent, value)) => | ||
StateEngineService.unsafeGetState() | ||
|> StateEngineService.deepCopyForRestore | ||
|> BasicSourceTextureEngineService.setIsNeedUpdate(true, textureComponent); | ||
}; | ||
|
||
module MakeEventHandler = EventHandler.MakeEventHandler(CustomEventHandler); |
21 changes: 21 additions & 0 deletions
21
...m_component/texture_Inspector/eventHandler/InspectorChangeTextureMinFilterEventHandler.re
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module CustomEventHandler = { | ||
include EmptyEventHandler.EmptyEventHandler; | ||
type prepareTuple = unit; | ||
type dataTuple = (Wonderjs.ComponentType.component, int); | ||
type return = unit; | ||
|
||
let handleSelfLogic = | ||
((uiState, dispatchFunc), (), (textureComponent, value)) => { | ||
TextureFilterUtils.changeMinFilter(textureComponent, value); | ||
|
||
(); | ||
}; | ||
|
||
let setUndoValueToCopiedEngineState = | ||
((uiState, dispatchFunc), (), (textureComponent, value)) => | ||
StateEngineService.unsafeGetState() | ||
|> StateEngineService.deepCopyForRestore | ||
|> BasicSourceTextureEngineService.setIsNeedUpdate(true, textureComponent); | ||
}; | ||
|
||
module MakeEventHandler = EventHandler.MakeEventHandler(CustomEventHandler); |
21 changes: 21 additions & 0 deletions
21
.../atom_component/texture_Inspector/eventHandler/InspectorChangeTextureWrapSEventHandler.re
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module CustomEventHandler = { | ||
include EmptyEventHandler.EmptyEventHandler; | ||
type prepareTuple = unit; | ||
type dataTuple = (Wonderjs.ComponentType.component, int); | ||
type return = unit; | ||
|
||
let handleSelfLogic = | ||
((uiState, dispatchFunc), (), (textureComponent, value)) => { | ||
TextureWrapUtils.changeWrapS(textureComponent, value); | ||
|
||
(); | ||
}; | ||
|
||
let setUndoValueToCopiedEngineState = | ||
((uiState, dispatchFunc), (), (textureComponent, value)) => | ||
StateEngineService.unsafeGetState() | ||
|> StateEngineService.deepCopyForRestore | ||
|> BasicSourceTextureEngineService.setIsNeedUpdate(true, textureComponent); | ||
}; | ||
|
||
module MakeEventHandler = EventHandler.MakeEventHandler(CustomEventHandler); |
21 changes: 21 additions & 0 deletions
21
.../atom_component/texture_Inspector/eventHandler/InspectorChangeTextureWrapTEventHandler.re
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module CustomEventHandler = { | ||
include EmptyEventHandler.EmptyEventHandler; | ||
type prepareTuple = unit; | ||
type dataTuple = (Wonderjs.ComponentType.component, int); | ||
type return = unit; | ||
|
||
let handleSelfLogic = | ||
((uiState, dispatchFunc), (), (textureComponent, value)) => { | ||
TextureWrapUtils.changeWrapT(textureComponent, value); | ||
|
||
(); | ||
}; | ||
|
||
let setUndoValueToCopiedEngineState = | ||
((uiState, dispatchFunc), (), (textureComponent, value)) => | ||
StateEngineService.unsafeGetState() | ||
|> StateEngineService.deepCopyForRestore | ||
|> BasicSourceTextureEngineService.setIsNeedUpdate(true, textureComponent); | ||
}; | ||
|
||
module MakeEventHandler = EventHandler.MakeEventHandler(CustomEventHandler); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
src/service/state/engine/state/RestoreStateEngineService.re
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
let _isTextureParametersDifferent = (texture, currentState, targetState) => | ||
BasicSourceTextureEngineService.getWrapS(texture, currentState) | ||
!== BasicSourceTextureEngineService.getWrapS(texture, targetState) | ||
|| | ||
BasicSourceTextureEngineService.getWrapT(texture, currentState) !== BasicSourceTextureEngineService.getWrapT( | ||
texture, | ||
targetState, | ||
) | ||
|| | ||
BasicSourceTextureEngineService.getMagFilter(texture, currentState) !== BasicSourceTextureEngineService.getMagFilter( | ||
texture, | ||
targetState, | ||
) | ||
|| | ||
BasicSourceTextureEngineService.getMinFilter(texture, currentState) !== BasicSourceTextureEngineService.getMinFilter( | ||
texture, | ||
targetState, | ||
); | ||
|
||
let _getBasicSourceTexturesNeedUpdate = (currentState, targetState) => | ||
ArrayService.intersect( | ||
BasicSourceTextureEngineService.getAllTextures(currentState), | ||
BasicSourceTextureEngineService.getAllTextures(targetState), | ||
) | ||
|> Js.Array.filter(texture => | ||
_isTextureParametersDifferent(texture, currentState, targetState) | ||
); | ||
|
||
let _markBasicSourceTextureNeedUpdate = | ||
(basicSourceTexturesNeedUpdate, restoredState) => | ||
basicSourceTexturesNeedUpdate | ||
|> WonderCommonlib.ArrayService.reduceOneParam( | ||
(. restoredState, texture) => | ||
BasicSourceTextureEngineService.setIsNeedUpdate( | ||
true, | ||
texture, | ||
restoredState, | ||
), | ||
restoredState, | ||
); | ||
|
||
let restoreState = (currentState, targetState) => { | ||
let basicSourceTexturesNeedUpdate = | ||
_getBasicSourceTexturesNeedUpdate(currentState, targetState); | ||
|
||
Wonderjs.StateAPI.restoreState(currentState, targetState) | ||
|> _markBasicSourceTextureNeedUpdate(basicSourceTexturesNeedUpdate); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
let deepCopyForRestore = Wonderjs.StateAPI.deepCopyForRestore; | ||
|
||
let createState = Wonderjs.StateAPI.createState; | ||
|
||
let createStateData = Wonderjs.StateAPI.createStateData; | ||
|
||
let getStateFromData = Wonderjs.StateAPI.getStateFromData; | ||
|
||
let unsafeGetState = Wonderjs.StateAPI.unsafeGetState; | ||
|
||
let setStateToData = Wonderjs.StateAPI.setStateToData; | ||
|
||
let setState = Wonderjs.StateAPI.setState; | ||
|
||
let setIsDebug = Wonderjs.StateAPI.setIsDebug; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.