mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Rename View#artworkToView(), #viewToArtwork() -> #projectToView(), #viewToProject().
This commit is contained in:
parent
6d9ec033fe
commit
fa3019a947
1 changed files with 8 additions and 9 deletions
|
@ -278,14 +278,13 @@ var View = this.View = Base.extend(/** @lends View# */{
|
||||||
// TODO: style: artwork / preview / raster / opaque / ink
|
// TODO: style: artwork / preview / raster / opaque / ink
|
||||||
// TODO: getShowGrid
|
// TODO: getShowGrid
|
||||||
// TODO: getMousePoint
|
// TODO: getMousePoint
|
||||||
// TODO: artworkToView(rect)
|
// TODO: projectToView(rect)
|
||||||
|
|
||||||
// TODO: Consider naming these projectToView, viewToProject
|
projectToView: function(point) {
|
||||||
artworkToView: function(point) {
|
|
||||||
return this._matrix._transformPoint(Point.read(arguments));
|
return this._matrix._transformPoint(Point.read(arguments));
|
||||||
},
|
},
|
||||||
|
|
||||||
viewToArtwork: function(point) {
|
viewToProject: function(point) {
|
||||||
return this._getInverse()._transformPoint(Point.read(arguments));
|
return this._getInverse()._transformPoint(Point.read(arguments));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -392,8 +391,8 @@ var View = this.View = Base.extend(/** @lends View# */{
|
||||||
tempFocus,
|
tempFocus,
|
||||||
dragging = false;
|
dragging = false;
|
||||||
|
|
||||||
function viewToArtwork(view, event) {
|
function viewToProject(view, event) {
|
||||||
return view.viewToArtwork(DomEvent.getOffset(event, view._canvas));
|
return view.viewToProject(DomEvent.getOffset(event, view._canvas));
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFocus() {
|
function updateFocus() {
|
||||||
|
@ -429,7 +428,7 @@ var View = this.View = Base.extend(/** @lends View# */{
|
||||||
}
|
}
|
||||||
if (!(view = view || View._focused) || !(tool = view._scope.tool))
|
if (!(view = view || View._focused) || !(tool = view._scope.tool))
|
||||||
return;
|
return;
|
||||||
var point = event && viewToArtwork(view, event);
|
var point = event && viewToProject(view, event);
|
||||||
var onlyMove = !!(!tool.onMouseDrag && tool.onMouseMove);
|
var onlyMove = !!(!tool.onMouseDrag && tool.onMouseMove);
|
||||||
if (dragging && !onlyMove) {
|
if (dragging && !onlyMove) {
|
||||||
curPoint = point || curPoint;
|
curPoint = point || curPoint;
|
||||||
|
@ -455,7 +454,7 @@ var View = this.View = Base.extend(/** @lends View# */{
|
||||||
if (tool) {
|
if (tool) {
|
||||||
if (timer != null)
|
if (timer != null)
|
||||||
timer = clearInterval(timer);
|
timer = clearInterval(timer);
|
||||||
if (tool.onHandleEvent('mouseup', viewToArtwork(view, event), event)) {
|
if (tool.onHandleEvent('mouseup', viewToProject(view, event), event)) {
|
||||||
view.draw(true);
|
view.draw(true);
|
||||||
DomEvent.stop(event);
|
DomEvent.stop(event);
|
||||||
}
|
}
|
||||||
|
@ -496,7 +495,7 @@ var View = this.View = Base.extend(/** @lends View# */{
|
||||||
View._focused = view;
|
View._focused = view;
|
||||||
if (!(tool = view._scope.tool))
|
if (!(tool = view._scope.tool))
|
||||||
return;
|
return;
|
||||||
curPoint = viewToArtwork(view, event);
|
curPoint = viewToProject(view, event);
|
||||||
if (tool.onHandleEvent('mousedown', curPoint, event))
|
if (tool.onHandleEvent('mousedown', curPoint, event))
|
||||||
view.draw(true);
|
view.draw(true);
|
||||||
if (tool.eventInterval != null)
|
if (tool.eventInterval != null)
|
||||||
|
|
Loading…
Reference in a new issue