mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
pulling out extending guide trenches as per Aza's feedback. revert to 787f64274830 to try them again. keeping some bugfixes which were made during extending guide trench dev, though.
This commit is contained in:
parent
51a6895e12
commit
9c5149bab4
@ -117,7 +117,7 @@ Drag.prototype = {
|
|||||||
bounds = newRect;
|
bounds = newRect;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Trenches.hideGuides( true );
|
Trenches.hideGuides();
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure the bounds are in the window.
|
// make sure the bounds are in the window.
|
||||||
@ -128,7 +128,7 @@ Drag.prototype = {
|
|||||||
iQ.extend(snappedTrenches,newRect.snappedTrenches);
|
iQ.extend(snappedTrenches,newRect.snappedTrenches);
|
||||||
}
|
}
|
||||||
|
|
||||||
Trenches.hideGuides( true );
|
Trenches.hideGuides();
|
||||||
for (let edge in snappedTrenches) {
|
for (let edge in snappedTrenches) {
|
||||||
let trench = snappedTrenches[edge];
|
let trench = snappedTrenches[edge];
|
||||||
if (typeof trench == 'object') {
|
if (typeof trench == 'object') {
|
||||||
|
@ -109,14 +109,6 @@ var Trench = function(element, xory, type, edge) {
|
|||||||
this.range = new Range(0,10000);
|
this.range = new Range(0,10000);
|
||||||
this.minRange = new Range(0,0);
|
this.minRange = new Range(0,0);
|
||||||
this.activeRange = new Range(0,10000);
|
this.activeRange = new Range(0,10000);
|
||||||
|
|
||||||
//----------
|
|
||||||
// Variable: extending guide trench variables
|
|
||||||
// only makes sense for guide trenches
|
|
||||||
// extended - (bool) whether this trench has been extended or not.
|
|
||||||
//
|
|
||||||
this.extended = false;
|
|
||||||
this.snapBeginTime = false;
|
|
||||||
};
|
};
|
||||||
Trench.prototype = {
|
Trench.prototype = {
|
||||||
//----------
|
//----------
|
||||||
@ -223,30 +215,21 @@ Trench.prototype = {
|
|||||||
// If <Trenches.showDebug> is true, we will draw the trench. Active portions are drawn with 0.5
|
// If <Trenches.showDebug> is true, we will draw the trench. Active portions are drawn with 0.5
|
||||||
// opacity. If <active> is false, the entire trench will be
|
// opacity. If <active> is false, the entire trench will be
|
||||||
// very translucent.
|
// very translucent.
|
||||||
show: function Trench_show( animateExtend ) { // DEBUG
|
show: function Trench_show() { // DEBUG
|
||||||
|
|
||||||
if (this.active && (this.showGuide || this.extended)) {
|
if (this.active && this.showGuide) {
|
||||||
if (!this.dom.guideTrench) {
|
if (!this.dom.guideTrench)
|
||||||
var guideTrench = this.dom.guideTrench = iQ("<div/>").addClass('guideTrench').css({id: 'guideTrench'+this.id});
|
this.dom.guideTrench = iQ("<div/>").addClass('guideTrench').css({id: 'guideTrench'+this.id});
|
||||||
// if (!this.animatingExtend)
|
var guideTrench = this.dom.guideTrench;
|
||||||
guideTrench.css(this.guideRect);
|
guideTrench.css(this.guideRect);
|
||||||
iQ("body").append(guideTrench);
|
iQ("body").append(guideTrench);
|
||||||
}
|
|
||||||
if (animateExtend) {
|
|
||||||
this.animatingExtend = true;
|
|
||||||
var self = this;
|
|
||||||
this.dom.guideTrench.animate( this.guideRect, {
|
|
||||||
complete: function () { self.animatingExtend = false; },
|
|
||||||
duration: 500,
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (this.dom.guideTrench) {
|
if (this.dom.guideTrench) {
|
||||||
this.dom.guideTrench.remove();
|
this.dom.guideTrench.remove();
|
||||||
delete this.dom.guideTrench;
|
delete this.dom.guideTrench;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Trenches.showDebug) {
|
if (!Trenches.showDebug) {
|
||||||
this.hide( true ); // true for dontHideGuides
|
this.hide( true ); // true for dontHideGuides
|
||||||
return;
|
return;
|
||||||
@ -287,8 +270,6 @@ Trench.prototype = {
|
|||||||
this.dom.activeVisibleTrench.remove();
|
this.dom.activeVisibleTrench.remove();
|
||||||
if (!dontHideGuides && this.dom.guideTrench)
|
if (!dontHideGuides && this.dom.guideTrench)
|
||||||
this.dom.guideTrench.remove();
|
this.dom.guideTrench.remove();
|
||||||
if (!dontHideGuides && this.extended)
|
|
||||||
this.unextend();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//----------
|
//----------
|
||||||
@ -428,12 +409,6 @@ Trench.prototype = {
|
|||||||
// only guide-type trenches need to set a separate active range
|
// only guide-type trenches need to set a separate active range
|
||||||
if (this.type != 'guide')
|
if (this.type != 'guide')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// if it's not extended yet, let's just add a little
|
|
||||||
if (!this.extended) {
|
|
||||||
this.setActiveRange(new Range(this.minRange.min - 30, this.minRange.max + 30));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var groups = Groups.groups;
|
var groups = Groups.groups;
|
||||||
var trench = this;
|
var trench = this;
|
||||||
@ -462,21 +437,6 @@ Trench.prototype = {
|
|||||||
trench.setActiveRange(activeRange);
|
trench.setActiveRange(activeRange);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
|
||||||
|
|
||||||
extend: function Trench_extend() {
|
|
||||||
this.extended = true;
|
|
||||||
this.calculateActiveRange();
|
|
||||||
this.show( true );
|
|
||||||
},
|
|
||||||
|
|
||||||
unextend: function Trench_unextend() {
|
|
||||||
this.snapBeginTime = false;
|
|
||||||
if (this.extended) {
|
|
||||||
this.extended = false;
|
|
||||||
this.calculateActiveRange();
|
|
||||||
this.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -489,11 +449,9 @@ var Trenches = {
|
|||||||
// nextId - (integer) a counter for the next <Trench>'s <Trench.id> value.
|
// nextId - (integer) a counter for the next <Trench>'s <Trench.id> value.
|
||||||
// showDebug - (boolean) whether to draw the <Trench>es or not.
|
// showDebug - (boolean) whether to draw the <Trench>es or not.
|
||||||
// defaultRadius - (integer) the default radius for new <Trench>es.
|
// defaultRadius - (integer) the default radius for new <Trench>es.
|
||||||
// extendTime - (integer) the number of milliseconds before a <Trench> is extended.
|
|
||||||
nextId: 0,
|
nextId: 0,
|
||||||
showDebug: false,
|
showDebug: false,
|
||||||
defaultRadius: 10,
|
defaultRadius: 10,
|
||||||
extendTime: 1000, // in milliseconds
|
|
||||||
|
|
||||||
// ---------
|
// ---------
|
||||||
// Variables: snapping preferences; used to break ties in snapping.
|
// Variables: snapping preferences; used to break ties in snapping.
|
||||||
@ -576,10 +534,8 @@ var Trenches = {
|
|||||||
// ---------
|
// ---------
|
||||||
// Function: hideGuides
|
// Function: hideGuides
|
||||||
// Hide all guides (dotted lines) en masse.
|
// Hide all guides (dotted lines) en masse.
|
||||||
hideGuides: function Trenches_hideGuides( dontHideExtendedGuides ) {
|
hideGuides: function Trenches_hideGuides() {
|
||||||
this.trenches.forEach(function(t) {
|
this.trenches.forEach(function(t) {
|
||||||
if (!dontHideExtendedGuides)
|
|
||||||
t.unextend();
|
|
||||||
t.showGuide = false;
|
t.showGuide = false;
|
||||||
t.show();
|
t.show();
|
||||||
});
|
});
|
||||||
@ -652,42 +608,26 @@ var Trenches = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let stamp = Date.now();
|
|
||||||
if (updated) {
|
|
||||||
for (let i in snappedTrenches) {
|
|
||||||
let t = snappedTrenches[i];
|
|
||||||
t.showGuide = true;
|
|
||||||
t.show();
|
|
||||||
if (t.type == 'guide' && !t.snapBeginTime) {
|
|
||||||
t.snapBeginTime = stamp;
|
|
||||||
iQ.timeout(function(){
|
|
||||||
// if the timestamp is still the same...
|
|
||||||
// that means that this is a continuation of the same drag instance.
|
|
||||||
if (stamp == t.snapBeginTime)
|
|
||||||
t.extend();
|
|
||||||
}, Trenches.extendTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// clear the snapBeginTime for the other trenches
|
|
||||||
let snappedIds = [ snappedTrenches[j].id for (j in snappedTrenches) ];
|
let snappedIds = [ snappedTrenches[j].id for (j in snappedTrenches) ];
|
||||||
for (let i in this.trenches) {
|
for (let i in this.trenches) {
|
||||||
let t = this.trenches[i];
|
let t = this.trenches[i];
|
||||||
|
// show the guide if it was used in snapping
|
||||||
|
if (snappedIds.indexOf(t.id) != -1) {
|
||||||
|
t.showGuide = true;
|
||||||
|
t.show();
|
||||||
|
}
|
||||||
// make sure to turn the guide off if we're no longer snapping to it
|
// make sure to turn the guide off if we're no longer snapping to it
|
||||||
if (t.showGuide && snappedIds.indexOf(t.id) == -1) {
|
if (t.showGuide && snappedIds.indexOf(t.id) == -1) {
|
||||||
t.showGuide = false;
|
t.showGuide = false;
|
||||||
t.show();
|
t.show();
|
||||||
}
|
}
|
||||||
if (t.snapBeginTime && snappedIds.indexOf(t.id) == -1 ) {
|
|
||||||
t.snapBeginTime = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updated) {
|
if (updated) {
|
||||||
rect.snappedTrenches = snappedTrenches;
|
rect.snappedTrenches = snappedTrenches;
|
||||||
return rect;
|
return rect;
|
||||||
} else {
|
} else {
|
||||||
Trenches.hideGuides( true );
|
Trenches.hideGuides();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user