在具有垂直滾動條的瀏覽器窗口內的畫布中繪製時,出現問題。可滾動瀏覽器窗口(抓取位置)內的畫布
數字處於正確的位置,可以在畫布周圍抓住它並進行連接,但只有在垂直滾動條(瀏覽器窗口)完全打開的情況下才可以。
當窗口向下滾動時,節點不能再被拖動,甚至光標在懸停節點時也會改變。 我想出了在向下滾動時拖動節點的可能性。不知何故,節點的「抓取區域」不會改變其位置,就好像該區域根據瀏覽器窗口具有固定的位置。
我在做什麼錯了?
實驗值:廣東話發表圖片:(,我沒有足夠的聲譽。
提前感謝!
在具有垂直滾動條的瀏覽器窗口內的畫布中繪製時,出現問題。可滾動瀏覽器窗口(抓取位置)內的畫布
數字處於正確的位置,可以在畫布周圍抓住它並進行連接,但只有在垂直滾動條(瀏覽器窗口)完全打開的情況下才可以。
當窗口向下滾動時,節點不能再被拖動,甚至光標在懸停節點時也會改變。 我想出了在向下滾動時拖動節點的可能性。不知何故,節點的「抓取區域」不會改變其位置,就好像該區域根據瀏覽器窗口具有固定的位置。
我在做什麼錯了?
實驗值:廣東話發表圖片:(,我沒有足夠的聲譽。
提前感謝!
我張貼同樣的問題在谷歌組Draw2D的中和接收來自以下的答案框架顯影劑,安德烈亞斯赫茨。
「您好
這是在lib小設計缺陷。
normaly能夠‘自動檢測’在div /畫布的滾動位置。乙我目前沒有。
解決方案:
之一:設置滾動容器與方法帆布#setScrollArea(的DOMNode節點)
或draw2d.Canvas:您可以通過自己的計算,如果第一個解決方案沒有奏效
var canvas = new draw2d.Canvas("domId");
canvas.fromDocumentToCanvasCoordinate = $.proxy(function(x, y) {
return new draw2d.geo.Point(
(x - this.getAbsoluteX() + this.getScrollLeft())*this.zoomFactor,
(y - this.getAbsoluteY() + this.getScrollTop())*this.zoomFactor);
},canvas);
/**
* @method
* Transforms a canvas coordinate to document coordinate.
*
* @param {Number} x the x coordinate in the canvas
* @param {Number} y the y coordinate in the canvas
*
* @returns {draw2d.geo.Point} the coordinate in relation to the document [0,0] position
*/
canvas.fromCanvasToDocumentCoordinate = $.proxy(function(x,y) {
return new draw2d.geo.Point(
((x*(1/this.zoomFactor)) + this.getAbsoluteX() - this.getScrollLeft()),
((y*(1/this.zoomFactor)) + this.getAbsoluteY() - this.getScrollTop()));
},canvas);"
仍然不行!使用最新版本(5.8.0)問題依然存在。 – gravi
你基本上需要修改代碼以抵消頁面滾動位置
canvas.fromDocumentToCanvasCoordinate = $.proxy(function(x, y) {
return new draw2d.geo.Point(
(x + window.pageXOffset - this.getAbsoluteX() + this.getScrollLeft())*this.zoomFactor,
(y + window.pageYOffset - this.getAbsoluteY() + this.getScrollTop())*this.zoomFactor);
},canvas);
canvas.fromCanvasToDocumentCoordinate = $.proxy(function(x,y) {
return new draw2d.geo.Point(
((x*(1/this.zoomFactor)) + this.getAbsoluteX() - this.getScrollLeft() - window.pageXOffset),
((y*(1/this.zoomFactor)) + this.getAbsoluteY() - this.getScrollTop() - window.pageYOffset));
},canvas);
你可以發佈一個鏈接到jsfiddle雖然=) – srquinn