Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html5 canvas 在Fabric.js中增加运行时的画布高度会影响IE9中的对象选择和拖放_Html5 Canvas_Javascript_Fabricjs - Fatal编程技术网

Html5 canvas 在Fabric.js中增加运行时的画布高度会影响IE9中的对象选择和拖放

Html5 canvas 在Fabric.js中增加运行时的画布高度会影响IE9中的对象选择和拖放,html5-canvas,javascript,fabricjs,Html5 Canvas,Javascript,Fabricjs,Fabric.js对我有效,但当我增加画布运行时的高度/宽度时。新添加的动态对象我可以在旧画布区域拖放。但不是在增加的区域 我在div中使用canvas和overflow 如果我在隐藏区域拖动新对象并向下滚动画布,则对象将被锁定 下面是我的HTML代码: <input id="Button1" type="button" value="Circle" onclick="addcricle();" /><input id="Button2" type="butto

Fabric.js对我有效,但当我增加画布运行时的高度/宽度时。新添加的动态对象我可以在旧画布区域拖放。但不是在增加的区域

我在div中使用canvas和overflow

如果我在隐藏区域拖动新对象并向下滚动画布,则对象将被锁定

下面是我的HTML代码:

<input id="Button1" type="button" value="Circle" onclick="addcricle();" /><input
        id="Button2" type="button" value="square" onclick="addsquare();" />   
<button id="Button12" onclick="changeMyHight();">Change Work Area</button>
   <div style="width: 900px; height: 800px; overflow: scroll">
    <canvas id="canvas" width="800" height="700px" style="border: 1px solid #000000"></canvas>
</div>

我在div溢出中解决了此问题,我将HTML更改如下:

<div style="width: 900px; height: 800px; overflow: scroll" onscroll="setMyOffset();">
  <canvas id="canvas" width="800" height="700px" style="border: 1px solid #000000"></canvas>
</div> 

function setMyOffset() {
  canvas.calcOffset();
}

函数setMyOffset(){
canvas.calcOffset();
}
<div style="width: 900px; height: 800px; overflow: scroll" onscroll="setMyOffset();">
  <canvas id="canvas" width="800" height="700px" style="border: 1px solid #000000"></canvas>
</div> 

function setMyOffset() {
  canvas.calcOffset();
}