Comments (6)
Hey this is working great now! thanks very much for looking into this. I think my problem was cached modules. after removing them and reinstalling it all worked fine.
from fabric-history.
Hi,
Thank you ! Each operation is a history point. Your code will trigger the history event separately. Therefore, the undo operation is working separately. FabricJS doesn't have 'removeAll' function for your expectation. Maybe we can do a trick about this one but I have to do some research.
from fabric-history.
I think i understand. Would you expect the undo to have to be peformed twice for a case where two objects where deleted in one delete?
from fabric-history.
Yes, because you are looping through them. I will try to implement history toggle for such kind of needs. And, it would fit for this situation.
from fabric-history.
Hello again,
I have implemented the on/off history functions in 1.6.0. You may use like this,
function removeActiveObject() {
const activeObjects = canvas.getActiveObjects();
// remove objects
if (activeObjects.length > 0) {
canvas.offHistory();
for (var i = 0; i < activeObjects.length; i++) {
if (!activeObjects[i].isEditing) {
canvas.remove(activeObjects[i]);
}
}
canvas.onHistory();
}
}
I think this is what you need !
from fabric-history.
Hi sorry for the late reply. Thanks for looking into this! I think im not following is the onHistory / offHistory an implementation of fabricjs or fabric-history as im getting an error for undefined.
from fabric-history.
Related Issues (20)
- moveTo(Object, index) does not trigger history:append
- Way to selectively turn off adding to history? HOT 5
- Check History HOT 2
- New History Path HOT 1
- Trigger history save on Text color change HOT 1
- Issue with history when video element is added
- History limit HOT 1
- Selectable items become non selectable when editing a text HOT 2
- Uncaught TypeError: canvas.undo is not a function HOT 2
- Create an ability to store custom properties HOT 2
- Preserve selected objects on each state when undo/redo
- custom added properties are removed HOT 2
- [Bug] Undo after first drawing on a Canvas with background image set not working properly HOT 2
- Non-Selectable objects still get selectable eventually HOT 2
- Insufficient Granularity of Access Control in JSDom - https://github.com/advisories/GHSA-f4c9-cqv8-9v98 HOT 2
- Clear canvas isn't part of the history HOT 3
- Undo/Redo functions are removing 2 objects at same time HOT 2
- Undo after setting scaled background image ends in white space in the right corner.
- Keep objects selected after undo/redo
- when load from json it removes all items on undo but I want initial json HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fabric-history.