Cursor tracking is not immediately updated in the intersection window - ocean

I have implemented a toggle window that updates the world cursor on mouse move events with the following statement:
PetrelProject.ToggleWindows.WorldCursor.SetPosition(world, Domain.TVD_PRE, path.Trajectory);
The cursor is immediately updated in the 3D window, but the Intersection/Map window is not working properly. I have to force an update of the intersection window by manually moving the cursor outside my graphical canvas (ZedGraph). I can also force an update programmatically by the following statement in my mouse move event handler:
TopLevelControl.Refresh();
Unfortunately the latter is very performance costly and make the cursor tracking sluggish. To me it looks like a bug in Petrel (2016). Is there a better workaround for this then the one I am using?

Related

Avalonia : Multiscreen - opening a window with negative x-value (on left monitor) fails to work

Situation : Avalonia 0.10.18, Windows 11, 3 (same) monitors, NET6.0.
I have a 'main' window on the middle screen and I use a second (floating) window for some common values (with 'main' as parent). I save the position of the second 'floating' window on closing and on 'OnOpened' I read the values and position the window accordingly. That works fine as long as the floating window was not on the left monitor (negative X-value)(so all X-positions on middle and right work fine).
Since this second window has the main window as parent, the X-value is thus negative and I presume that is to prevent windows from being out of the screen area.
A last fact, but I doubt that that has to do with it, is that I'm using windowless windows, but the custom made positioning works correct in all cases (even on the left monitor).
Since in absolute values my 'floating' window is not out of the screen area and I do not know if I'm perhaps using a wrong event or is this rather a bug ?
OK, Sorry, my bad. I had in an upper class window a rule set that if the left < 0, not to use that value at the startup of the window.
So, it was a bug in my code and not in the Avalonia code !

How can you keep the current line centered vertically in the editor

I've searched all the settings and Google but can find nothing. It seems such an obvious feature. If I use the arrow keys to scroll vertically through the code, I quickly end up with the cursor at the top or bottom of the screen whereas I really want to be doing my editing near the centre of the screen, which means I have to do two operations: scroll the code to where I want it and then move the cursor.
What I want is to hit a shortcut (e.g. the Scroll Lock key) and then when I press up- or down-arrow the cursor stays where it is (relative to the screen) and the code scrolls past it.
I've read that some tools allow you to set the number of "always visible" lines above and below the cursor which would do the job, but I can't find that in Rider either.
Am I missing something obvious, or is there an add-in or something I can customize to get what I want?
Found it! There are Move Up and Scroll and Move Down and Scroll actions in the keymap settings. Assign hotkeys to them (weren't assigned in my config) and it will work like you described it.

CreateJS pressup/click won't trigger when target movie is played on mousedown/pressmove

I have a project where I need to make flash movie as an interactive game. Because, flash is already (or soon will be) obsolete for most of browsers, I've decided this game must be based on HTML5/JS. Because most of the graphics and animations are already done in this Flash movie (and I have its source), I'm developing it using Adobe Flash and CreateJS technology (HTML5 + Canvas + JS). So far, I like this solution pretty much, though I have an issue which I could not solve yet.
The game is a simple drag&drop matching game. The problem I have is shortly described in the question title and I will try to explain it here more detailed:
label.on('mousedown', function() {
//this.image.bg.gotoAndStop(2);
});
label.on('pressmove', function(evt) {
this.x = getStageX(evt.stageX);
this.y = getStageY(evt.stageY);
currentStage.setChildIndex(this, currentStage.getNumChildren() - 1);
stage.update();
});
label.on('pressup', function(evt) {
console.log('Hi! I'm mouseup event!')
this.x = labelInitX;
this.y = labelInitY;
this.image.bg.gotoAndStop(0);
});
Above, you can see simplified 3 event handlers I use. Everything is working fine until I uncomment second line - //this.image.bg.gotoAndStop(2);. When I do this, the pressup event does not trigger mostly, which is rather strange, because some times it does trigger (2-3 times out of 10), so the label sticks with the pointer until I press the button again.
Is this some bug or I simply does not understand something about the CreateJS and its event handlers. I tried different combinations of this. Used click instead of pressup, placing this.image.bg.gotoAndStop(2); inside the pressmove handler. Replacing pressmove handler with the stage.on('stagepressmove', handler). None did not work. this.image.bg.gotoAndStop(2); - this thing simply updates the timeframe (change the background image of the label). I do can change this image programatically (without playing timeframes) and I'm almost sure that the issue will be fixes, though I'd like to understand for myself what is wrong here or what I'm doing wrong with the event handlers.
Another, less important thing, but would be useful to know is why when pressmove event is running, the CreateJS objects stop receiving event triggers about rollover or mouseover? In DOM, by default event bubbling is working until you stop it with stopPropagation. How does it work here with CreateJS? Seems that bubbling is simply turned off here by default. How can I turn it on?
I thought I might shed some light on what I think is going on.
The normal mouse events "click", "mouseup", "rollover", "rollout", etc all function by the stage determine what the "target" of the mouse event was by default the target is the lowest-level thing that is interacted with. If you contents change while the mouse is down, it will not count as the same target when the mouseup occurs. Since positions are not re-checked without moving the mouse, the mouseover, mouseout, rollover, and rollout events may function oddly as well.
Conversely, the "pressmove" and "pressup" events do not care what is under the mouse once something is pressed. The target will always be what was pressed, which allows you to move the mouse out of the object (or even remove it), and still receive events from it. This also ensures that you receive a pressup event even if you release outside the object.
As #RandyPrad mentioned, the hitArea may solve your issue. By specifying a hit area, you are overriding the contents of your clip, so your target should always be the container (MovieClip) instead of its contents. That way no matter what is pressed inside the movieclip, it is the same target when you release. You can also get the same effect using the mouseChildren property.
movieClip.mouseChildren = false;
Hope that helps!
Please check your hit area of the button.
i think that your are playing image inside the btn is animating
please use this link http://www.createjs.com/tutorials/Mouse%20Interaction/hitArea.html

Movable objects around a wxPanel

In wxWidgets, I would like to have 2 objects on a wxPanel joined by a line and with a mouse down event to relocate the position of either of the 2 objects (The line should automatically be redrawn to follow the new position of the objects). I have tried using wxPaintDC to draw the initial position of the 2 objects (Custom created with mouse click events) and using dc.DrawLine to join these 2 objects together with a line. How should I proceed to allow make those 2 objects movable (mouse down event) along with the line? Can this even be achieve?
Of course it's possible (just about everything is, it's "only" a matter of effort), but it's not completely trivial and you may want to use OGL which does it for you. On the flip side, OGL is very old and completely unmaintained since a long time, so if your needs are really simple, it's probably still better to do it yourself.
If you do, here are some hints:
For mouse handling, you first need an (efficient if possible) hit testing function.
Once you have it, it's easy to detect where a click happens and what object is under it and start moving it if it makes sense. To be more user friendly, the move shouldn't start immediately, but wait until either the mouse moves a little, or stays pressed for some longer time (this will avoid accidental moves).
When the user is dragging the mouse you will get wxEVT_MOTION events. Use wxMouseEvent::Dragging() in your handler to check whether any mouse button is pressed.
Whatever you do, you must always draw from your wxEVT_PAINT handler, i.e. if an object moves, you must not redraw it immediately, but update its position, invalidate the area taken by it before and after the move (invalidating everything is simpler, but less efficient) and draw it from your OnPaint().
You want double buffering to avoid flicker, see wxAutoBufferedPaintDC

How do I change windows skin in api

I really wonder how winamp did it. I tried to change a drawing code to draw on title bar at ncpaint. it was run well but it was complex and it didn't draw,choosing another window.
I searched some source code or article but they used other ways... how do I do it?...
Well, Winamp just creates a borderless, decorationless window, and draws everything itself. Important is, that you still can attach a sysmenu to the window, so that a right click on the taskbar button gives the usual options.
If you want to get fancy you can process the WM_NCPAINT message to perform frame and title drawing yourself on a decorated window: http://msdn.microsoft.com/en-us/library/windows/desktop/dd145212(v=vs.85).aspx
But the easier solution actually is to just emulate the standard Windows decorations and synthesize the events the standard buttons do.