|
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. |
On August 14 2016 22:53 graNite wrote:I am trying to code a builder for table tennis exercise graphics. I want it to show a table for each rally of the exercise, with arrows on it that show the movement path of the ball and rectangles of areas where to play. Right now it looks like this: https://codepen.io/graNite/pen/grqXOoYou can add new tables, remove the last one, and draw two fixed arrows on the same canvas layer on the first table. What I want to enable is to draw arrows* on each table via click-and-drag and delete them with right-click on them.*(like they are drawn in the drawArrows function)What is the best way to do this? I already implemented a canvas layer for the arrows and could even do so for every single arrow on each table, but how can I access an arrow that is in a middle layer if I right click on it to delete it?
The easiest way in my opinion is to somehow register the arrows so you can make them listen to a mouseclick event. If you want it to be the right click, you'll need to listen to the event 'oncontextmenu'. So in your drawArrow function, register them as an object so you can listen to the oncontextmenu event and delete the arrow.
Something like this :
arrow.addEventListener('oncontextmenu', function () { //delete your arrow return false; // return false so the menu doesn't pop up }, false)
However to do this you are probably going to need to refactor your code to make sure you can put a listener on those arrows.
I am no JS expert so take this with a grain of salt.
|
On August 15 2016 04:07 Djagulingu wrote:I'm down for this shit.
and I want to make a windows phone app. just to see the environment. I don't like to make unusable-unnecessary things just to learn sth.
|
On August 14 2016 22:53 graNite wrote:I am trying to code a builder for table tennis exercise graphics. I want it to show a table for each rally of the exercise, with arrows on it that show the movement path of the ball and rectangles of areas where to play. Right now it looks like this: https://codepen.io/graNite/pen/grqXOoYou can add new tables, remove the last one, and draw two fixed arrows on the same canvas layer on the first table. What I want to enable is to draw arrows* on each table via click-and-drag and delete them with right-click on them.*(like they are drawn in the drawArrows function)What is the best way to do this? I already implemented a canvas layer for the arrows and could even do so for every single arrow on each table, but how can I access an arrow that is in a middle layer if I right click on it to delete it?
Did you see my post to you? I gave you an example of being able to draw lines based on canvas, and mouse click events.
|
On August 16 2016 06:16 loginn wrote:
The easiest way in my opinion is to somehow register the arrows so you can make them listen to a mouseclick event. If you want it to be the right click, you'll need to listen to the event 'oncontextmenu'. So in your drawArrow function, register them as an object so you can listen to the oncontextmenu event and delete the arrow.
Something like this :
arrow.addEventListener('oncontextmenu', function () { //delete your arrow return false; // return false so the menu doesn't pop up }, false)
However to do this you are probably going to need to refactor your code to make sure you can put a listener on those arrows.
I am no JS expert so take this with a grain of salt.
I will try to do this, thanks.
On August 16 2016 10:21 ShoCkeyy wrote: Did you see my post to you? I gave you an example of being able to draw lines based on canvas, and mouse click events.
No, sorry, can you link the post? I dont know what you mean.
Could it maybe be better to switch from canvas to svg for this?
|
Hey folks, I'm going to try to work through this weekly challenge for a little bit of time each night this week. Would anyone like to collaborate with me on it? We would have different code(I guess hosted on GitHub so we could view it) but we would talk about problems and solutions.
|
On August 16 2016 13:22 graNite wrote:Show nested quote +On August 16 2016 06:16 loginn wrote:
The easiest way in my opinion is to somehow register the arrows so you can make them listen to a mouseclick event. If you want it to be the right click, you'll need to listen to the event 'oncontextmenu'. So in your drawArrow function, register them as an object so you can listen to the oncontextmenu event and delete the arrow.
Something like this :
arrow.addEventListener('oncontextmenu', function () { //delete your arrow return false; // return false so the menu doesn't pop up }, false)
However to do this you are probably going to need to refactor your code to make sure you can put a listener on those arrows.
I am no JS expert so take this with a grain of salt. I will try to do this, thanks. Show nested quote +On August 16 2016 10:21 ShoCkeyy wrote: Did you see my post to you? I gave you an example of being able to draw lines based on canvas, and mouse click events. No, sorry, can you link the post? I dont know what you mean.
Could it maybe be better to switch from canvas to svg for this?
http://www.teamliquid.net/forum/general/134491-the-big-programming-thread?page=750#14990
This post really shows how a user and multiuser can draw a line, I would probably switch it from drawing a line to on click from point A to point B.
|
Thanks, but I dont really get how this can help me with the layer issues.
|
On August 16 2016 20:55 graNite wrote: Thanks, but I dont really get how this can help me with the layer issues.
Have you looked at the library paper.js? It has shapes, mouse/keyboard interaction and layers. Create 2 layers and make sure that arrows are on the top layer.
|
On August 16 2016 08:52 mantequilla wrote:and I want to make a windows phone app. just to see the environment. I don't like to make unusable-unnecessary things just to learn sth. Making a windows phone app and not liking to make unusable-unnecessary things just to learn something isn't too much consistent, at least according to me.
|
|
On August 16 2016 13:42 WarSame wrote:Hey folks, I'm going to try to work through this weekly challenge for a little bit of time each night this week. Would anyone like to collaborate with me on it? We would have different code(I guess hosted on GitHub so we could view it) but we would talk about problems and solutions.
I actually did that challenge and create a little graphical version, haven't put it on github yet, but here you go
requires pygame, the trolls are stupid as hell though
|
what's a good chunk number when reading a binary file with read(integer) in python?
|
On August 17 2016 18:57 mantequilla wrote: what's a good chunk number when reading a binary file with read(integer) in python? That depends on your use case, doesn't it?
|
On August 16 2016 08:52 mantequilla wrote:and I want to make a windows phone app. just to see the environment. I don't like to make unusable-unnecessary things just to learn sth.
WP is basically dead, but in my opinion Windows development is still preferable to Android and iOS development, so learning how C# does things differently can be useful.
On August 17 2016 08:42 Nesserev wrote: Microsoft is shutting down Windows Phone iirc; don't bother lol.
That said, maybe it's better if you don't work on an app for TeamLiquid. There is no available API, and webscraping the whole site is against the TOS. Those are your first problems... Then there's the problem of trust, accountability, support, etc.
Didn't someone make an Android app a while back? Not sure happened to it, but it webscraped the site. Probably too difficult to maintain.
|
On August 18 2016 09:48 Blisse wrote:Show nested quote +On August 16 2016 08:52 mantequilla wrote:On August 15 2016 04:07 Djagulingu wrote:I'm down for this shit. and I want to make a windows phone app. just to see the environment. I don't like to make unusable-unnecessary things just to learn sth. WP is basically dead, but in my opinion Windows development is still preferable to Android and iOS development, so learning how C# does things differently can be useful. Show nested quote +On August 17 2016 08:42 Nesserev wrote: Microsoft is shutting down Windows Phone iirc; don't bother lol.
That said, maybe it's better if you don't work on an app for TeamLiquid. There is no available API, and webscraping the whole site is against the TOS. Those are your first problems... Then there's the problem of trust, accountability, support, etc. Didn't someone make an Android app a while back? Not sure happened to it, but it webscraped the site. Probably too difficult to maintain.
The app uses Cordova to render the app so it isn't platform specific. The code is on the liquipedia github page.
Although writing this I wonder if more than one app has been created.
|
I'm toying with Xamarin for cross plateform dev in my free time and so far, it's pretty cool to use and pretty strong also, albeit lacking maturity. Probably does help that I've been a C# / Visual Studio proponent for years :D
|
On August 18 2016 04:55 Prillan wrote:Show nested quote +On August 17 2016 18:57 mantequilla wrote: what's a good chunk number when reading a binary file with read(integer) in python? That depends on your use case, doesn't it?
on a regular 8gb ram pc, read a big binary file from a regular hdd, do something with data and write it back to disk Don't know if I'm supposed to read a large amount that can fit into ram such as 500mb, or read in smaller chunks.
|
|
Anyone here used crate.io? Any good or bad experience to share? We are thinking of using it for our project because it looks cool
|
Yup. Looking cool is my first criteria for selecting a DB system in serious projects.
It does look interesting if your main criteria is that it works well with docker, but to be honest, I've used both mysql and postgresql in docker and they worked just fine too, so not quite sure what crate's added value is.
|
|
|
|