Created
April 6, 2017 12:32
-
-
Save eeropic/6b3a4ce92a3d39820489ad34efa9838f to your computer and use it in GitHub Desktop.
no description yet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var xOffset=100; | |
var yOffset=100; | |
for(var j=0;j<11;j++){ | |
for(var i=0;i<11;i++){ | |
var t=new PointText(); | |
t.content="0" | |
t.position=new Point(i*20+xOffset,j*20+yOffset) | |
} | |
} | |
function onMouseDown(event){ | |
var hit=project.hitTest(event.point) | |
if(hit){ | |
if(hit.item){ | |
project.deselectAll(); | |
hit.item.selected=true; | |
} | |
} | |
} | |
function onKeyDown(event){ | |
if(project.selectedItems.length>0){ | |
if(!isNaN(parseInt(event.key)) || event.key=="a" || event.key=="b"){ | |
var nr=parseInt(event.key,16); | |
var exists=false; | |
for(var i=0;i<11;i++){ | |
var item=project.activeLayer.children[i]; | |
if(item.content==nr)exists=true; | |
} | |
if(!exists)project.selectedItems[0].content=nr | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment