|
Java example source code file (Layers.js)
The Layers.js Java example source codefunction Layers() { this.layers = []; this.totalLayers = 0; this.maximumX = 0; this.maximumY = 0; this.attach = function( layer) { this.layers.push(layer); this.totalLayers++; if (this.maximumX < layer.x) this.maximumX = layer.x; if (this.maximumY < layer.y) this.maximumY = layer.y; } this.getLayersForY = function(y) { var result = []; for (var i = 0; i < this.layers.length; i++) { if (this.layers[i].y == y) { result.push(this.layers[i]); } } return result; } this.getLayersForX = function (x) { var result = []; for (var i = 0; i < this.layers.length; i++) { if (this.layers[i].x == x) { result.push(this.layers[i]); } } return result; } this.getLayerForXY = function (x, y) { var layerX = this.getLayersForX(x); for (var i = 0; i < layerX.length; i++) { if (layerX[i].y == y) return layerX[i]; } return null; } this.getLayerForYX = function (x, y) { var layerY = this.getLayersForY(y); for (var i = 0; i < layerY.length; i++) { if (layerY[i].x == x) return layerY[i]; } return null; } } Other Java examples (source code examples)Here is a short list of links related to this Java Layers.js source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.