I'm taking a version of our VR experience (repo here: https://github.com/EFForg/spot_the_surveillance) and making a purely desktop version for demonstration purposes.
I've added cursor="rayOrigin: mouse" to and some changed some mouseenter events to click events. Everything is mostly working except that as I mouse over the scene, I repeatedly getting this error: "Uncaught TypeError: t is null", which refers to the following code in cursor.js.
// Ignore events further away than active intersection.
if (this.intersectedEl) {
currentIntersection = this.el.components.raycaster.getIntersection(this.intersectedEl);
if (currentIntersection.distance <= intersection.distance) { return; }
}
How do I resolve this error? It causes a significant lag time in the experience.
Thank you!
Looking at the Mouse Click Example linked from this page was a good place to start: https://aframe.io/docs/1.0.0/components/cursor.html#intersection-data
Unfortunately the example is using aframe 0.7.0, so I had to read through the animations documention for 1.0.4 and adapt accordingly: https://aframe.io/docs/1.0.0/components/animation.html
I also had to update the version of aframe-event-set-component.js I was using.
Between those two sources of information and the version updates, I was able to get things working.
Related
On LightningtChartJS, I added 2 LineSeries which displays correctly (screenshot).
sample line graph
Then I am trying to do the highlighting of the lines on hover, plus the hover and mouseclick events.
I set the following:
const series=this.chart.addLineSeries({});
series.add(data); //data var is set above this code
series.setHighlightOnHover(true);
series.onHover((...args)=>{
console.log(args);
});
series.onMouseClick((...args)=>{
console.log(args);
});
The the highlight doesn't work, hover and click events don't trigger when I hover or click on a any of the lines.
Please help.
Seems that this feature is not working on the 3.0 version. It should be fixed in a patch or minor release in the near future. To try it out immediately you can revert to previous version, and it should work out of the box - highlighting on hover is enabled by default.
EDIT: v3.0.1 has just been released along with fixes to this issue.
In this version, LineSeries mouse interactions are disabled by default because they don't perform well in all cases. In order for mouse interactions to work you must enable them with setMouseInteractions(true).
The mentioned performance issues can happen with FREEFORM line series and large amount of data (~hundreds of thousands of data points). If you are using a progressive data pattern then there are no issues.
EDIT: v3.4
The general situation is still the same, the mouse interactions of Line Series are still disabled by default and you must enable them with setMouseInteractions(true). Furthermore, highlighting on hover is also disabled by default, and must be enabled with setHighlightOnHover(true).
Following snippet is confirmed to work in online examples:
const series = chart.addLineSeries({
dataPattern: {
pattern: 'ProgressiveX',
regularProgressiveStep: true,
}
})
.setHighlightOnHover(true)
.setMouseInteractions(true)
series.onHover((...args)=>{
console.log(args);
});
series.onMouseClick((...args)=>{
console.log(args);
});
However, something of an extra complication is the automatic disabling of mouse interactions during animations and scrolling, which is enabled by default. These can be disabled as follows:
chart
.setMouseInteractionsWhileScrolling(true)
.setMouseInteractionsWhileZooming(true)
Thankfully we are just about to move into a breaking version release v4.0.0 where we can properly resolve the situation. Stay tuned for improvements regarding mouse interactions in the coming months.
i'm trying to reload the scene on AFrame, i have a scene with a robot and i need to load back to original state of the scene when users click a button.
What i already tried is:
var sceneElement = document.querySelector("a-scene");
sceneElement.reload();
And:
location.reload()
The first one raise an error on browser console showing that reload() method is not a function but documentation on AFrame supports it. I don't know if i'm using this function right.
Uncaught TypeError: sceneElement.reload is not a function
at HTMLDocument.eval (websim.js:64)
at HTMLButtonElement.eval (editor.js:23)
at HTMLButtonElement.dispatch (jquery.js:4953)
at HTMLButtonElement.elemData.handle (jquery.js:4758)
The last code from below reloads the entire page and this is not what i need.
Thank you! :)
That method was removed a while ago, I just pushed a change to remove that from the docs, thanks.
You can do window.location.reload().
Else you can just revert whatever you need reverted manually (.setAttributes, removing components). aframe-state-component can also help if it's more complex and you don't want a page reload.
I've found a solution to my problem, my robot has dynamic-body component so i'm able to use robot.body.quaternion.set with robot.body.initQuaternion x, y and z as input parameters and reload the robot.
I know is not the full scene reloaded but it works fine for this particular issue.
Thank you #ngokevin for your answers
I've been working with Quill for a short time and have been focused on getting collaborative editing working. So far it's going well and I have a fully working collaborative editor!
I want to show the selection and cursor position of other users, but I can't think how to properly approach this problem with Quill.
I essentially want to add markup to the rendered document, without adding any content to the actual document model. Is this possible? Where should I start?
You need to use "quill-cursors" package and then listen to selection-change event:
editor.on("selection-change", function (range, oldRange, source) {
console.log("Local cursor change: ", range);
});
Then broadcast this data to other remote users, and then render the remote cursor:
const cursors = editor.getModule("cursors");
cursors.createCursor(id, user.name, userColor);
cursors.moveCursor(id, cursorRange); // <== cursor data from previous step
cursors.toggleFlag(id, true);
In Quill 0.20, there was an example with multiple cursors working. The approach was a sibling absolutely positioned <div> that contained the cursors and synchronized with selection-change information from the editor. To not delay the 1.0 release this demo and feature was not updated with the new API but support is planned. You can try a similar approach in the meantime and of course the code is still available. You can also track the feature on Github Issues.
I have three camera-based apps (that take still pictures) in the app-store and have got feedback that the UIImagePickerController interface is very slow - and I can't deny that. So, to improve the performance of the app, I started to experiment with the AVCam Demo source code from the WWDC 2010.
Since the AVFoundation framework does not interact with the UI Kit, I have been successful at wrapping a view around the demo. I am able to transition between the view controllers successfully. The only thing that I've modified is replaced the Record button with the Exit button (to exit to the wrapping view controller)
The modified app works fine during the first session (wrapper -> demo) If I exit the demo to the wrapper, and come back to the demo second time , the video frame in the preview layer freezes a second or two after. The app itself does not freeze - just the video is frozen. At this point, all UI buttons are active. But, when I tap "Still" button to capture the image, I get the following error in an alert:
The operation cannot be completed (AVFoundationErrorDomain error - 11800.)
This cannot be duplicated in the original demo code - because you can't close and reopen the session. So, I am wondering if it has anything to do with the way I "exit" from the session in my test. Here's the "exit" action that I added in the demo code:
- (IBAction)exit:(id)sender
{
[[self captureManager] stopRecording];
[self dismissModalViewControllerAnimated:YES];
}
Is this sufficient - or did I miss something?
Regards, Sam.
There's a little problem of cleaning up a capture session in an orderly fashion, as there's some asynchroneous calls with no alerts of when they're done.
Try stopping and releasing as suggested in this question:
How to properly release an AVCaptureSession
(take the solution with most up votes)
If that doesn't help you may need to post some more code here. Are you sure that's all you changed?
Good luck!
Oded.
Can I add a ProgressEvent listener to the stage?
I don't see it in any of the auto-complete options when I am typing in Flex.
What do people normally do to get a progress readout of the entire main runner's loading progress?
I try the following, which is where I would expect to see the ProgressEvent options pop up:
stage.addEventListener(
Thanks...
Try adding it to loaderInfo.
something like:
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
Also , if you're using the framework, you should probably extend the DownloadProgressBar.
I remember this old tutorial, but surely there must be plenty online.
I have a new problem:
I use the following code to show the progress of the download of my site content:
public function mainProgress(e:ProgressEvent):void
{
var w:Number = e.bytesLoaded / e.bytesTotal;
_mainprog.graphics.clear();
_mainprog.graphics.beginFill(0x000000);
_mainprog.graphics.drawRect(0, 0, w * stage.stageWidth, 50);
_mainprog.graphics.endFill();
}
But it doesn't seem to work.
What happens is that the loaderInfo object thinks that the site has loaded before I am actually ready to display anything. So what ends up happening (I think) is the site loads, the loader progress disappears before the initial page's graphics have fully loaded, and then there is a delay between when the completion of the loaderInfo object happens and the actual graphics appearing.
Has anyone else had this problem before?
Thanks...