my question is, fabric.js makes active object on top of others when dragging.
I know a property can do this, can't remind.
Thanks.
You can do it like this:
canvas.add(red, blue); // add youre objects..
function myDrag(e) { // funciton on drag (moving)
e.target.bringToFront();
}
canvas.on({
'object:moving': myDrag,
});
Want to add more events? Use the Event inspector # fabricjs
I made a working Fiddle. Hopes it helps...
I know it's been a long time since you asked this but I want to answer it if anyone would stuck for that.
This behavior is default in fabric js right know but if you want to change it just set preserveObjectStacking to false when initializing the canvas. See more in documentation.
Related
I am using a UICollectionView in C# Xamarin ios and sometimes all of the cells will disappear from the screen. This happens normally on a scroll and I have to re-invoke the view that my UICollection View is on.
I can't show my exact code as this is a project that I am working on but the initialization basics look a little like this:
Bounds screenBounds = screen.Bounds
UICollectionViewFlowLayout layout = new UICollectionViewFlowLayout();
UICollectionView collectionView = new UICollectionView(layout, bounds)
I initialize a few other things like source and register cell and also add separation and border styles.
I have been also getting an error about a view not being in the hierarchy don't know if this has anything to do with it.
I do return the collectionView at the end and will add this returned value to my template which has a scroll view in which I add the UICollectionView to.
May I also mention I don't use any of the StoryBoard and am using a DuqueReusable cell in my collection view source.
I have been stuck on this for ages so thank you in advance for anyone who can give me any sort of tips or answers to this question.
Insure you make any changes to ItemsSource or to cells data on UI thread only, otherwise you might obtains an uncatchanble async crash and you'll end up with an empty view.
Device.BeginInvokeOnMainThread(() => {
// do your stuff
});
The current behavior of the sidemenu in Codename One is that the sidemenu pushes the current form aside as it comes out. I need to have the sidemenu slide over the form without displacing it instead.
It appears that the only options are to modify the underlying code for the sidemenu or to utilize some other component in a way that would mimic sidemenu behavior. From a conversation I had with CN1 support, modifying the underlying code sounds problematic and I haven't been happy with the results thus far of layering other components on top of the form.
Has anyone else been able to successfully implement this functionality? if so, can you please share how it was done?
Thanks!
I would hope we can do that for you but scheduling is making this really challenging. If all else fails try avoiding the sidemenu altogether and using a Container in the layered pane or alternatively a full blown InteractionDialog to simulate a sidemenu.
I'm new in fabricjs. I'm expecting to draw a line with a circle moving on it.
I found this Demo quite useful, but I have no idea why the crosses are not animating. I think that they are supposed to change their size.
So can anyone tell me how to fix this demo? Or is there anything I've done wrong?
Thanks.
fabricjs 1.7.0 introduced object caching. It would appear that in the animation demo the crosses are being redrawn from the cache, so they don't update. For a quick and dirty solution, if you disable caching (by setting objectCaching to false) at an object level, the demo works again. Alternatively, you can set the dirty flag on each object to let it know that the object has changed. For example, in the timeout from the demo, just modify it slightly:
canvas.forEachObject(function(obj){
obj.animateWidthHeight();
obj.dirty = true;
});
http://jsfiddle.net/7gvJG/139/
i want to manually trigger *select object on the canvas event * - the same event that fires when a mouse click was made within an object area, and the object become selected - the controls become visible.
so in other words, i want to show controls for a specified object on the canvas MANUALLY, without user/mouse interaction. any help ?
solution was found in the docs.
if someone looking for the answer -
fabric.Canvas.setActiveObject(fabric.Object) ...
how the solution was found:
i understood that the wrong thinking was to look after the event that precedes the 'object:selected', but there is no such event !!! so i realized that all what i had to do is just look in the code for 'object:selected' and that's how i found which method fires it ... also it is well documented here, in docs .
suggestion: would be great to note about it in the articles - next to getActiveObject / Group . currently it appears only here - http://fabricjs.com/customization/
anyway, cangax and others participators - like very much your work !
thanks
I have created a wxGrid with custom table. Whenever the user scrolls down to very bottom of the grid, I have to load the next 100 rows from my table. I tried EVT_SCROLL_BOTTOM() but I am not able to detect it. What is the right thing to do? Thanks.
I don't know the answer to your question but I am reminded that the grid was designed to work with an object of type wxGridTableBase that can be extended by the application. By extending this class, you should be able to do whatever caching you want inside of the extended object.
You could bind the scroll win event for the grid. I have encountered almost the same requirement as you. :)
self.Bind(wx.EVT_SCROLLWIN, self.OnScroll)