Giter VIP home page Giter VIP logo

Comments (8)

kirkas avatar kirkas commented on August 20, 2024

@koenpopma @trinione

Update: I've created a Mapping system which generate a hash containing every navigation information for each floor. Eg:

floorMap[3] = {
  "down": false,
  "up": 3,
  "right": false,
  "left": 1,
  "closest": {
    "down": 1,
    "up": false,
    "right": 1,
    "left": 3
  },
  "furthest": {
    "down": false,
    "up": 1,
    "right": 1,
    "left": false
  }
};

This hash contain information about the floor aside (down/up/right/left), the closest floor, ordered by direction. The hash contain the index of the floor or false if it can't found one.

I will add a option call "jump" for ascensor next week, it will have 3 settings:

false: no jump, ascensor will only navigate to direct surroundings floor

true: jump, when navigating, if ascensor can'f found a direct surroundings floor, it will look for the closest floor in that direction.

"loop": Like true, except if there is no direct surroundings floor and no close floor, ascensor will loop and reach the furthest floor (loop).

Let me know your thinking on this system, i need to write some test for it, tidyup some logic, but it should go out this week.

from ascensor.js.

kirkas avatar kirkas commented on August 20, 2024

Nothing is available yet, i haven't release any new version of ascensor (it's not ready yet).

Please, when posting comment, use gist (https://gist.github.com/) system or jsfiddle (http://jsfiddle.net/) to post your code, posting here make everything messy.

@koenpopma sorry but i have to remove your comments, they are not directly related to the goal of this issue, and use way too much space (use gist/jsfiddle). Also, what you want (jump to next level when reach the end) is a very specific need for your use, and not everyone else use of Ascensor.js.

Everyone is welcome to change the code, but please use github pull request system and/or discuss only code concept. Posting trunk of code here will only break the readability of the issue.

from ascensor.js.

kirkas avatar kirkas commented on August 20, 2024

@koenpopma

What about a fourth option for jump, a one called "increment" for exemple?

"increment": Like "loop", except if there is no direct surroundings floor and no close floor, ascensor will loop and reach the first floor of the next level.

from ascensor.js.

kirkas avatar kirkas commented on August 20, 2024

Here what i propose:

Jump: true || false
Loop: true || false || "increment" || "increment-x || "increment-y"

Jump: Let ascensor go from floor to floor even if void between them.

Loop:

true // will go opposite floor when reach the end (on all axis)   
"increment" // will reach next same-axis floor level when reach end end (on all axis)
"increment-x" // will reach opposite floor on y axis, but jump to next level on x axis
"increment-y" // will reach opposite floor on x axis, but jump to next level on y axis

I've put a illustration of those behavior for loop option:

screen shot 2013-12-09 at 11 25 23

from ascensor.js.

trinione avatar trinione commented on August 20, 2024

What about when on say [1,2] and down arrow pressed and you want to go to [2,0]? Or is that shown above somewhere?

from ascensor.js.

kirkas avatar kirkas commented on August 20, 2024

I'm not sure to understand, could you draw a illustration of how you think it should work?

from ascensor.js.

puck3000 avatar puck3000 commented on August 20, 2024

i really like the solution you propose, kirkas. increment-x is just what i was looking for in a recent project…

from ascensor.js.

kirkas avatar kirkas commented on August 20, 2024

Okay, i've Added & Push this new map/loop system. There is now 6 options for the loop parameter:

true: will reach the further floor on same axis once reach the end, on all axis
"loop-x": will reach the further floor on same axis once reach the end, only on X axis
"loop-y": will reach the further floor on same axis once reach the end, only on Y axis
"increment": will reach next same-axis floor level when reach end end, on all axis
"increment-x": will reach opposite floor on y axis, but jump to next level on X axis
"increment-y": will reach opposite floor on y axis, but jump to next level on Y axis

Please note: When you reach the last floor, it wont' reach the first floor (yet), as this is a quite specific/complicated issue. I've created a new issue for that specific behavior => #28

from ascensor.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.