You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
537 B
20 lines
537 B
import clipRectangle from "./rectangle"; |
|
|
|
export default function() { |
|
var x0 = 0, |
|
y0 = 0, |
|
x1 = 960, |
|
y1 = 500, |
|
cache, |
|
cacheStream, |
|
clip; |
|
|
|
return clip = { |
|
stream: function(stream) { |
|
return cache && cacheStream === stream ? cache : cache = clipRectangle(x0, y0, x1, y1)(cacheStream = stream); |
|
}, |
|
extent: function(_) { |
|
return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], cache = cacheStream = null, clip) : [[x0, y0], [x1, y1]]; |
|
} |
|
}; |
|
}
|
|
|