I have constructed a volume slider in flash CC and published to createjs but when I drag the Nob inside the slider the Nob position is offset from the mouse position by the Slider.x position. I have looked at all of the examples on this site and I believe that this can be fixed by using either localToGlobal or globalToLocal but so far I have not been able to work out how to do this.
My project is using the following library "http://code.createjs.com/easeljs-0.7.1.min.js" and the java script code to control the slider is as follows
this.Slider.Nob.addEventListener("pressmove",VolumeDrag);
function VolumeDrag(event){
event.currentTarget.x = Math.min(230, Math.max(0, event.stageX));
}
Any help with this would be appreciated.
Related
My game require constant update of a var with a drag gesture postion as my finger is moving on the touch sreen please help as im pretty new to programming.
By default, when you touch the screen, Godot interprets that as a mouse motion, so to get the position whenever the user has their finger on the screen you can do:
func _input(event):
if event is InputEventMouseMotion:
gesturePostion = event.position
Now you have the variable 'gesturePostion' which stores the position of your finger on the screen as a Vector2. Just make sure you've defined 'gesturePostion' as a global variable (you can do that by defining the variable outside any function).
I have developed an application in PyQt5 that displays an image and allows the user to pan the image using the mouse and zoom using the mouse wheel. I now need to add the functionality to show popup text associated to specific parts of the displayed image. While painting the text directly on to the QGraphicsScene is a possibility, the range of zooms that are commonly used means that the text will be much too small when zoomed out, or much too large when zoomed in.
I would like to achieve a way of placing the QGraphicsTextItem widgets at a static location that is not affected by the pan and zoom. This way, they can be statically located around the perimiter of the QGrapicsView, and I can draw a line from the text box to the position in the scene. My problem is that I cannot find a way to place the text items so they are independant of the QGraphicsScene. I am thinking that I should have the text items external to the scene, and place the QGraphicsView and any text boxes in a parent QObject. I cannot figure out if this is the best method, and have had limited success with trying to connect a line from QGraphicsElipsesItem that marks the position on the image, to a QLabel in the parent QObject.
I hope I have made this clear enough. Please comment if it needs more clarification.
Is it possible to apply UI virtualization to ScrollViewer in WinRT. In my application I am creating a line chart with the help of Polyline(Polyline embedded inside a scrollviewver). But in the current case, If it come more than 500 points. It blocks the UI during the time of interacting with the Map. So what I am trying to achieve is to apply kind of UI virtualization to scroll view. If anyone had any idea to solve this please help me.
The way I would handle a Polyline is I would break its data into sections, perhaps screen-wide ones (assuming horizontal-only scrolling), put a Canvas inside of the ScrollViewer, make the size (Width) of the Canvas the total size of the chart and put a few (say 5) Polyline controls in it and then on the ViewChanged event update the Polyline controls' Canvas.Left and Points properties to correspond to the area around the current view port of the ScrollViewer. That should give you smooth scrolling. Just don't add/remove or update the controls on each ViewChanged and only update Canvas.Left and Points when you need to - that is when you don't have a Polyline ready to display next to the current view port.
As the title suggests, I'd like to overlay a label on an axwindowsmediaplayer control while in fullscreen mode.
Has anyone any idea how to do it?
Thanks,
Joe
I did my by...
Creating 2 forms.1 with the media player set to what ever size needed
The second form with...
formborderstyle = none
form2.left = form1.left + form1.mediaplayer.left
form2.top = form1.top + form1.mediaplayer.top
Lower the opacity to 70 or if you want it in code..
form2.opacity=0.7
Put your text or anything in the second form .
The final effect is a cool shade like effect with text in it with media playing in the background.
You may be able to use the windowlessVideo property. It mentions this exact use case in the documentation.
By default, an embedded Windows Media Player control renders video in its own window within the client area. When windowlessVideo is set to true, the Windows Media Player object renders video directly in the client area, so you can apply special effects or layer the video with text.
I'm sure this issue must have a very straightforward answer but I can't seem to find it. Any help is much appreciated.
Whenever a new item is added to the UI, either at runtime or dynamically once the program is running, it slides into view to reach its position (with inertia). Only when it reaches that point are certain properties applied: like transform properties or opacity values. For example, if a rectangle set to 50% opacity is added when a button is tapped, it will slide onto the screen about 30 points from its actual position at 100% opacity, reach the correct position and then change to the correct 50% opacity.
I would like to be able to turn off this default behavior so the rectangle appears immediately at the correct position with all the properties set.
I've found that I'm asking two separate questions and that both have been answered on this site (links below).
Individual objects can be targeted using the Transitions property under Miscellaneous in Visual Studio 2012.
How to remove EntranceThemeTransition from object or container in Windows 8 Store Apps?
RenderTransform occurs after EntranceThemeTransition on a TextBlock