Screen space bounding box

I need to understand why this code doesn’t work when I move the object

This shows the object at position (0,0,0)
http://jsfiddle.net/holgerl/6fy9d54t/

This shows the error when I move the object
http://jsfiddle.net/Prodigy343/428v1tLx/8/

The fiddle assumes that NDC coordinates are always in the range [-1, 1]. But if you translate the object (partially) outside of the view frustum, you receive coordinates which exceed this range. When this happens, it’s not correct set the scale and position of the visualized bounding box (overlayBox) like in the example.

In general, the entire quality of the original code is not good. The code performs a lot of unnecessary object creation and uses the API of three.js not in the intended way.