谁能告诉我如何在JCrop中检查某个区域是否已被选中进行裁剪?
我希望在API中有一个布尔函数,但我没有看到这样的东西。我尝试使用updatecoord函数,但即使没有选择,也会设置x、y、w和h。
下面是我的实例化:
var jcrop_api;
$('#profile_crop').Jcrop({onSelect: updateCoords, setSelect: [0, 542, 671, 0], boxWidth: 542, boxHeight: 671, aspectRatio: 542/671},
function() {
jcrop_api = this;
});
发布于 2015-12-31 17:18:17
您将不得不手动检测是否有选择,因此请使用onRelease处理程序。在API中:
var jcrop_api;
var selected;
$('#profile_crop').Jcrop({onSelect: showCoords, onRelease: releaseCoords, setSelect: [0, 542, 671, 0], boxWidth: 542, boxHeight: 671, aspectRatio: 542/671},
function() {
jcrop_api = this;
}
);
function showCoords(c){
selected = true;
// variables can be accessed here as
// c.x, c.y, c.x2, c.y2, c.w, c.h
};
function releaseCoords(c){
selected = false;
// variables can be accessed here as
// c.x, c.y, c.x2, c.y2, c.w, c.h
};
如果我没回答你的问题就告诉我!
https://stackoverflow.com/questions/34549356
复制相似问题