undo-redo

ANDROID - Undo and Redo in canvas

耗尽温柔 提交于 2019-12-23 22:12:33
问题 I am drawing a circle (on touch) on bitmap to erase the overlay bitmap for that area in the circle.How do I add undo and redo functionality for this? EDIT:Please refer Android: Undo redo in CustomView as it has the problem I'm currently facing with the given solution. @Override protected void onDraw(Canvas canvas) { pcanvas.drawCircle(x, y, 10, mPaint); canvas.drawBitmap(bitmap, 0, 0, null); super.onDraw(canvas); } onTouchEvent public boolean onTouchEvent(MotionEvent ev) { switch (ev

How to increase undo and redo steps in android studio [duplicate]

人盡茶涼 提交于 2019-12-21 20:42:34
问题 This question already has answers here : Android Studio - increase the amount of undos (2 answers) Closed 3 years ago . How to increase undo and redo steps in android studio? It is limited and I want to increase number of Ctrl Z time. 回答1: Press Ctrl + Shift + A and Go to Enter action menu. Type registry , you can see the suggestion Registry on list and click on that. Now just type word undo . It automatically find for you the 'undo' options. By default documentUndoLimit = 100 and

How to implement undo/redo with programatic change of the textValue of a NSTextView?

烂漫一生 提交于 2019-12-21 08:13:28
问题 I created a simple demo app with a NSTextView and a button, the provided a NSTextViewDelegate to the textView and added an action: - (IBAction)actionButtonClicked:(id)sender { NSString *oldText = [[[self.textView textStorage] string] copy]; NSString *newText = @"And... ACTION!"; [[self.textView undoManager] registerUndoWithTarget:self.textView selector:@selector(setString:) object:oldText]; [[self.textView undoManager] setActionName:@"ACTION"]; [self.textView setString:newText]; } Undo/redo

Command Pattern for undo/redo in paint application

廉价感情. 提交于 2019-12-20 14:41:34
问题 I would like to implement undo/redo in a small paint application. It seems the Command Pattern fits the use nicely, but I am unsure how to best implement it. As I understand the pattern, it is necessary to include in each command: The details of the paint operation for purposes of redo (e.g. Line -> start & end points, free form line -> GeneralPath ) The state of the component prior to the change for undo. In this case, that will be a small snapshot image of the area affected by the command.

Implementing undo / redo in Redux

浪子不回头ぞ 提交于 2019-12-20 09:37:53
问题 Background For a while now I've been wracking my brain as to how you would implement undo / redo in Redux with server interactions (via ajax). I've come up with a solution using a command pattern where actions are registered with an execute and undo method as Commands, and instead of dispatching actions you dispatch commands. The commands are then stored in a stack and raise new actions where required. My current implementation uses middleware to intercept dispatches, test for Commands and

How to configure IntelliJ (also Android Studio) redo shortcut to CTRL+Y instead of CTRL+SHIFT+Z?

不羁的心 提交于 2019-12-20 08:11:48
问题 The default IntelliJ / Android Studio "Redo" action shortcut is CTRL + Shift + Z and this is a common problem for Windows users. A bigger problem is CTRL + Y is mapped to the "Delete line" action - and this causes the undo stack to be lost. To solve this issue, how can the "Redo" shortcut be changed to CTRL + Y in IntelliJ? 回答1: Open Settings (press CTRL + ALT + S ) Click Keymap on the left list. There is a combobox that contains keymaps. Select one of them (default means IntelliJ of course.

Do we have canvas Modified Event in Fabric.js?

99封情书 提交于 2019-12-19 02:55:24
问题 In Fabric.js we have Object modified events like object:modified. Do we have similar event for the entire canvas. Actually I am trying to implement undo and redo features. I am saving the canvas as JSON if something happens on it and loading it again for undo feature. Do we have any better solution for this features in Fabric.js? 回答1: This is better explained in this link. Use it this way: canvas.on('object:moving', function(e) { // or 'object:added' var activeObject = e.target; console.log

Undo/Redo with immutable objects

こ雲淡風輕ζ 提交于 2019-12-18 16:48:40
问题 I read the following in an article Immutable objects are particularly handy for implementing certain common idioms such as undo/redo and abortable transactions. Take undo for example. A common technique for implementing undo is to keep a stack of objects that somehow know how to run each command in reverse (the so-called "Command Pattern"). However, figuring out how to run a command in reverse can be tricky. A simpler technique is to maintain a stack of immutable objects representing the

Implementing the command pattern

谁说我不能喝 提交于 2019-12-18 14:48:28
问题 I am in the design process of an application, and I would like to use the command pattern for undo/redo purposes. I did some research into the command pattern but the only thing I don't get is: Should a command have the undo and redo methods, or should I make two separate commands, one for undo and one for redo, and call those from the main command itself? 回答1: The command object itself should implement the undo / redo functionality. The commands are generally pushed and popped from a stack

How to undo / redo selective parts of code?

风流意气都作罢 提交于 2019-12-18 07:16:06
问题 I am using Eclipse. It happens a lot when we develop code like this (assume it is developed sequentially, from top to bottom): Part 1 (*) Part 2 Part 3 Part 4 (*) Part 5 But we just figured out that parts 1 and 4 (marked with (*)) are wrong and the others are just fine. The question is that how we can undo just those two parts (1 and 4) without undoing the rest? If we could undo selectively, it was great. Note that simply reverting the code to the version 1 loses parts 2, 3 and 5 which are